线上bug修改

This commit is contained in:
2025-10-22 14:32:56 +08:00
parent 24bb57f516
commit c49abb572f
2 changed files with 35 additions and 25 deletions

View File

@@ -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')
->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')

View File

@@ -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];
}
}
// 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']){