定版之后bug修改

This commit is contained in:
2025-09-22 09:28:10 +08:00
parent 38cb41d57f
commit e53494c0f5
4 changed files with 25 additions and 7 deletions

View File

@@ -759,6 +759,7 @@ class BlindBoxTurntableGift extends Model
* 巡乐会 * 巡乐会
*/ */
public function xlh_gift_list($room_id){ public function xlh_gift_list($room_id){
$room_data = db::name('vs_room')->field('xlh_periods,xlh_periods_num')-> where('id',$room_id)->find();
$gift_bag_id = 13; $gift_bag_id = 13;
$xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find(); $xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find();
$xlh_ext = json_decode($xlh_box['ext'],true); $xlh_ext = json_decode($xlh_box['ext'],true);
@@ -780,11 +781,25 @@ class BlindBoxTurntableGift extends Model
//巡乐会主礼物 //巡乐会主礼物
$xlh_main_gift = db::name('vs_gift')->where('gid',$xlh_ext['locking_condition']['locking_gift_id'])->find(); $xlh_main_gift = db::name('vs_gift')->where('gid',$xlh_ext['locking_condition']['locking_gift_id'])->find();
//中奖用户 //中奖用户
$xlh_periods = db::name('vs_room')->where('id',$room_id)->value('xlh_periods'); $xlh_periods = $room_data['xlh_periods']??0;
$pan_xlh = db::name('vs_room_pan_xlh')->where(['room_id'=>$room_id,'periods'=>$xlh_periods])->find(); $pan_xlh = db::name('vs_room_pan_xlh')->where(['room_id'=>$room_id,'periods'=>$xlh_periods,'send_time'=>0])->find();
if(empty($pan_xlh)){ if(empty($pan_xlh)){
if($room_data['xlh_periods_num'] >= $xlh_ext['open_condition']['start_num']){
$pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
'room_id' => $room_id,
'gift_id' => $xlh_ext['locking_condition']['locking_gift_id'],
'homeowner_gift_id' => $xlh_ext['locking_condition']['give_homeowner_gift_id'],
'periods' => $xlh_periods+1,
'num' => 0,
'end_time' => time() + $xlh_ext['locking_time']['end_time'] * 60,
'createtime' => time()
]);
db::name("vs_room")->where('id',$room_id)->setInc('xlh_periods');//修改巡乐会期数
$pan_xlh = db::name('vs_room_pan_xlh')->where(['id'=>$pan_xlh_id])->find();
}else{
return ['code' => 0, 'msg' => '未开始', 'data' => null]; return ['code' => 0, 'msg' => '未开始', 'data' => null];
} }
}
$xlh_user_data= null; $xlh_user_data= null;
if($pan_xlh && $pan_xlh['user_id']){ if($pan_xlh && $pan_xlh['user_id']){
$xlh_user = db::name('user')->where('id',$pan_xlh['user_id'])->find(); $xlh_user = db::name('user')->where('id',$pan_xlh['user_id'])->find();

View File

@@ -183,7 +183,10 @@ class BlindBoxTurntableGiftDraw extends Model
// 2. 获取可用礼物 // 2. 获取可用礼物
$availableGifts = $this->getAvailableGifts($bag_data['id'], $room_id, $totalDrawTimes); $availableGifts = $this->getAvailableGifts($bag_data['id'], $room_id, $totalDrawTimes);
if (empty($availableGifts)) { if (empty($availableGifts)) {
return ['code' => 0, 'msg' => '当前盲盒无可用礼物', 'data' => null]; $availableGifts = $this->resetPoolAndReload($bag_data['id'], $room_id, $periods + 1, 0);
if (empty($availableGifts)) {
return ['code' => 0, 'msg' => '重置奖池后仍无可用礼物', 'data' => null];
}
} }
// 3. 预加载礼物信息(减少后续查询) // 3. 预加载礼物信息(减少后续查询)

View File

@@ -107,7 +107,7 @@ class UserGiftPack extends Model
->page($page, $page_limit) ->page($page, $page_limit)
->select(); ->select();
if (empty($log_model)) { if (empty($log_model)) {
return ['code' => 0, 'msg' => '', 'data' => null]; return ['code' => 0, 'msg' => ' ', 'data' => null];
} }
$list = []; $list = [];
foreach ($log_model as $k => $v){ foreach ($log_model as $k => $v){
@@ -134,7 +134,7 @@ class UserGiftPack extends Model
->page($page, $page_limit) ->page($page, $page_limit)
->select(); ->select();
if (empty($log_model)) { if (empty($log_model)) {
return ['code' => 0, 'msg' => '', 'data' => null]; return ['code' => 0, 'msg' => ' ', 'data' => null];
} }
$list = []; $list = [];
foreach ($log_model as $k => $v){ foreach ($log_model as $k => $v){

View File

@@ -114,7 +114,7 @@ class RoomPan
* 巡乐会结束 礼物发放 【定时脚本】 * 巡乐会结束 礼物发放 【定时脚本】
*/ */
public function xlh_gift_send(){ public function xlh_gift_send(){
$xlh_list = db::name('vs_room_pan_xlh')->where(['send_time'=>0,'end_time'=>['<',time()]])->select(); $xlh_list = db::name('vs_room_pan_xlh')->where(['send_time'=>0,'end_time'=>['<=',time()]])->select();
if(empty($xlh_list)){ if(empty($xlh_list)){
echo "没有需要发放的礼物 \n"; echo "没有需要发放的礼物 \n";
} }