From 054b2a8ea4739494c31e68f3941e9e2fc8887e2d Mon Sep 17 00:00:00 2001 From: "DESKTOP-GG6FIN9\\Administrator" <15040771@qq.com> Date: Wed, 12 Aug 2020 14:33:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/CouponRebateService.php | 5 +++++ 1 file changed, 5 insertions(+) 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