新需求-活动需求-盲盒转盘调通盘-调试-优化错误

This commit is contained in:
2025-10-14 15:32:23 +08:00
parent 14f30dd692
commit 1878361188

View File

@@ -562,7 +562,6 @@ class BlindBoxTurntableGiftDrawWorld extends Model
// 批量更新 // 批量更新
foreach ($inventoryUpdates as $giftId => $count) { foreach ($inventoryUpdates as $giftId => $count) {
$ret = db::name("vs_gift_bag_detail")->where('id',$giftId) $ret = db::name("vs_gift_bag_detail")->where('id',$giftId)
->lock(true) // 添加悲观锁
->setDec('remaining_number', $count); ->setDec('remaining_number', $count);
if (!$ret) { if (!$ret) {
Log::record('巡乐会更新礼物剩余数量: ' . $room_id."【数据】".var_export($precomputedResults, true),"info"); Log::record('巡乐会更新礼物剩余数量: ' . $room_id."【数据】".var_export($precomputedResults, true),"info");
@@ -609,9 +608,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
// 使用悲观锁查询用户钱包 // 使用悲观锁查询用户钱包
$userWallet = db::name('user_wallet') $userWallet = db::name('user_wallet')
->where(['user_id' => $user_id]) ->where(['user_id' => $user_id])
->lock(true)
->find(); ->find();
if (!$userWallet || $userWallet['coin'] < $bagGiftPrice) { if (!$userWallet || $userWallet['coin'] < $bagGiftPrice) {
throw new \Exception('用户金币不足'); throw new \Exception('用户金币不足');
} }