guildId; $page = input('page', 1); $page_limit = input('page_limit', 30); $search_user_id = input('user_id', ''); $stime = input('stime', ''); $etime = input('etime', ''); $where = []; if($this->auth->id != 1) { $where['a.guild_id'] = $guild_id; } if ($search_user_id) { $user_id = db::name('user')->where('user_code', $search_user_id)->value('id'); $where['a.user_id'] = $user_id; } if ($stime) { $where['a.create_time'] = ['>=', $stime]; } if ($etime) { $where['a.create_time'] = ['<=', $etime]; } $count = Db::name($this->table_guild_user)->alias('a') ->join('user b', 'a.user_id = b.id') ->where($where) ->where('a.status', 1)->count(); $lists = Db::name($this->table_guild_user)->alias('a') ->join('user b', 'a.user_id = b.id') ->field('a.id,a.user_id,a.status,a.createtime,a.apply_time,b.user_code,b.nickname') ->where($where) ->where('a.status', 1) ->order('a.id desc') ->page($page, $page_limit) ->select(); $lists_data = []; foreach ($lists as $key => $value) { $lists_data[$key] = $value; $lists_data[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']); } $return_data = [ 'page' =>$page, 'page_limit' => $page_limit, 'count' => $count, 'lists' => $lists_data ]; return V(1,"成功", $return_data); } //房间数据统计 public function room_lists(){ $guild_id = $this->guildId; $page = input('page', 1); $page_limit = input('page_limit', 30); $search_room_id = input('room_id', ''); $stime = input('stime', ''); $etime = input('etime', ''); $where = []; if($this->auth->id != 1) { $where['a.guild_id'] = $guild_id; } if ($search_room_id) { $where['b.room_number'] = $search_room_id; } $search_stime = ''; $search_etime = ''; if ($stime) { $where['a.create_time'] = ['>=', $stime]; $search_stime = strtotime($stime); } if ($etime) { $where['a.create_time'] = ['<=', $etime]; $search_etime = strtotime($etime); } $count = Db::name($this->table_guild_user)->alias('a') ->join('vs_room b', 'a.room_id = b.id') ->where($where) ->where('a.status', 1)->count(); $lists = Db::name($this->table_guild_user)->alias('a') ->join('vs_room b', 'a.room_id = b.id') ->field('a.id,a.room_id,a.status,a.createtime,a.apply_time,b.room_number,b.room_name') ->where($where) ->where('a.status', 1) ->order('a.id desc') ->page($page, $page_limit) ->select(); $lists_data = []; foreach ($lists as $key => $value) { $lists_data[$key]['room_number'] = $value['room_number']; $lists_data[$key]['room_name'] = $value['room_name']; //送礼流水 $lists_data[$key]['consumption']= model('adminapi/Room')->getRoomFlow($value['room_id'],$search_stime,$search_etime); //绩效流水 //送礼人数 $lists_data[$key]['gift_num'] = db::name('vs_give_gift')->where(['from_id'=>$value['room_id'],'from'=>2])->count(); $lists_data[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']); } $return_data = [ 'page' =>$page, 'page_limit' => $page_limit, 'count' => $count, 'lists' => $lists_data ]; return V(1,"成功", $return_data); } }