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");