diff --git a/app/Service/CouponRebateService.php b/app/Service/CouponRebateService.php index 49c085c..7a2f310 100644 --- a/app/Service/CouponRebateService.php +++ b/app/Service/CouponRebateService.php @@ -290,6 +290,11 @@ class CouponRebateService implements CouponRebateServiceInterface //开启事务 Db::beginTransaction(); try { + //读写锁 + Db::table('ims_system_user') + ->lockForUpdate() + ->where('id', $active['repay']) + ->get(); //返券 if($exists_coupon_rebate){ //如果已有该优惠券 则领取数量 和 可用数量 自增1