盲盒转盘优化
This commit is contained in:
@@ -36,8 +36,8 @@ class RoomEmoji extends adminApi
|
||||
function emoji_list(){
|
||||
$id = input('id', '', 'intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$page = input('page', 1, 'intval');
|
||||
$limit = input('limit', 10, 'intval');
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$where = [];
|
||||
if ($id) {
|
||||
$where['id'] = $id;
|
||||
@@ -52,7 +52,7 @@ class RoomEmoji extends adminApi
|
||||
->where($where)
|
||||
->where(['deletetime' => 0])
|
||||
->order('sort desc,id desc')
|
||||
->page($page, $limit)
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
foreach ($list as &$item) {
|
||||
$item['type_str'] = Db::name($this->table_type)->where('id', $item['type_id'])->value('type_name');
|
||||
@@ -60,9 +60,9 @@ class RoomEmoji extends adminApi
|
||||
$item['status_str'] = $item['status'] == 1 ? '显示' : '隐藏';
|
||||
}
|
||||
$return_data = [
|
||||
'page' => $page,
|
||||
'limit' => $limit,
|
||||
'total' => $total,
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $total,
|
||||
'list' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
|
||||
@@ -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