作者 何书鹏

商品接口

@@ -184,7 +184,10 @@ class Goods extends Model @@ -184,7 +184,10 @@ class Goods extends Model
184 'minute' => 0, 184 'minute' => 0,
185 'second' => 0, 185 'second' => 0,
186 ]; 186 ];
187 - $soon_starttime = 0; // 即将开抢时间 187 + $soon_starttime = [
  188 + 'hour' => 0,
  189 + 'minute' => 0,
  190 + ]; // 即将开抢时间
188 $tomorrow_start = strtotime(date('Y-m-d',strtotime('+1 day'))); //明日开始时间 191 $tomorrow_start = strtotime(date('Y-m-d',strtotime('+1 day'))); //明日开始时间
189 $tomorrow_end = strtotime(date('Y-m-d',strtotime('+1 day'))) + 86400; //明日结束时间 192 $tomorrow_end = strtotime(date('Y-m-d',strtotime('+1 day'))) + 86400; //明日结束时间
190 $where['type'] = 'seckill'; 193 $where['type'] = 'seckill';
@@ -192,7 +195,7 @@ class Goods extends Model @@ -192,7 +195,7 @@ class Goods extends Model
192 $where['endtime'] = ['>', time()]; 195 $where['endtime'] = ['>', time()];
193 $activity = Activity::where($where)->order('starttime')->find(); 196 $activity = Activity::where($where)->order('starttime')->find();
194 if($activity){ //本场 197 if($activity){ //本场
195 - $type = '1'; 198 + $type = 'ing';
196 // 本场倒计时 199 // 本场倒计时
197 $lefttime = $activity['endtime'] - time(); 200 $lefttime = $activity['endtime'] - time();
198 $current_endtime = [ 201 $current_endtime = [
@@ -205,13 +208,16 @@ class Goods extends Model @@ -205,13 +208,16 @@ class Goods extends Model
205 $where['endtime'] = ['<', $tomorrow_start]; 208 $where['endtime'] = ['<', $tomorrow_start];
206 $activity = Activity::where($where)->order('starttime')->find(); 209 $activity = Activity::where($where)->order('starttime')->find();
207 if($activity){ 210 if($activity){
208 - $type = '2';  
209 - $soon_starttime = date('H:i',$activity['starttime']); 211 + $type = 'nostart';
  212 + $soon_starttime = [
  213 + 'hour' => date('H', $activity['starttime']),
  214 + 'minute' => date('i', $activity['starttime']),
  215 + ];
210 }else{ //明日预告 216 }else{ //明日预告
211 $where['starttime'] = ['>', $tomorrow_start]; 217 $where['starttime'] = ['>', $tomorrow_start];
212 $where['endtime'] = ['<', $tomorrow_end]; 218 $where['endtime'] = ['<', $tomorrow_end];
213 $activity = Activity::where($where)->order('starttime')->find(); 219 $activity = Activity::where($where)->order('starttime')->find();
214 - $type = '3'; 220 + $type = 'tomorrow';
215 } 221 }
216 } 222 }
217 $goodsList = []; 223 $goodsList = [];
@@ -225,12 +231,15 @@ class Goods extends Model @@ -225,12 +231,15 @@ class Goods extends Model
225 231
226 // 首页拼团列表 232 // 首页拼团列表
227 public static function indexGrouponGoodsList() { 233 public static function indexGrouponGoodsList() {
228 - $current_endtime = [ // 距本场结束时间 234 + $current_endtime = [
229 'hour' => 0, 235 'hour' => 0,
230 'minute' => 0, 236 'minute' => 0,
231 'second' => 0, 237 'second' => 0,
232 - ];  
233 - $soon_starttime = 0; // 即将开抢时间 238 + ]; // 距本场结束时间
  239 + $soon_starttime = [
  240 + 'hour' => 0,
  241 + 'minute' => 0,
  242 + ]; // 即将开抢时间
234 $tomorrow_start = strtotime(date('Y-m-d',strtotime('+1 day'))); //明日开始时间 243 $tomorrow_start = strtotime(date('Y-m-d',strtotime('+1 day'))); //明日开始时间
235 $tomorrow_end = strtotime(date('Y-m-d',strtotime('+1 day'))) + 86400; //明日结束时间 244 $tomorrow_end = strtotime(date('Y-m-d',strtotime('+1 day'))) + 86400; //明日结束时间
236 $where['type'] = 'groupon'; 245 $where['type'] = 'groupon';
@@ -252,7 +261,10 @@ class Goods extends Model @@ -252,7 +261,10 @@ class Goods extends Model
252 $activity = Activity::where($where)->order('starttime')->find(); 261 $activity = Activity::where($where)->order('starttime')->find();
253 if($activity){ 262 if($activity){
254 $type = 'nostart'; 263 $type = 'nostart';
255 - $soon_starttime = date('H:i',$activity['starttime']); 264 + $soon_starttime = [
  265 + 'hour' => date('H', $activity['starttime']),
  266 + 'minute' => date('i', $activity['starttime']),
  267 + ];
256 }else{ //明日预告 268 }else{ //明日预告
257 $where['starttime'] = ['>', $tomorrow_start]; 269 $where['starttime'] = ['>', $tomorrow_start];
258 $where['endtime'] = ['<', $tomorrow_end]; 270 $where['endtime'] = ['<', $tomorrow_end];
@@ -167,7 +167,12 @@ class Goods extends Base @@ -167,7 +167,12 @@ class Goods extends Base
167 "dispatch_type_arr": [ 167 "dispatch_type_arr": [
168 "express" 168 "express"
169 ], 169 ],
170 - "service": [], 170 + "service": [{ //服务标签
  171 + "id": 4, //标签ID
  172 + "name": "极速退款", //名称
  173 + "image": "http://api.7wpp.com/uploads/20200222/57d971eb5984317ee794e531ea0f9207.png", //图片
  174 + "description": "超快无审核退款流程" //描述
  175 + }],
171 "sku": [], 176 "sku": [],
172 "coupons": [] 177 "coupons": []
173 } 178 }
@@ -71,13 +71,16 @@ class Index extends Base @@ -71,13 +71,16 @@ class Index extends Base
71 "image": "http://www.ant.top/uploads/20201221/559d2a240ec20b096590a902217009ff.png", //分类图片 71 "image": "http://www.ant.top/uploads/20201221/559d2a240ec20b096590a902217009ff.png", //分类图片
72 }], 72 }],
73 "seckill_list": { 73 "seckill_list": {
74 - "type": "1",  
75 - "current_endtime": { 74 + "type": "ing", // 类型:ing=进行中,nostart=即将开始,tomorrow=明日预告
  75 + "current_endtime": { //距离本场结束
76 "hour": 10, 76 "hour": 10,
77 "minute": 12, 77 "minute": 12,
78 "second": 19 78 "second": 19
79 }, 79 },
80 - "soon_starttime": 0, 80 + "soon_starttime": [ //即将开始时间
  81 + "hour": 14,
  82 + "minute": 00
  83 + ],
81 "goodsList": [{ 84 "goodsList": [{
82 "id": 1, //商品ID 85 "id": 1, //商品ID
83 "type": "normal", 86 "type": "normal",
@@ -147,13 +150,16 @@ class Index extends Base @@ -147,13 +150,16 @@ class Index extends Base
147 }] 150 }]
148 }, 151 },
149 "groupon_list": { 152 "groupon_list": {
150 - "type": "1", 153 + "type": "ing", // 类型:ing=进行中,nostart=即将开始,tomorrow=明日预告
151 "current_endtime": { 154 "current_endtime": {
152 "hour": 10, 155 "hour": 10,
153 "minute": 12, 156 "minute": 12,
154 "second": 19 157 "second": 19
155 }, 158 },
156 - "soon_starttime": 0, 159 + "soon_starttime": [ //即将开始时间
  160 + "hour": 14,
  161 + "minute": 00
  162 + ],
157 "goodsList":[{ 163 "goodsList":[{
158 "id": 2, //商品ID 164 "id": 2, //商品ID
159 "type": "normal", 165 "type": "normal",
@@ -146,7 +146,7 @@ @@ -146,7 +146,7 @@
146 </div> 146 </div>
147 <a href="#首页接口" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">首页接口 <i class="fa fa-caret-down"></i></a> 147 <a href="#首页接口" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">首页接口 <i class="fa fa-caret-down"></i></a>
148 <div class="child collapse" id="首页接口"> 148 <div class="child collapse" id="首页接口">
149 - <a href="javascript:;" data-id="26" class="list-group-item">首页</a> 149 + <a href="javascript:;" data-id="26" class="list-group-item">@ApiWeigh (99)</a>
150 <a href="javascript:;" data-id="27" class="list-group-item">上传文件</a> 150 <a href="javascript:;" data-id="27" class="list-group-item">上传文件</a>
151 <a href="javascript:;" data-id="28" class="list-group-item">上传 base64 图片</a> 151 <a href="javascript:;" data-id="28" class="list-group-item">上传 base64 图片</a>
152 </div> 152 </div>
@@ -649,7 +649,7 @@ @@ -649,7 +649,7 @@
649 <div class="panel-heading" id="heading-26"> 649 <div class="panel-heading" id="heading-26">
650 <h4 class="panel-title"> 650 <h4 class="panel-title">
651 <span class="label label-success">GET</span> 651 <span class="label label-success">GET</span>
652 - <a data-toggle="collapse" data-parent="#accordion26" href="#collapseOne26"> 首页 <span class="text-muted">/api/index/index</span></a> 652 + <a data-toggle="collapse" data-parent="#accordion26" href="#collapseOne26"> @ApiWeigh (99) <span class="text-muted">/api/index/index</span></a>
653 </h4> 653 </h4>
654 </div> 654 </div>
655 <div id="collapseOne26" class="panel-collapse collapse"> 655 <div id="collapseOne26" class="panel-collapse collapse">
@@ -667,28 +667,11 @@ @@ -667,28 +667,11 @@
667 667
668 <div class="tab-pane active" id="info26"> 668 <div class="tab-pane active" id="info26">
669 <div class="well"> 669 <div class="well">
670 - 首页 </div> 670 + @ApiWeigh (99) </div>
671 <div class="panel panel-default"> 671 <div class="panel panel-default">
672 <div class="panel-heading"><strong>Headers</strong></div> 672 <div class="panel-heading"><strong>Headers</strong></div>
673 <div class="panel-body"> 673 <div class="panel-body">
674 - <table class="table table-hover">  
675 - <thead>  
676 - <tr>  
677 - <th>名称</th>  
678 - <th>类型</th>  
679 - <th>必选</th>  
680 - <th>描述</th>  
681 - </tr>  
682 - </thead>  
683 - <tbody>  
684 - <tr>  
685 - <td>token</td>  
686 - <td>string</td>  
687 - <td></td>  
688 - <td>请求的token</td>  
689 - </tr>  
690 - </tbody>  
691 - </table> 674 +
692 </div> 675 </div>
693 </div> 676 </div>
694 <div class="panel panel-default"> 677 <div class="panel panel-default">
@@ -708,20 +691,9 @@ @@ -708,20 +691,9 @@
708 <div class="row"> 691 <div class="row">
709 <div class="col-md-12"> 692 <div class="col-md-12">
710 <div class="panel panel-default"> 693 <div class="panel panel-default">
711 - <div class="panel-heading"><strong>Headers</strong></div>  
712 - <div class="panel-body">  
713 - <div class="headers">  
714 - <div class="form-group">  
715 - <label class="control-label" for="token">token</label>  
716 - <input type="string" class="form-control input-sm" id="token" placeholder="请求的token - Ex: " name="token">  
717 - </div>  
718 - </div>  
719 - </div>  
720 - </div>  
721 - <div class="panel panel-default">  
722 <div class="panel-heading"><strong>参数</strong></div> 694 <div class="panel-heading"><strong>参数</strong></div>
723 <div class="panel-body"> 695 <div class="panel-body">
724 - <form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/index" method="GET" name="form26" id="form26"> 696 + <form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/index" method="get" name="form26" id="form26">
725 <div class="form-group"> 697 <div class="form-group">
726 698
727 </div> 699 </div>
@@ -756,212 +728,7 @@ @@ -756,212 +728,7 @@
756 <div class="tab-pane" id="sample26"> 728 <div class="tab-pane" id="sample26">
757 <div class="row"> 729 <div class="row">
758 <div class="col-md-12"> 730 <div class="col-md-12">
759 - <pre id="sample_response26">{  
760 - "code": 1,  
761 - "msg": "优惠券中心",  
762 - "time": "1607909742",  
763 - "data": [{  
764 - "id": 1, //优惠券ID  
765 - "name": "满100减10", //优惠券名称  
766 - "type": "cash",  
767 - "goods_ids": "0",  
768 - "amount": "10.00", //减免金额  
769 - "enough": "100.00", //使用门槛  
770 - "stock": 0, //剩余券数量  
771 - "limit": 1, //每人限领  
772 - "gettime": {  
773 - "start": 1607875200,  
774 - "end": 1610640000  
775 - },  
776 - "usetime": { //有效期  
777 - "start": "2020.12.18", //开始时间  
778 - "end": "2021.01.30" //结束时间  
779 - },  
780 - "description": "满100减10", //优惠券描述  
781 - "usetimestart": 1608220800,  
782 - "usetimeend": 1611936000,  
783 - "gettimestart": 1607875200,  
784 - "gettimeend": 1610640000,  
785 - "user_coupons_id": 1, //领取ID  
786 - "status_code": 1610640000, //状态码:no_use=未使用,used=已使用,expired=已过期  
787 - "status_name": "未使用" //状态名称  
788 - }]  
789 - }{  
790 - "code": 1,  
791 - "msg": "首页",  
792 - "time": "1608036399",  
793 - "data": {  
794 - "banner_list": [{ //轮播图  
795 - "id": 3, //轮播图ID  
796 - "image": "http://www.ant.top/uploads/20201214/b655ea4dc4779222ab7a4e2b95feb3a4.png" //图片地址  
797 - }],  
798 - "category_list": [{ //一级分类  
799 - "id": 1, //分类ID  
800 - "name": "商品分类", //分类名称  
801 - "image": "http://www.ant.top/uploads/20201221/559d2a240ec20b096590a902217009ff.png", //分类图片  
802 - }],  
803 - "seckill_list": {  
804 - "type": "1",  
805 - "current_endtime": {  
806 - "hour": 10,  
807 - "minute": 12,  
808 - "second": 19  
809 - },  
810 - "soon_starttime": 0,  
811 - "goodsList": [{  
812 - "id": 1, //商品ID  
813 - "type": "normal",  
814 - "title": "测试商品", //标题  
815 - "subtitle": "测试啊", //副标题  
816 - "weigh": 0,  
817 - "category_ids": "3", //所属分类ID  
818 - "image": "http://www.ant.top/assets/img/qrcode.png", //商品主图  
819 - "price": "0.01", //商品价格  
820 - "original_price": "10000.00", //原价  
821 - "is_sku": 0,  
822 - "likes": 0,  
823 - "views": 3,  
824 - "sales": 0, //销量  
825 - "show_sales": 0, //显示销量  
826 - "dispatch_type": "express",  
827 - "dispatch_ids": "1",  
828 - "deletetime": null,  
829 - "activity": {  
830 - "id": 7,  
831 - "title": "秒杀测试",  
832 - "type": "seckill",  
833 - "richtext_id": 0,  
834 - "richtext_title": "",  
835 - "starttime": 1607616000,  
836 - "endtime": 1607702400,  
837 - "rules": {  
838 - "limit_buy": "1",  
839 - "order_auto_close": "",  
840 - "activity_auto_close": ""  
841 - }  
842 - },  
843 - "activity_type": "seckill",  
844 - "sku_price": [{  
845 - "id": 1,  
846 - "goods_sku_ids": null,  
847 - "goods_id": 1,  
848 - "weigh": 0,  
849 - "image": null,  
850 - "stock": 20,  
851 - "sales": 0,  
852 - "sn": "",  
853 - "weight": 0,  
854 - "price": "0.01",  
855 - "goods_sku_text": null,  
856 - "status": "up",  
857 - "activity_type": "seckill",  
858 - "activity_id": 7,  
859 - "item_goods_sku_price": {  
860 - "id": 4,  
861 - "activity_id": 7,  
862 - "sku_price_id": 1,  
863 - "goods_id": 1,  
864 - "stock": 20,  
865 - "sales": 0,  
866 - "price": "0.01",  
867 - "status": "up"  
868 - },  
869 - "goods_sku_id_arr": [  
870 - ""  
871 - ]  
872 - }],  
873 - "stock": 20,  
874 - "dispatch_type_arr": [  
875 - "express"  
876 - ]  
877 - }]  
878 - },  
879 - "groupon_list": {  
880 - "type": "1",  
881 - "current_endtime": {  
882 - "hour": 10,  
883 - "minute": 12,  
884 - "second": 19  
885 - },  
886 - "soon_starttime": 0,  
887 - "goodsList":[{  
888 - "id": 2, //商品ID  
889 - "type": "normal",  
890 - "title": "测试商品2", //商品标题  
891 - "subtitle": "测试啊啊", //商品副标题  
892 - "weigh": 0,  
893 - "category_ids": "3",  
894 - "image": "http://www.ant.top/uploads/20201211/8894d62100f2f920ffb2f38063b63f2d.jpg", //商品主图  
895 - "price": "0.02", //现价  
896 - "original_price": "1000.00", //原价  
897 - "is_sku": 0, //是否多规格:0=否,1=是  
898 - "likes": 0,  
899 - "views": 1,  
900 - "sales": 0,  
901 - "show_sales": 0, //显示销量  
902 - "dispatch_type": "express",  
903 - "dispatch_ids": "1",  
904 - "deletetime": null,  
905 - "activity": {  
906 - "id": 9, //活动ID  
907 - "title": "拼团测试", //活动标题  
908 - "type": "groupon", //活动类型:seckill=秒杀,groupon=拼团  
909 - "richtext_id": 0,  
910 - "richtext_title": "",  
911 - "starttime": 1607616000,  
912 - "endtime": 1607702400,  
913 - "rules": { //活动规则  
914 - "limit_buy": "1", //每人限购件数  
915 - "order_auto_close": "",  
916 - "activity_auto_close": "",  
917 - "team_num": "2", //成团人数  
918 - "is_alone": "0", //是否允许单独购买  
919 - "is_fictitious": "0",  
920 - "fictitious_num": "",  
921 - "valid_time": "",  
922 - "team_card": "0"  
923 - }  
924 - },  
925 - "activity_type": "groupon",  
926 - "groupon_price": "0.01",  
927 - "sku_price": [{  
928 - "id": 2,  
929 - "goods_sku_ids": null,  
930 - "goods_id": 2,  
931 - "weigh": 0,  
932 - "image": null,  
933 - "stock": 10,  
934 - "sales": 0,  
935 - "sn": "",  
936 - "weight": 0,  
937 - "price": "0.02",  
938 - "goods_sku_text": null,  
939 - "status": "up",  
940 - "groupon_price": "0.01",  
941 - "activity_type": "groupon",  
942 - "activity_id": 9,  
943 - "item_goods_sku_price": {  
944 - "id": 5,  
945 - "activity_id": 9,  
946 - "sku_price_id": 2,  
947 - "goods_id": 2,  
948 - "stock": 10,  
949 - "sales": 0,  
950 - "price": "0.01",  
951 - "status": "up"  
952 - },  
953 - "goods_sku_id_arr": [  
954 - ""  
955 - ]  
956 - }],  
957 - "stock": 10,  
958 - "dispatch_type_arr": [  
959 - "express"  
960 - ]  
961 - }]  
962 - }  
963 - }  
964 - }</pre> 731 + <pre id="sample_response26"></pre>
965 </div> 732 </div>
966 </div> 733 </div>
967 </div><!-- #sample --> 734 </div><!-- #sample -->
@@ -7157,7 +6924,12 @@ @@ -7157,7 +6924,12 @@
7157 "dispatch_type_arr": [ 6924 "dispatch_type_arr": [
7158 "express" 6925 "express"
7159 ], 6926 ],
7160 - "service": [], 6927 + "service": [{ //服务标签
  6928 + "id": 4, //标签ID
  6929 + "name": "极速退款", //名称
  6930 + "image": "http://api.7wpp.com/uploads/20200222/57d971eb5984317ee794e531ea0f9207.png", //图片
  6931 + "description": "超快无审核退款流程" //描述
  6932 + }],
7161 "sku": [], 6933 "sku": [],
7162 "coupons": [] 6934 "coupons": []
7163 } 6935 }
@@ -10316,7 +10088,7 @@ @@ -10316,7 +10088,7 @@
10316 10088
10317 <div class="row mt0 footer"> 10089 <div class="row mt0 footer">
10318 <div class="col-md-6" align="left"> 10090 <div class="col-md-6" align="left">
10319 - Generated on 2020-12-21 11:29:00 </div> 10091 + Generated on 2020-12-21 16:56:10 </div>
10320 <div class="col-md-6" align="right"> 10092 <div class="col-md-6" align="right">
10321 <a href="./" target="_blank">My Website</a> 10093 <a href="./" target="_blank">My Website</a>
10322 </div> 10094 </div>