|
|
@@ -567,13 +567,13 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
try {
|
|
|
|
|
|
//判断是否存在优惠券
|
|
|
- $is_coupon_used = \app\common\model\recharge\RechargeOrder::where([
|
|
|
+ $is_coupon_used_work_id = \app\common\model\recharge\RechargeOrder::where([
|
|
|
'order_type' => 0,
|
|
|
'user_id' => $params['user_id'],
|
|
|
'sn'=>$params['sn']
|
|
|
- ])->findOrEmpty();
|
|
|
- Log::write($is_coupon_used);
|
|
|
- if(!empty($is_coupon_used['coupon_id']) && $is_coupon_used['pay_status'] == 0){
|
|
|
+ ])->value('work_id');
|
|
|
+ $is_coupon_used = \app\common\model\recharge\RechargeOrder::where('work_id',$is_coupon_used_work_id)->where('pay_status',0)->findOrEmpty();
|
|
|
+ if(!empty($is_coupon_used['coupon_id'])){
|
|
|
$user_coupon = UserCoupon::where(['user_id'=>$is_coupon_used->user_id,'id'=>$is_coupon_used->coupon_id])->findOrEmpty();
|
|
|
$user_coupon->voucher_status = 0;
|
|
|
$user_coupon->voucher_count = $user_coupon->voucher_count+1;
|