盲盒转盘优化
This commit is contained in:
@@ -338,7 +338,6 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
if(!empty($remaining_available_gifts)){
|
||||
$randomKey = array_rand($remaining_available_gifts);
|
||||
$selectedGift = $remaining_available_gifts[$randomKey];
|
||||
unset($remaining_available_gifts[$randomKey]);
|
||||
if ($selectedGift) {
|
||||
$gift = $giftInfoMap[$selectedGift['foreign_id']];
|
||||
$precomputedResults[] = [
|
||||
@@ -359,7 +358,6 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 再从新奖池中分配剩余所需礼物
|
||||
if ($newGiftsNeeded > 0 && !empty($availableGifts)) {
|
||||
$aliasTableForNew = $this->buildAliasTable($availableGifts);
|
||||
@@ -379,32 +377,32 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
if ($selectedGift) {
|
||||
$giftInfoMap = $this->preloadGiftInfo($availableGifts);
|
||||
$gift = $giftInfoMap[$selectedGift['foreign_id']];
|
||||
if($gift)
|
||||
$precomputedResults[] = [
|
||||
'gift_user_id' => $giftUserId,
|
||||
'gift_bag_detail' => $selectedGift,
|
||||
'gift' => $gift,
|
||||
'draw_times' => $totalDrawTimes,
|
||||
'periods' => $periods,
|
||||
];
|
||||
$precomputedResultss[] = [
|
||||
'gift_user_id' => $giftUserId,
|
||||
'gift_bag_detail' => $selectedGift,
|
||||
'gift' => $gift,
|
||||
'draw_times' => $totalDrawTimes,
|
||||
'periods' => $periods,
|
||||
];
|
||||
$totalDrawTimes++;
|
||||
$currentXlhPeriodsNum++;
|
||||
$addcurrentXlhPeriodsNum++;
|
||||
if($gift){
|
||||
$precomputedResults[] = [
|
||||
'gift_user_id' => $giftUserId,
|
||||
'gift_bag_detail' => $selectedGift,
|
||||
'gift' => $gift,
|
||||
'draw_times' => $totalDrawTimes,
|
||||
'periods' => $periods,
|
||||
];
|
||||
$precomputedResultss[] = [
|
||||
'gift_user_id' => $giftUserId,
|
||||
'gift_bag_detail' => $selectedGift,
|
||||
'gift' => $gift,
|
||||
'draw_times' => $totalDrawTimes,
|
||||
'periods' => $periods,
|
||||
];
|
||||
$totalDrawTimes++;
|
||||
$currentXlhPeriodsNum++;
|
||||
$addcurrentXlhPeriodsNum++;
|
||||
|
||||
// 更新Alias表
|
||||
$this->updateAliasTable($aliasTableForNew, $selectedGift['id']);
|
||||
// 更新Alias表
|
||||
$this->updateAliasTable($aliasTableForNew, $selectedGift['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ['precomputedResults' => $precomputedResults, 'precomputedResultss' => $precomputedResultss, 'addcurrentXlhPeriodsNum' => $addcurrentXlhPeriodsNum];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user