盲盒转盘优化调整
This commit is contained in:
@@ -335,7 +335,10 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < $userRemainingAllocation; $i++) {
|
for ($i = 0; $i < $userRemainingAllocation; $i++) {
|
||||||
$selectedGift = $this->selectGiftWithAliasMethod($aliasTableForRemaining);
|
if(!empty($remaining_available_gifts)){
|
||||||
|
$randomKey = array_rand($remaining_available_gifts);
|
||||||
|
$selectedGift = $remaining_available_gifts[$randomKey];
|
||||||
|
unset($remaining_available_gifts[$randomKey]);
|
||||||
if ($selectedGift) {
|
if ($selectedGift) {
|
||||||
$gift = $giftInfoMap[$selectedGift['foreign_id']];
|
$gift = $giftInfoMap[$selectedGift['foreign_id']];
|
||||||
$precomputedResults[] = [
|
$precomputedResults[] = [
|
||||||
@@ -345,13 +348,6 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
'draw_times' => $totalDrawTimes,
|
'draw_times' => $totalDrawTimes,
|
||||||
'periods' => $periods,
|
'periods' => $periods,
|
||||||
];
|
];
|
||||||
$precomputedResultss[] = [
|
|
||||||
'gift_user_id' => $giftUserId,
|
|
||||||
'gift_bag_detail' => $selectedGift,
|
|
||||||
'gift' => $gift,
|
|
||||||
'draw_times' => $totalDrawTimes,
|
|
||||||
'periods' => $periods,
|
|
||||||
];
|
|
||||||
$totalDrawTimes++;
|
$totalDrawTimes++;
|
||||||
$currentXlhPeriodsNum++;
|
$currentXlhPeriodsNum++;
|
||||||
$addcurrentXlhPeriodsNum++;
|
$addcurrentXlhPeriodsNum++;
|
||||||
@@ -362,6 +358,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 再从新奖池中分配剩余所需礼物
|
// 再从新奖池中分配剩余所需礼物
|
||||||
if ($newGiftsNeeded > 0 && !empty($availableGifts)) {
|
if ($newGiftsNeeded > 0 && !empty($availableGifts)) {
|
||||||
@@ -822,6 +819,11 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
'from_type' => 102
|
'from_type' => 102
|
||||||
];
|
];
|
||||||
$push->xunlehui($text_list_new);
|
$push->xunlehui($text_list_new);
|
||||||
|
$pan_xlh = db::name('vs_room_pan_xlh')
|
||||||
|
->where(['send_time' => 0])
|
||||||
|
->order('id', 'desc')
|
||||||
|
->find();
|
||||||
|
if (empty($pan_xlh)) {
|
||||||
// 巡乐会正式开始
|
// 巡乐会正式开始
|
||||||
$this_xlh_periods = $this->getCachedXlhPeriods('get');
|
$this_xlh_periods = $this->getCachedXlhPeriods('get');
|
||||||
$pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
|
$pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
|
||||||
@@ -839,6 +841,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
$this->getCachedXlhPeriods('set', $this_xlh_periods + 1);//修改巡乐会期数
|
$this->getCachedXlhPeriods('set', $this_xlh_periods + 1);//修改巡乐会期数
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private function updateAndPushXlhStatus($room_id, $xlh_ext, $currentXlhPeriodsNum){
|
private function updateAndPushXlhStatus($room_id, $xlh_ext, $currentXlhPeriodsNum){
|
||||||
$xlh['waiting_start_num'] = $xlh_ext['open_condition']['waiting_start_num'];//等待开奖次数
|
$xlh['waiting_start_num'] = $xlh_ext['open_condition']['waiting_start_num'];//等待开奖次数
|
||||||
$xlh['start_num'] = $xlh_ext['open_condition']['start_num'];//开始开奖次数
|
$xlh['start_num'] = $xlh_ext['open_condition']['start_num'];//开始开奖次数
|
||||||
@@ -1045,17 +1048,17 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
db::name("vs_gift_bag")->where('id',$gift_bag_id)->setInc('periods'); //更新期数
|
db::name("vs_gift_bag")->where('id',$gift_bag_id)->setInc('periods'); //更新期数
|
||||||
db::name("vs_gift_bag_detail")->where('gift_bag_id',$gift_bag_id)->update(['remaining_number'=>db::raw('quantity')]);//重置奖池
|
db::name("vs_gift_bag_detail")->where('gift_bag_id',$gift_bag_id)->update(['remaining_number'=>db::raw('quantity')]);//重置奖池
|
||||||
//防止并发,上把如果件数小于0,则加上
|
//防止并发,上把如果件数小于0,则加上
|
||||||
foreach ($bag_detail as $pan) {
|
// foreach ($bag_detail as $pan) {
|
||||||
if($pan['remaining_number']<0){
|
// if($pan['remaining_number']<0){
|
||||||
db::name("vs_gift_bag_detail")->where('id', $pan['id'])->setInc('remaining_number', $pan['remaining_number']);
|
// db::name("vs_gift_bag_detail")->where('id', $pan['id'])->setInc('remaining_number', $pan['remaining_number']);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//补充上把礼物有剩余
|
//补充上把礼物有剩余
|
||||||
if(!empty($remaining_available_gifts)){
|
// if(!empty($remaining_available_gifts)){
|
||||||
foreach ($remaining_available_gifts as $gift) {
|
// foreach ($remaining_available_gifts as $gift) {
|
||||||
db::name("vs_gift_bag_detail")->where('id', $gift['id'])->setInc('remaining_number',$gift['remaining_number']);
|
// db::name("vs_gift_bag_detail")->where('id', $gift['id'])->setInc('remaining_number',$gift['remaining_number']);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user