正在显示
5 个修改的文件
包含
36 行增加
和
38 行删除
@@ -479,6 +479,24 @@ class Common | @@ -479,6 +479,24 @@ class Common | ||
479 | } | 479 | } |
480 | 480 | ||
481 | /** | 481 | /** |
482 | + * 减库存 | ||
483 | + * @ApiInternal | ||
484 | + */ | ||
485 | + public static function decStock($where){ | ||
486 | + $goodsModel = new \app\admin\model\Goods(); | ||
487 | + $goodsModel->where($where)->setDec('stock',1); | ||
488 | + } | ||
489 | + | ||
490 | + /** | ||
491 | + * 增销量 | ||
492 | + * @ApiInternal | ||
493 | + */ | ||
494 | + public static function incSales($where){ | ||
495 | + $goodsModel = new \app\admin\model\Goods(); | ||
496 | + $goodsModel->where($where)->setInc('sales',1); | ||
497 | + } | ||
498 | + | ||
499 | + /** | ||
482 | * 更新优惠券 | 500 | * 更新优惠券 |
483 | * @ApiInternal | 501 | * @ApiInternal |
484 | */ | 502 | */ |
@@ -488,17 +506,21 @@ class Common | @@ -488,17 +506,21 @@ class Common | ||
488 | } | 506 | } |
489 | 507 | ||
490 | /** | 508 | /** |
491 | - * 购买成功,更新订单号,销量增加1 | 509 | + * 购买成功,更新订单号为待发货,销量增加1,减库存, |
492 | * @ApiInternal | 510 | * @ApiInternal |
493 | */ | 511 | */ |
494 | - public static function incSales($out_trade_no){ | 512 | + public static function paySuccess($out_trade_no){ |
495 | $status = config('verify.status'); | 513 | $status = config('verify.status'); |
496 | //更新订单号成功 | 514 | //更新订单号成功 |
497 | $orderModel = new Order(); | 515 | $orderModel = new Order(); |
498 | $orderModel->where(['pay_order_sn'=>$out_trade_no,'status'=>$status[0]])->update(['status'=>$status[2]]); | 516 | $orderModel->where(['pay_order_sn'=>$out_trade_no,'status'=>$status[0]])->update(['status'=>$status[2]]); |
499 | - $goodsModel = new \app\admin\model\Goods(); | ||
500 | //销量增加1 | 517 | //销量增加1 |
501 | $res = self::findSoftWhereData('order',['pay_order_sn'=>$out_trade_no,'status'=>$status[2]],'id'); | 518 | $res = self::findSoftWhereData('order',['pay_order_sn'=>$out_trade_no,'status'=>$status[2]],'id'); |
502 | - $goodsModel->where(['id'=>$res['id']])->setInc('sales',1); | 519 | + if($res){ |
520 | + $res1 = self::selectSoftWhereData('ogoods',['o_id'=>$res['id']],'id,g_id'); | ||
521 | + $g_ids = array_column($res1,'g_id'); | ||
522 | + self::decStock(['id'=>['in',$g_ids]]); | ||
523 | + self::incSales(['id'=>['in',$g_ids]]); | ||
524 | + } | ||
503 | } | 525 | } |
504 | } | 526 | } |
@@ -113,7 +113,7 @@ class Pay extends Api | @@ -113,7 +113,7 @@ class Pay extends Api | ||
113 | 113 | ||
114 | if ($message['result_code'] === 'SUCCESS') { | 114 | if ($message['result_code'] === 'SUCCESS') { |
115 | //支付成功,更新订单号,销量增加1 | 115 | //支付成功,更新订单号,销量增加1 |
116 | - Common::incSales($message['out_trade_no']); | 116 | + Common::paySuccess($message['out_trade_no']); |
117 | }elseif($message['result_code'] === 'FAIL') { | 117 | }elseif($message['result_code'] === 'FAIL') { |
118 | //支付失败 | 118 | //支付失败 |
119 | } | 119 | } |
@@ -219,7 +219,7 @@ class Pay extends Api | @@ -219,7 +219,7 @@ class Pay extends Api | ||
219 | if ($message['return_code'] === 'SUCCESS') { | 219 | if ($message['return_code'] === 'SUCCESS') { |
220 | if ($message['result_code'] === 'SUCCESS') { | 220 | if ($message['result_code'] === 'SUCCESS') { |
221 | //支付成功,更新订单号,销量增加1 | 221 | //支付成功,更新订单号,销量增加1 |
222 | - Common::incSales($message['out_trade_no']); | 222 | + Common::paySuccess($message['out_trade_no']); |
223 | }elseif($message['result_code'] === 'FAIL') { | 223 | }elseif($message['result_code'] === 'FAIL') { |
224 | //支付失败,好像有问题 | 224 | //支付失败,好像有问题 |
225 | } | 225 | } |
@@ -10,7 +10,7 @@ use think\Validate; | @@ -10,7 +10,7 @@ use think\Validate; | ||
10 | */ | 10 | */ |
11 | class Search extends Api | 11 | class Search extends Api |
12 | { | 12 | { |
13 | - protected $noNeedLogin = []; | 13 | + protected $noNeedLogin = ['searchGoodsList']; |
14 | protected $noNeedRight = ['*']; | 14 | protected $noNeedRight = ['*']; |
15 | protected $uid = ''; | 15 | protected $uid = ''; |
16 | public function _initialize() | 16 | public function _initialize() |
@@ -24,7 +24,6 @@ class Search extends Api | @@ -24,7 +24,6 @@ class Search extends Api | ||
24 | * @ApiSummary (商品检索列表) | 24 | * @ApiSummary (商品检索列表) |
25 | * @ApiMethod (GET) | 25 | * @ApiMethod (GET) |
26 | * @ApiRoute (/api/search/searchGoodsList) | 26 | * @ApiRoute (/api/search/searchGoodsList) |
27 | - * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
28 | * | 27 | * |
29 | * @ApiParams (name="keyword", type="string", required=true, description="检索关键字") | 28 | * @ApiParams (name="keyword", type="string", required=true, description="检索关键字") |
30 | * @ApiParams (name="page", type="inter", required=true, description="分页页码") | 29 | * @ApiParams (name="page", type="inter", required=true, description="分页页码") |
@@ -480,6 +480,11 @@ class User extends Api | @@ -480,6 +480,11 @@ class User extends Api | ||
480 | $this->error($validate->getError()); | 480 | $this->error($validate->getError()); |
481 | } | 481 | } |
482 | 482 | ||
483 | + if($share_uid == $this->uid){ | ||
484 | + //携带参数错误 | ||
485 | + $this->error('失败'); | ||
486 | + } | ||
487 | + | ||
483 | $rCouponModel = new Rcoupon(); | 488 | $rCouponModel = new Rcoupon(); |
484 | //查询分享人已领取优惠券 | 489 | //查询分享人已领取优惠券 |
485 | $receive = Common::selectWhereData('rcoupon',['uid'=>$share_uid],'id,c_id'); | 490 | $receive = Common::selectWhereData('rcoupon',['uid'=>$share_uid],'id,c_id'); |
@@ -5823,24 +5823,7 @@ | @@ -5823,24 +5823,7 @@ | ||
5823 | <div class="panel panel-default"> | 5823 | <div class="panel panel-default"> |
5824 | <div class="panel-heading"><strong>Headers</strong></div> | 5824 | <div class="panel-heading"><strong>Headers</strong></div> |
5825 | <div class="panel-body"> | 5825 | <div class="panel-body"> |
5826 | - <table class="table table-hover"> | ||
5827 | - <thead> | ||
5828 | - <tr> | ||
5829 | - <th>名称</th> | ||
5830 | - <th>类型</th> | ||
5831 | - <th>必选</th> | ||
5832 | - <th>描述</th> | ||
5833 | - </tr> | ||
5834 | - </thead> | ||
5835 | - <tbody> | ||
5836 | - <tr> | ||
5837 | - <td>token</td> | ||
5838 | - <td>string</td> | ||
5839 | - <td>是</td> | ||
5840 | - <td>请求的Token</td> | ||
5841 | - </tr> | ||
5842 | - </tbody> | ||
5843 | - </table> | 5826 | + 无 |
5844 | </div> | 5827 | </div> |
5845 | </div> | 5828 | </div> |
5846 | <div class="panel panel-default"> | 5829 | <div class="panel panel-default"> |
@@ -5883,17 +5866,6 @@ | @@ -5883,17 +5866,6 @@ | ||
5883 | <div class="row"> | 5866 | <div class="row"> |
5884 | <div class="col-md-12"> | 5867 | <div class="col-md-12"> |
5885 | <div class="panel panel-default"> | 5868 | <div class="panel panel-default"> |
5886 | - <div class="panel-heading"><strong>Headers</strong></div> | ||
5887 | - <div class="panel-body"> | ||
5888 | - <div class="headers"> | ||
5889 | - <div class="form-group"> | ||
5890 | - <label class="control-label" for="token">token</label> | ||
5891 | - <input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token"> | ||
5892 | - </div> | ||
5893 | - </div> | ||
5894 | - </div> | ||
5895 | - </div> | ||
5896 | - <div class="panel panel-default"> | ||
5897 | <div class="panel-heading"><strong>参数</strong></div> | 5869 | <div class="panel-heading"><strong>参数</strong></div> |
5898 | <div class="panel-body"> | 5870 | <div class="panel-body"> |
5899 | <form enctype="application/x-www-form-urlencoded" role="form" action="/api/search/searchGoodsList" method="GET" name="form36" id="form36"> | 5871 | <form enctype="application/x-www-form-urlencoded" role="form" action="/api/search/searchGoodsList" method="GET" name="form36" id="form36"> |
@@ -7271,7 +7243,7 @@ | @@ -7271,7 +7243,7 @@ | ||
7271 | 7243 | ||
7272 | <div class="row mt0 footer"> | 7244 | <div class="row mt0 footer"> |
7273 | <div class="col-md-6" align="left"> | 7245 | <div class="col-md-6" align="left"> |
7274 | - Generated on 2019-12-05 19:38:12 </div> | 7246 | + Generated on 2019-12-06 10:16:14 </div> |
7275 | <div class="col-md-6" align="right"> | 7247 | <div class="col-md-6" align="right"> |
7276 | <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a> | 7248 | <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a> |
7277 | </div> | 7249 | </div> |
-
请 注册 或 登录 后发表评论