房间补贴修改。

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

@@ -2,6 +2,7 @@
namespace app\adminapi\model;
use app\common\library\GiftTableManager;
use think\Model;
use think\Session;
use think\Db;
@@ -70,11 +71,30 @@ class Room extends Model
/*
* 查询房间流水
*/
// public function getRoomFlow($room_id,$stime='',$etime=''){
// $give_where = [];
// $give_where['room_id'] = $room_id;
//// $give_where['from'] = ["in",[2,3,6]];
//// $give_where['from'] = 2;
// if(!empty($stime)){
// $give_where['createtime'] = ['>=',strtotime($stime)];
// }
// if(!empty($etime)){
// $give_where['createtime'] = ['<',strtotime($etime)];
// }
// if(!empty($stime) && !empty($etime)){
//// $give_where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
// $give_where['createtime'] = [['>=',strtotime($stime)],['<',strtotime($etime)]];
// }
// $total_price = db::name('vs_guild_flow')->where($give_where)
// ->sum('flow_price');
// return $total_price;
// }
public function getRoomFlow($room_id,$stime='',$etime=''){
$give_where = [];
$give_where['room_id'] = $room_id;
$give_where['from'] = $room_id;
// $give_where['from'] = ["in",[2,3,6]];
// $give_where['from'] = 2;
$give_where['from'] = 2;
if(!empty($stime)){
$give_where['createtime'] = ['>=',strtotime($stime)];
}
@@ -85,8 +105,23 @@ class Room extends Model
// $give_where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
$give_where['createtime'] = [['>=',strtotime($stime)],['<',strtotime($etime)]];
}
$total_price = db::name('vs_guild_flow')->where($give_where)
->sum('flow_price');
$tables = GiftTableManager::getTablesByTimeRange(
strtotime($stime),
strtotime($etime)
);
$all_total_price =0;
if($tables){
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($give_where)
->sum('total_price');
$all_total_price += $total_price;
}
}
$total_price = $all_total_price;
return $total_price;
}