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/adminapi/controller/RoomEmoji.php b/application/adminapi/controller/RoomEmoji.php index 5d54dc6..b4eaf73 100644 --- a/application/adminapi/controller/RoomEmoji.php +++ b/application/adminapi/controller/RoomEmoji.php @@ -169,4 +169,59 @@ class RoomEmoji extends adminApi return V(1,"成功", $emoji_type); } + //表情类型添加 + function add_emoji_type(){ + $type_name = input('type_name', '', 'trim'); + if (!$type_name) { + return V(0, '请输入表情类型名称'); + } + $data = [ + 'type_name' => $type_name, + 'sort' => 0, + 'status' => 1, + 'createtime' => time(), + ]; + $res = Db::name($this->table_type)->insert($data); + if ($res) { + return V(1, '添加成功'); + } + } + //表情类型修改 + function edit_emoji_type(){ + $id = input('id', 0, 'intval'); + $type_name = input('type_name', '', 'trim'); + $sort = input('sort', 0, 'intval'); + $status = input('status', 1, 'intval'); + if (!$id) { + return V(0, '请选择要修改的表情类型'); + } + if($type_name){ + $data['type_name'] = $type_name; + } + if($sort){ + $data['sort'] = $sort; + } + if($status){ + $data['status'] = $status; + } + $res = Db::name($this->table_type)->where('id',$id)->update($data); + if ($res) { + return V(1, '修改成功'); + } + return V(0, '修改失败'); + } + //表情类型删除 + function del_emoji_type(){ + $id = input('id', 0, 'intval'); + if (!$id) { + return V(0, '请选择要删除的表情类型'); + } + $res = Db::name($this->table_type)->where('id',$id)->update( + ['deletetime' => time()] + ); + if ($res) { + return V(1, '删除成功'); + } + return V(0, '删除失败'); + } } \ No newline at end of file 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']){ diff --git a/application/api/model/Guild.php b/application/api/model/Guild.php index 6eab916..aca8615 100644 --- a/application/api/model/Guild.php +++ b/application/api/model/Guild.php @@ -28,8 +28,8 @@ class Guild extends Model ->field('id,guild_special_id,user_id,guild_name,cover,num,intro,createtime,income') ->where(['is_show'=>1,'delete_time'=>0]) ->where($where) - ->order('num desc') ->page($page, $page_limit) + ->order('num desc') ->select(); $count = Db::name('vs_guild') ->where(['is_show'=>1,'delete_time'=>0]) @@ -758,7 +758,7 @@ class Guild extends Model * 工会流水查询 * @return array */ - public function get_guild_transaction($guild_id,$start_time=0,$end_time=0,$page=1,$page_limit=20){ + public function get_guild_transaction($guild_id,$seach_start_time,$seach_end_time,$page,$page_limit){ $guild_info = db::name('vs_guild')->where(['id'=>$guild_id,'delete_time'=>0])->find(); if(empty($guild_info)){ return ['code' => 0, 'msg' => '公会不存在!', 'data' => null]; @@ -767,6 +767,8 @@ class Guild extends Model $all_guild_room = db::name('vs_guild_user')->where(['guild_id' => $guild_id,'status'=>1,"delete_time"=>0])->select(); $total_transaction = 0; foreach ($all_guild_room as $key => $value) { + $start_time = $seach_start_time; + $end_time = $seach_end_time; if(!$start_time){ $start_time_all = $value['createtime']; $end_time_all = time(); @@ -788,7 +790,7 @@ class Guild extends Model } //查询工会所有房间流水 $list = db::name('vs_guild_user')->where(['guild_id'=>$guild_id,'delete_time'=>0,'status'=>1,'room_id'=>['<>',0]]) - ->order('coin desc') + ->order('id asc') ->page($page, $page_limit) ->select(); @@ -796,6 +798,8 @@ class Guild extends Model $room_data = []; $i=0; foreach ($list as $k=>$v){ + $start_time = $seach_start_time; + $end_time = $seach_end_time; if(!$start_time){ $start_time_seach = $value['createtime']; $end_time_seach = time();