定版之后bug修改
This commit is contained in:
@@ -759,6 +759,7 @@ class BlindBoxTurntableGift extends Model
|
||||
* 巡乐会
|
||||
*/
|
||||
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;
|
||||
$xlh_box = db::name('vs_gift_bag')->where('id',$gift_bag_id)->find();
|
||||
$xlh_ext = json_decode($xlh_box['ext'],true);
|
||||
@@ -780,10 +781,24 @@ class BlindBoxTurntableGift extends Model
|
||||
//巡乐会主礼物
|
||||
$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');
|
||||
$pan_xlh = db::name('vs_room_pan_xlh')->where(['room_id'=>$room_id,'periods'=>$xlh_periods])->find();
|
||||
$xlh_periods = $room_data['xlh_periods']??0;
|
||||
$pan_xlh = db::name('vs_room_pan_xlh')->where(['room_id'=>$room_id,'periods'=>$xlh_periods,'send_time'=>0])->find();
|
||||
if(empty($pan_xlh)){
|
||||
return ['code' => 0, 'msg' => '未开始', 'data' => null];
|
||||
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];
|
||||
}
|
||||
}
|
||||
$xlh_user_data= null;
|
||||
if($pan_xlh && $pan_xlh['user_id']){
|
||||
|
||||
@@ -183,7 +183,10 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
// 2. 获取可用礼物
|
||||
$availableGifts = $this->getAvailableGifts($bag_data['id'], $room_id, $totalDrawTimes);
|
||||
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. 预加载礼物信息(减少后续查询)
|
||||
|
||||
@@ -107,7 +107,7 @@ class UserGiftPack extends Model
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
if (empty($log_model)) {
|
||||
return ['code' => 0, 'msg' => '', 'data' => null];
|
||||
return ['code' => 0, 'msg' => ' ', 'data' => null];
|
||||
}
|
||||
$list = [];
|
||||
foreach ($log_model as $k => $v){
|
||||
@@ -134,7 +134,7 @@ class UserGiftPack extends Model
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
if (empty($log_model)) {
|
||||
return ['code' => 0, 'msg' => '', 'data' => null];
|
||||
return ['code' => 0, 'msg' => ' ', 'data' => null];
|
||||
}
|
||||
$list = [];
|
||||
foreach ($log_model as $k => $v){
|
||||
|
||||
@@ -114,7 +114,7 @@ class RoomPan
|
||||
* 巡乐会结束 礼物发放 【定时脚本】
|
||||
*/
|
||||
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)){
|
||||
echo "没有需要发放的礼物 \n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user