diff --git a/app/Service/CouponRebateService.php b/app/Service/CouponRebateService.php index 78213ae..af734c0 100644 --- a/app/Service/CouponRebateService.php +++ b/app/Service/CouponRebateService.php @@ -193,16 +193,6 @@ class CouponRebateService implements CouponRebateServiceInterface // if($inventory['inventory'] <= 0){ // return '库存不足'; // } - //判断用户是否已有该类型优惠券 - $exist_coupon = Db::table('ims_system_coupon_user_receive') - ->where([ - ['system_coupon_user_id', '=', $coupon->system_coupon_id], - ['user_id', '=', $coupon->send_user_id], - ['receive_type', '=', 5], - ['status', '=', 0], - ]) - ->select('id') - ->first(); //return $exist_coupon; //开启事务 try { @@ -211,7 +201,7 @@ class CouponRebateService implements CouponRebateServiceInterface * 否则新增一条返券记录 */ $nowTime = time(); - $res = Db::table('ims_system_coupon_user_receive')->updateOrIncrement( + $res = Db::table('ims_system_coupon_user_receive')->moreIncrementOrInsert( [ 'system_coupon_user_id' => $coupon->system_coupon_id, 'user_id' => $coupon->send_user_id, @@ -254,6 +244,6 @@ class CouponRebateService implements CouponRebateServiceInterface } - return $exist_coupon->id; + return '返券成功'; } } \ No newline at end of file