From c715d1e81fc02cf99a408b9bed84a0c5bb28ba4b Mon Sep 17 00:00:00 2001 From: "DESKTOP-GG6FIN9\\Administrator" <15040771@qq.com> Date: Thu, 6 Aug 2020 15:06:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E8=87=AA=E5=A2=9Eor=E6=8F=92?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/CouponRebateService.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) 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