作者 jinglong
1 个管道 的构建 通过 耗费 0 秒

支付成功更新优惠券已使用

@@ -497,9 +497,6 @@ class Common @@ -497,9 +497,6 @@ class Common
497 } 497 }
498 if(isset($data['coupon_id']) && !empty($data['coupon_id'])){ 498 if(isset($data['coupon_id']) && !empty($data['coupon_id'])){
499 $data1['coupon_id'] = $data['coupon_id'];//优惠券id 499 $data1['coupon_id'] = $data['coupon_id'];//优惠券id
500 - //更新优惠券已使用  
501 - $flag = config('verify.flag');  
502 - self::updateRCoupon($uid,$data['coupon_id'],$flag[1]);  
503 } 500 }
504 $data1['total_goods_price'] = $data['total_goods_price'];//商品金额 501 $data1['total_goods_price'] = $data['total_goods_price'];//商品金额
505 $data1['discount_price'] = $data['discount_price'];//优惠金额 502 $data1['discount_price'] = $data['discount_price'];//优惠金额
@@ -584,9 +581,9 @@ class Common @@ -584,9 +581,9 @@ class Common
584 $status = config('verify.status'); 581 $status = config('verify.status');
585 //更新订单号成功 582 //更新订单号成功
586 $orderModel = new Order(); 583 $orderModel = new Order();
587 - $orderModel->where(['pay_order_sn'=>$out_trade_no,'status'=>$status[0]])->update(['status'=>$status[2]]); 584 + $orderModel->where(['pay_order_sn'=>$out_trade_no,'status'=>$status[0]])->update(['status'=>$status[2]]);//待发货
588 //销量增加1 585 //销量增加1
589 - $res = self::findSoftWhereData('order',['pay_order_sn'=>$out_trade_no,'status'=>$status[2]],'id,uid'); 586 + $res = self::findSoftWhereData('order',['pay_order_sn'=>$out_trade_no,'status'=>$status[2]],'id,uid,coupon_id');
590 if($res){ 587 if($res){
591 $res1 = self::selectSoftWhereData('ogoods',['o_id'=>$res['id']],'id,g_id,style,goods_number'); 588 $res1 = self::selectSoftWhereData('ogoods',['o_id'=>$res['id']],'id,g_id,style,goods_number');
592 $g_ids = array_column($res1,'g_id'); 589 $g_ids = array_column($res1,'g_id');
@@ -613,6 +610,10 @@ class Common @@ -613,6 +610,10 @@ class Common
613 } 610 }
614 //删除购物车 611 //删除购物车
615 self::deleteCar(['uid'=>$res['uid'],'g_id'=>['in',$g_ids]]); 612 self::deleteCar(['uid'=>$res['uid'],'g_id'=>['in',$g_ids]]);
  613 +
  614 + //更新优惠券已使用
  615 + $flag = config('verify.flag');
  616 + self::updateRCoupon($res['uid'],$res['coupon_id'],$flag[1]);
616 } 617 }
617 } 618 }
618 619