房间补贴修改。

This commit is contained in:
2026-01-19 19:43:59 +08:00
parent 684771b746
commit 07672be58b
3 changed files with 157 additions and 24 deletions

View File

@@ -3,6 +3,7 @@
namespace app\adminapi\controller;
use app\common\controller\adminApi;
use app\common\library\GiftTableManager;
use think\Controller;
use think\Db;
use think\Session;
@@ -479,8 +480,16 @@ class Guild extends adminApi
$page = input('page', 1);
$page_limit = input('page_limit', 30);
$guild_id = input('guild_id', 0);
$search_stime_str = input('search_stime','');
$search_etime_str = input('search_etime','');
$firstDay = date('Y-m-01');
$lastDay = date('Y-m-t 23:59:59');
$search_stime_str = input('search_stime',$firstDay);
$search_etime_str = input('search_etime',$lastDay);
if(empty($search_stime_str)){
$search_stime_str = $firstDay;
}
if(empty($search_etime_str)){
$search_etime_str = $lastDay;
}
$room_id = input('room_id', 0);
$where=['a.status'=>1];
$where=['a.room_id'=>['>',0]];
@@ -498,6 +507,7 @@ class Guild extends adminApi
->join('vs_room b', 'a.room_id = b.id', 'left')
->where(['a.guild_id'=>$guild_id])->where($where)->count();
$list = db::name($this->table_guild_user)->alias('a')
->field('a.*,b.room_name,b.room_number')
->join('vs_room b', 'a.room_id = b.id', 'left')
->where(['a.guild_id'=>$guild_id])->where($where)
// ->page($page, $page_limit)
@@ -507,6 +517,49 @@ class Guild extends adminApi
}
$rum_lists = [];
//总流水
$tables = GiftTableManager::getTablesByTimeRange(
strtotime($search_stime_str),
strtotime($search_etime_str)
);
$room_consumption =[];
if($tables){
foreach ($list as $vs) {
$search_stime = $search_stime_str;
$search_etime = $search_etime_str;
if($search_stime!=""){
if($vs['apply_time'] && strtotime($search_stime) < $vs['apply_time']) {
$search_stime = date('Y-m-d H:i:s',$vs['apply_time']);
}
}else{
$search_stime = date('Y-m-d H:i:s',$vs['apply_time']);
}
if($search_etime!=""){
if($vs['quit_time'] && (strtotime($search_etime) > $vs['quit_time'])){
$search_etime = date('Y-m-d H:i:s',$vs['quit_time']);
}
}else{
if($vs['quit_time']){
$search_etime = date('Y-m-d H:i:s',$vs['quit_time']);
}else{
$search_etime = date('Y-m-d H:i:s',time());
}
}
$all_total_price =0;
$total_price = 0;
foreach ($tables as $table_name) {
//表前缀
$table_prefix = config('database.prefix');
$table_name = str_replace($table_prefix, '', $table_name);
$total_price = db::name($table_name)
->where(['from_id' => $vs['room_id'], 'from' => 2])
->where(['createtime' => ['between',[strtotime($search_stime),strtotime($search_etime)]]])
->sum('total_price');
$all_total_price += $total_price;
$room_consumption[$vs['id']] = $all_total_price;
}
}
}
$total_consumption = 0;
foreach ($list as $k=>$v){
$search_stime = $search_stime_str;
@@ -539,8 +592,9 @@ class Guild extends adminApi
$rum_lists[$k]['room_name']=$room_info['room_name']?? '';
$rum_lists[$k]['room_cover']=$room_info['room_cover']?? '';
//房间流水
$rum_lists[$k]['consumption']= model('Room')->getRoomFlow($v['room_id'],$search_stime,$search_etime);
$rum_lists[$k]['add_time'] = date('Y-m-d H:i:s',$v['createtime']);
// $rum_lists[$k]['consumption']= model('Room')->getRoomFlow($v['room_id'],$search_stime,$search_etime);
$rum_lists[$k]['consumption']= $room_consumption[$v['id']]??0;
$rum_lists[$k]['add_time'] = date('Y-m-d H:i:s',$v['apply_time']);
$total_consumption += $rum_lists[$k]['consumption'];
//幸运币统计
$where_lucky = [];