From b4827f823b2f4d74ef8b55efb41800c3ada2b632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=92=8A?= Date: Sat, 25 Oct 2025 10:05:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B2=E7=9B=92=E8=BD=AC=E7=9B=98=E4=BC=98?= =?UTF-8?q?=E5=8C=96-=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/model/BlindBoxTurntableGiftDrawWorld.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/application/api/model/BlindBoxTurntableGiftDrawWorld.php b/application/api/model/BlindBoxTurntableGiftDrawWorld.php index 14ceb2a..f1609d1 100644 --- a/application/api/model/BlindBoxTurntableGiftDrawWorld.php +++ b/application/api/model/BlindBoxTurntableGiftDrawWorld.php @@ -351,7 +351,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model 'draw_times' => $totalDrawTimes, 'periods' => $periods, ]; - $totalDrawTimes++; +// $totalDrawTimes++; $currentXlhPeriodsNum++; $addcurrentXlhPeriodsNum++; @@ -361,6 +361,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model } } } + $totalDrawTimes = 0; } // 再从新奖池中分配剩余所需礼物 if ($newGiftsNeeded > 0 && !empty($availableGifts)) { @@ -389,6 +390,9 @@ class BlindBoxTurntableGiftDrawWorld extends Model foreach ($availableGifts as &$gift) { if ($gift['id'] == $selectedGift['id']) { $gift['remaining_number']--; + if($gift['remaining_number'] ==0){ + unset($gift); + } break; } } @@ -548,7 +552,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model } // 3. 批量更新库存(按ID排序避免死锁) - $this->batchUpdateGiftInventory($availableGiftss, $room_id); + $this->batchUpdateGiftInventory($availableGiftss); // 4. 批量插入礼包发放记录 $this->batchInsertGiftBagReceiveLog($user_id, $boxTurntableLog, $bag_data, $room_id, $precomputedResults); @@ -581,7 +585,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model /** * 批量更新礼物库存 */ - private function batchUpdateGiftInventory($precomputedResults, $room_id) + private function batchUpdateGiftInventory($precomputedResults) { // 按礼物ID分组统计需要减少的数量 $inventoryUpdates = []; @@ -705,7 +709,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model // 3. 处理巡乐会相关操作 if (!empty($xlh_ext) && $xlh_ext['inlet_bag_id'] == $precomputedResults[0]['gift_bag_detail']['gift_bag_id']) { - $this->handleXlhOperations($room_id, $xlh_ext, $currentXlhPeriodsNum,$addcurrentXlhPeriodsNum,$room); + $this->handleXlhOperations($room_id, $xlh_ext, $currentXlhPeriodsNum,$addcurrentXlhPeriodsNum); } } @@ -806,7 +810,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model /** * 处理巡乐会相关操作 */ - private function handleXlhOperations($room_id, $xlh_ext, $currentXlhPeriodsNum,$addcurrentXlhPeriodsNum,$room) + private function handleXlhOperations($room_id, $xlh_ext, $currentXlhPeriodsNum,$addcurrentXlhPeriodsNum) { $xlhIsPiaoPing = 0; $xlhPeriodsNum = $this->getCachedXlhPeriodsNum("get");