2025-11-18 10:07:09 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\guildAdmin\controller;
|
|
|
|
|
|
|
|
|
|
use app\admin\command\Menu;
|
|
|
|
|
use app\GuildAdmin\model\AuthGroup;
|
|
|
|
|
use app\GuildAdmin\model\AuthGroupAccess;
|
|
|
|
|
use app\GuildAdmin\model\AuthRule;
|
|
|
|
|
use app\common\controller\GuildAdmin;
|
|
|
|
|
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 一个管理员可以有多个角色组,左侧的菜单根据管理员所拥有的权限进行生成
|
|
|
|
|
*/
|
|
|
|
|
class Statistical extends GuildAdmin
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 16:02:20 +08:00
|
|
|
//用户数据统计
|
2025-11-18 10:07:09 +08:00
|
|
|
public function user_lists(){
|
|
|
|
|
$guild_id = $this->guildId;
|
|
|
|
|
$page = input('page', 1);
|
|
|
|
|
$page_limit = input('page_limit', 30);
|
|
|
|
|
$search_user_id = input('user_id', '');
|
|
|
|
|
$stime = input('stime', '');
|
|
|
|
|
$etime = input('etime', '');
|
|
|
|
|
$where = [];
|
2025-11-24 17:32:09 +08:00
|
|
|
if($this->auth->id != 1) {
|
|
|
|
|
$where['a.guild_id'] = $guild_id;
|
|
|
|
|
}
|
2025-11-18 10:07:09 +08:00
|
|
|
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 = [];
|
2025-11-24 17:32:09 +08:00
|
|
|
if($this->auth->id != 1) {
|
|
|
|
|
$where['a.guild_id'] = $guild_id;
|
|
|
|
|
}
|
2025-11-18 10:07:09 +08:00
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|