盲盒转盘优化-调试
This commit is contained in:
@@ -351,7 +351,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
'draw_times' => $totalDrawTimes,
|
'draw_times' => $totalDrawTimes,
|
||||||
'periods' => $periods,
|
'periods' => $periods,
|
||||||
];
|
];
|
||||||
$totalDrawTimes++;
|
// $totalDrawTimes++;
|
||||||
$currentXlhPeriodsNum++;
|
$currentXlhPeriodsNum++;
|
||||||
$addcurrentXlhPeriodsNum++;
|
$addcurrentXlhPeriodsNum++;
|
||||||
|
|
||||||
@@ -361,6 +361,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$totalDrawTimes = 0;
|
||||||
}
|
}
|
||||||
// 再从新奖池中分配剩余所需礼物
|
// 再从新奖池中分配剩余所需礼物
|
||||||
if ($newGiftsNeeded > 0 && !empty($availableGifts)) {
|
if ($newGiftsNeeded > 0 && !empty($availableGifts)) {
|
||||||
@@ -389,6 +390,9 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
foreach ($availableGifts as &$gift) {
|
foreach ($availableGifts as &$gift) {
|
||||||
if ($gift['id'] == $selectedGift['id']) {
|
if ($gift['id'] == $selectedGift['id']) {
|
||||||
$gift['remaining_number']--;
|
$gift['remaining_number']--;
|
||||||
|
if($gift['remaining_number'] ==0){
|
||||||
|
unset($gift);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -548,7 +552,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. 批量更新库存(按ID排序避免死锁)
|
// 3. 批量更新库存(按ID排序避免死锁)
|
||||||
$this->batchUpdateGiftInventory($availableGiftss, $room_id);
|
$this->batchUpdateGiftInventory($availableGiftss);
|
||||||
|
|
||||||
// 4. 批量插入礼包发放记录
|
// 4. 批量插入礼包发放记录
|
||||||
$this->batchInsertGiftBagReceiveLog($user_id, $boxTurntableLog, $bag_data, $room_id, $precomputedResults);
|
$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分组统计需要减少的数量
|
// 按礼物ID分组统计需要减少的数量
|
||||||
$inventoryUpdates = [];
|
$inventoryUpdates = [];
|
||||||
@@ -705,7 +709,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
|
|
||||||
// 3. 处理巡乐会相关操作
|
// 3. 处理巡乐会相关操作
|
||||||
if (!empty($xlh_ext) && $xlh_ext['inlet_bag_id'] == $precomputedResults[0]['gift_bag_detail']['gift_bag_id']) {
|
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;
|
$xlhIsPiaoPing = 0;
|
||||||
$xlhPeriodsNum = $this->getCachedXlhPeriodsNum("get");
|
$xlhPeriodsNum = $this->getCachedXlhPeriodsNum("get");
|
||||||
|
|||||||
Reference in New Issue
Block a user