2025-11-14 17:56:32 +08:00
|
|
|
<?php
|
|
|
|
|
|
2025-11-17 16:42:14 +08:00
|
|
|
namespace app\guildadmin\controller;
|
2025-11-14 17:56:32 +08:00
|
|
|
|
|
|
|
|
use app\admin\command\Menu;
|
2025-11-17 16:42:14 +08:00
|
|
|
use app\guildadmin\model\AuthGroup;
|
|
|
|
|
use app\guildadmin\model\AuthGroupAccess;
|
|
|
|
|
use app\guildadmin\model\AuthRule;
|
|
|
|
|
use app\common\controller\guildadmin;
|
2025-11-14 17:56:32 +08:00
|
|
|
use fast\Random;
|
|
|
|
|
use fast\Tree;
|
|
|
|
|
use think\Cache;
|
|
|
|
|
use think\Db;
|
|
|
|
|
use think\Exception;
|
|
|
|
|
use think\Hook;
|
|
|
|
|
use think\Session;
|
|
|
|
|
use think\Validate;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 管理员管理
|
|
|
|
|
*
|
|
|
|
|
* @icon fa fa-users
|
|
|
|
|
* @remark 一个管理员可以有多个角色组,左侧的菜单根据管理员所拥有的权限进行生成
|
|
|
|
|
*/
|
2025-11-17 16:51:58 +08:00
|
|
|
class Room extends GuildAdmin
|
2025-11-14 17:56:32 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
protected $noNeedLogin = [];
|
|
|
|
|
protected $noNeedRight = [];
|
|
|
|
|
protected $layout = '';
|
|
|
|
|
protected $table_guild_subsidy_config = 'vs_guild_subsidy_config';
|
|
|
|
|
protected $table_guild_subsidy = 'vs_guild_subsidy';
|
|
|
|
|
protected $table_guild_user = 'vs_guild_user';
|
|
|
|
|
protected $table_guild_data = 'vs_guild_data';
|
|
|
|
|
protected $table_guild = 'vs_guild';
|
|
|
|
|
public function _initialize()
|
|
|
|
|
{
|
|
|
|
|
parent::_initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 房间列表
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
$guild_id = $this->guildId;
|
|
|
|
|
$page = input('page', 1);
|
|
|
|
|
$page_limit = input('page_limit', 30);
|
|
|
|
|
$room_id = input('room_id','');
|
|
|
|
|
$search_user_id = input('user_id','');
|
|
|
|
|
$status = input('status','');
|
|
|
|
|
$search_stime_str = input('search_stime','');
|
|
|
|
|
$search_etime_str = input('search_etime','');
|
|
|
|
|
$s_money_search = input('s_money_search','');
|
|
|
|
|
$e_money_search = input('e_money_search','');
|
|
|
|
|
|
|
|
|
|
$where['a.guild_id'] = $guild_id;
|
|
|
|
|
$where['a.status'] = 1;
|
|
|
|
|
$where['a.room_id'] = ['>',0];
|
|
|
|
|
if($room_id){
|
|
|
|
|
if(is_numeric($room_id)){
|
|
|
|
|
$where['b.room_number'] = $room_id;
|
|
|
|
|
}else{
|
|
|
|
|
$where['b.room_name'] = ['like', '%'.$room_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($status){
|
|
|
|
|
$where['room_status'] = $status;
|
|
|
|
|
}
|
|
|
|
|
$count = db::name($this->table_guild_user)->alias('a')
|
|
|
|
|
->join('vs_room b', 'a.room_id = b.id', 'left')->where($where)->count();
|
|
|
|
|
$lists = db::name($this->table_guild_user)->alias('a')
|
|
|
|
|
->join('vs_room b', 'a.room_id = b.id', 'left')
|
|
|
|
|
->field('a.*,b.room_name,b.room_number,b.room_cover,b.type_id,b.label_id,b.room_status')
|
|
|
|
|
->where($where)
|
|
|
|
|
->page($page, $page_limit)
|
|
|
|
|
->select();
|
|
|
|
|
$rum_lists = [];
|
|
|
|
|
//总流水
|
|
|
|
|
$total_consumption = 0;
|
|
|
|
|
foreach ($lists as $k=>$v){
|
|
|
|
|
$search_stime = $search_stime_str;
|
|
|
|
|
$search_etime = $search_etime_str;
|
|
|
|
|
if($search_stime!=""){
|
|
|
|
|
if($search_stime!="" && $v['createtime'] < strtotime($search_stime)){
|
|
|
|
|
$search_stime = $search_stime;
|
|
|
|
|
}else{
|
|
|
|
|
$search_stime = date('Y-m-d H:i:s',$v['createtime']) ;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$search_stime = $search_stime;
|
|
|
|
|
}
|
|
|
|
|
if($search_etime!=""){
|
|
|
|
|
if($v['quit_time']){
|
|
|
|
|
if($search_etime!="" && $v['quit_time'] > strtotime($search_etime)){
|
|
|
|
|
$search_etime = $search_etime;
|
|
|
|
|
}else{
|
|
|
|
|
$search_etime = date('Y-m-d H:i:s',$v['quit_time']);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$search_etime = $search_etime;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$search_etime = $search_etime;
|
|
|
|
|
}
|
|
|
|
|
$room_info = db::name('vs_room')->where(['id'=>$v['room_id']])->find();
|
|
|
|
|
$rum_lists[$k]['id']=$v['id'];
|
|
|
|
|
$rum_lists[$k]['room_id']=$v['room_id'];
|
|
|
|
|
$rum_lists[$k]['room_code']= $v['room_number'];
|
|
|
|
|
//靓号
|
|
|
|
|
$room_number = model('api/Decorate')->user_decorate_detail($v['room_id'], 7);
|
|
|
|
|
$rum_lists[$k]['room_number']= $room_number==$v['room_number'] ? '无' : $room_number;
|
|
|
|
|
//房主
|
|
|
|
|
$room_user = db::name('user')->where(['id'=>$v['user_id']])->find();
|
|
|
|
|
$rum_lists[$k]['room_user']= $room_user['user_code'] . '-' . $room_user['nickname'];
|
|
|
|
|
$rum_lists[$k]['room_name']=$room_info['room_name']?? '';
|
|
|
|
|
$rum_lists[$k]['room_cover']=$room_info['room_cover']?? '';
|
|
|
|
|
//房间分类
|
|
|
|
|
$rum_lists[$k]['room_type']= db::name('vs_room_type')->where('id', $v['type_id'])->value('type_name')??'';
|
|
|
|
|
//房间标签
|
|
|
|
|
$rum_lists[$k]['room_label']= db::name('vs_room_label')->where('id', $v['label_id'])->value('label_name')??'';
|
|
|
|
|
//房间粉丝
|
|
|
|
|
$stime = $search_stime_str=="" ? strtotime(date('Y-m-d',time())) : strtotime($search_stime_str);
|
|
|
|
|
$etime = time();
|
|
|
|
|
$rum_lists[$k]['follow_num'] = Db::name('user_follow')->where([
|
|
|
|
|
'follow_id'=>$v['room_id'],
|
|
|
|
|
'type'=>2,
|
|
|
|
|
'createtime'=>['<',$etime],
|
|
|
|
|
])->count();
|
|
|
|
|
$rum_lists[$k]['follow_num_new'] = Db::name('user_follow')->where([
|
|
|
|
|
'follow_id'=>$v['room_id'],
|
|
|
|
|
'type'=>2,
|
|
|
|
|
'createtime'=>['<',$etime],
|
|
|
|
|
])->where('createtime', '>', $stime)->count();
|
|
|
|
|
//房间状态
|
|
|
|
|
$rum_lists[$k]['room_status']= $v['room_status']==1 ? '正常' : '封禁';
|
|
|
|
|
//房间流水
|
|
|
|
|
$rum_lists[$k]['consumption']= model('adminapi/Room')->getRoomFlow($v['room_id'],$search_stime,$search_etime);
|
|
|
|
|
$rum_lists[$k]['add_time'] = date('Y-m-d H:i:s',$v['createtime']);
|
|
|
|
|
$total_consumption += $rum_lists[$k]['consumption'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
usort($rum_lists, function($a, $b) {
|
|
|
|
|
return $b['consumption'] - $a['consumption'];
|
|
|
|
|
});
|
|
|
|
|
//按流水查询
|
|
|
|
|
if($s_money_search!="" && $e_money_search!=""){
|
|
|
|
|
$rum_lists = array_filter($rum_lists, function($v) use ($s_money_search, $e_money_search) {
|
|
|
|
|
return $v['consumption'] >= $s_money_search && $v['consumption'] <= $e_money_search;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//分页
|
|
|
|
|
$rum_lists = array_slice($rum_lists, ($page-1)*$page_limit, $page_limit);
|
|
|
|
|
$return_data = [
|
|
|
|
|
'page' =>$page,
|
|
|
|
|
'page_limit' => $page_limit,
|
|
|
|
|
'total_consumption' => $total_consumption,
|
|
|
|
|
'count' => $count,
|
|
|
|
|
'lists' => $rum_lists
|
|
|
|
|
];
|
|
|
|
|
return V(1,"成功", $return_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|