From c49abb572ff5f649fa62ec2743c3b395038ff3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=92=8A?= Date: Wed, 22 Oct 2025 14:32:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E4=B8=8Abug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/adminapi/controller/GiveGift.php | 25 ++++++++----- .../api/model/BlindBoxTurntableGift.php | 35 ++++++++++--------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/application/adminapi/controller/GiveGift.php b/application/adminapi/controller/GiveGift.php index 8a9abd2..7808a29 100644 --- a/application/adminapi/controller/GiveGift.php +++ b/application/adminapi/controller/GiveGift.php @@ -31,36 +31,46 @@ class GiveGift extends adminApi $end_time = input('end_time', ''); $where=[]; + $gwhere = []; if($send_user != ''){ $user_id = db::name('user')->where('user_code', $send_user)->value('id'); $where['user_id'] = $user_id; + $gwhere['gg.user_id'] = $user_id; } if($gift_user != ''){ $gift_user_id = db::name('user')->where('user_code', $gift_user)->value('id'); $where['gift_user'] = $gift_user_id; + $gwhere['gg.gift_user'] = $gift_user_id; } if($from_id != ''){ $room_id = db::name('vs_room')->where('room_number', $from_id)->value('id'); if($room_id){ $where['from_id'] = $room_id; + $gwhere['gg.from_id'] = $room_id; }else{ $where['from_id'] = $from_id; + $gwhere['gg.from_id'] = $from_id; } } if($gift_id != ''){ $where['gift_id'] = $gift_id; + $gwhere['gg.gift_id'] = $gift_id; } if($from != ''){ $where['from'] = $from; + $gwhere['gg.from'] = $from; } // 时间筛选优化 if (!empty($start_time) || !empty($end_time)) { if (!empty($start_time) && !empty($end_time)) { $where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]]; + $gwhere['gg.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]]; } elseif (!empty($start_time)) { $where['createtime'] = ['>=', strtotime($start_time)]; + $gwhere['gg.createtime'] = ['>=', strtotime($start_time)]; } elseif (!empty($end_time)) { $where['createtime'] = ['<=', strtotime($end_time)]; + $gwhere['gg.createtime'] = ['<=', strtotime($end_time)]; } } //礼物总数 @@ -79,15 +89,12 @@ class GiveGift extends adminApi $count = db::name('vs_give_gift')->where($where)->count(); $earning_list = []; if(!empty($where)){ - $gift_ids = db::name('vs_give_gift')->where($where)->column('id'); - if (!empty($gift_ids)) { - // 批量获取所有收益记录 - $earning_list = db::name('vs_give_gift_ratio_log') - ->field('app_earning,gift_user_earning,room_owner_earning') - ->where('give_gift_id', 'in', $gift_ids) - ->order('id', 'desc') - ->select(); - } + $earning_list = db::name('vs_give_gift_ratio_log') + ->alias('egl') + ->join('vs_give_gift gg', 'egl.give_gift_id = gg.id') + ->where($gwhere) // 替换为实际的筛选条件 + ->field('egl.app_earning,egl.gift_user_earning,egl.room_owner_earning') + ->select(); }else{ // 批量获取所有收益记录 $earning_list = db::name('vs_give_gift_ratio_log') diff --git a/application/api/model/BlindBoxTurntableGift.php b/application/api/model/BlindBoxTurntableGift.php index b4a0093..284572f 100644 --- a/application/api/model/BlindBoxTurntableGift.php +++ b/application/api/model/BlindBoxTurntableGift.php @@ -236,23 +236,26 @@ class BlindBoxTurntableGift extends Model $pan_xlh = db::name('vs_room_pan_xlh')->where(['send_time'=>0,'end_time'=>['>',time()]])->order('id desc')->find(); $xlh_periods_num = Cache::get("xlh_periods_num") ?? 0; if(empty($pan_xlh)){ - if($xlh_periods_num >= $xlh_ext['open_condition']['start_num']){ - $xlh_periods = Cache::get("this_xlh_periods") ?? 0; - $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() - ]); - Cache::set("this_xlh_periods", $xlh_periods+1, 0);//修改巡乐会期数 - $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]; } +// if(empty($pan_xlh)){ +// if($xlh_periods_num >= $xlh_ext['open_condition']['start_num']){ +// $xlh_periods = Cache::get("this_xlh_periods") ?? 0; +// $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() +// ]); +// Cache::set("this_xlh_periods", $xlh_periods+1, 0);//修改巡乐会期数 +// $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; $room_user_data = null; if($pan_xlh && $pan_xlh['user_id']){