盲盒转盘优化
This commit is contained in:
@@ -36,8 +36,8 @@ class RoomEmoji extends adminApi
|
|||||||
function emoji_list(){
|
function emoji_list(){
|
||||||
$id = input('id', '', 'intval');
|
$id = input('id', '', 'intval');
|
||||||
$name = input('name', '', 'trim');
|
$name = input('name', '', 'trim');
|
||||||
$page = input('page', 1, 'intval');
|
$page = input('page', 1);
|
||||||
$limit = input('limit', 10, 'intval');
|
$page_limit = input('page_limit', 30);
|
||||||
$where = [];
|
$where = [];
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$where['id'] = $id;
|
$where['id'] = $id;
|
||||||
@@ -52,7 +52,7 @@ class RoomEmoji extends adminApi
|
|||||||
->where($where)
|
->where($where)
|
||||||
->where(['deletetime' => 0])
|
->where(['deletetime' => 0])
|
||||||
->order('sort desc,id desc')
|
->order('sort desc,id desc')
|
||||||
->page($page, $limit)
|
->page($page, $page_limit)
|
||||||
->select();
|
->select();
|
||||||
foreach ($list as &$item) {
|
foreach ($list as &$item) {
|
||||||
$item['type_str'] = Db::name($this->table_type)->where('id', $item['type_id'])->value('type_name');
|
$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 ? '显示' : '隐藏';
|
$item['status_str'] = $item['status'] == 1 ? '显示' : '隐藏';
|
||||||
}
|
}
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'page' => $page,
|
'page' =>$page,
|
||||||
'limit' => $limit,
|
'page_limit' => $page_limit,
|
||||||
'total' => $total,
|
'count' => $total,
|
||||||
'list' => $list
|
'list' => $list
|
||||||
];
|
];
|
||||||
return V(1,"成功", $return_data);
|
return V(1,"成功", $return_data);
|
||||||
|
|||||||
@@ -338,7 +338,6 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
if(!empty($remaining_available_gifts)){
|
if(!empty($remaining_available_gifts)){
|
||||||
$randomKey = array_rand($remaining_available_gifts);
|
$randomKey = array_rand($remaining_available_gifts);
|
||||||
$selectedGift = $remaining_available_gifts[$randomKey];
|
$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[] = [
|
||||||
@@ -359,7 +358,6 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 再从新奖池中分配剩余所需礼物
|
// 再从新奖池中分配剩余所需礼物
|
||||||
if ($newGiftsNeeded > 0 && !empty($availableGifts)) {
|
if ($newGiftsNeeded > 0 && !empty($availableGifts)) {
|
||||||
$aliasTableForNew = $this->buildAliasTable($availableGifts);
|
$aliasTableForNew = $this->buildAliasTable($availableGifts);
|
||||||
@@ -379,32 +377,32 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
|||||||
if ($selectedGift) {
|
if ($selectedGift) {
|
||||||
$giftInfoMap = $this->preloadGiftInfo($availableGifts);
|
$giftInfoMap = $this->preloadGiftInfo($availableGifts);
|
||||||
$gift = $giftInfoMap[$selectedGift['foreign_id']];
|
$gift = $giftInfoMap[$selectedGift['foreign_id']];
|
||||||
if($gift)
|
if($gift){
|
||||||
$precomputedResults[] = [
|
$precomputedResults[] = [
|
||||||
'gift_user_id' => $giftUserId,
|
'gift_user_id' => $giftUserId,
|
||||||
'gift_bag_detail' => $selectedGift,
|
'gift_bag_detail' => $selectedGift,
|
||||||
'gift' => $gift,
|
'gift' => $gift,
|
||||||
'draw_times' => $totalDrawTimes,
|
'draw_times' => $totalDrawTimes,
|
||||||
'periods' => $periods,
|
'periods' => $periods,
|
||||||
];
|
];
|
||||||
$precomputedResultss[] = [
|
$precomputedResultss[] = [
|
||||||
'gift_user_id' => $giftUserId,
|
'gift_user_id' => $giftUserId,
|
||||||
'gift_bag_detail' => $selectedGift,
|
'gift_bag_detail' => $selectedGift,
|
||||||
'gift' => $gift,
|
'gift' => $gift,
|
||||||
'draw_times' => $totalDrawTimes,
|
'draw_times' => $totalDrawTimes,
|
||||||
'periods' => $periods,
|
'periods' => $periods,
|
||||||
];
|
];
|
||||||
$totalDrawTimes++;
|
$totalDrawTimes++;
|
||||||
$currentXlhPeriodsNum++;
|
$currentXlhPeriodsNum++;
|
||||||
$addcurrentXlhPeriodsNum++;
|
$addcurrentXlhPeriodsNum++;
|
||||||
|
|
||||||
// 更新Alias表
|
// 更新Alias表
|
||||||
$this->updateAliasTable($aliasTableForNew, $selectedGift['id']);
|
$this->updateAliasTable($aliasTableForNew, $selectedGift['id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['precomputedResults' => $precomputedResults, 'precomputedResultss' => $precomputedResultss, 'addcurrentXlhPeriodsNum' => $addcurrentXlhPeriodsNum];
|
return ['precomputedResults' => $precomputedResults, 'precomputedResultss' => $precomputedResultss, 'addcurrentXlhPeriodsNum' => $addcurrentXlhPeriodsNum];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user