公会流水展示修改。
This commit is contained in:
@@ -82,7 +82,7 @@ class Guild extends adminApi
|
|||||||
}
|
}
|
||||||
$list[$k]['guild_logo'] = $v['cover'];
|
$list[$k]['guild_logo'] = $v['cover'];
|
||||||
//当日流水
|
//当日流水
|
||||||
$list[$k]['today_money'] = $v['income'];//model('Guild')->getTodayMoney($v['id'],$search_stime,$search_etime);
|
$list[$k]['today_money'] = model('Guild')->getTodayMoney($v['id'],$search_stime,$search_etime);//$v['income'];
|
||||||
$list[$k]['is_show'] = $v['is_show'];
|
$list[$k]['is_show'] = $v['is_show'];
|
||||||
$list[$k]['is_show_str'] = $v['is_show'] == 1 ? '显示' : '隐藏';
|
$list[$k]['is_show_str'] = $v['is_show'] == 1 ? '显示' : '隐藏';
|
||||||
$list[$k]['status'] = $v['status'];
|
$list[$k]['status'] = $v['status'];
|
||||||
@@ -499,15 +499,17 @@ class Guild extends adminApi
|
|||||||
->where(['a.guild_id'=>$guild_id])->where($where)->count();
|
->where(['a.guild_id'=>$guild_id])->where($where)->count();
|
||||||
$list = db::name($this->table_guild_user)->alias('a')
|
$list = db::name($this->table_guild_user)->alias('a')
|
||||||
->join('vs_room b', 'a.room_id = b.id', 'left')
|
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||||
->where(['a.guild_id'=>$guild_id])->where($where)
|
->where(['a.guild_id'=>$guild_id])
|
||||||
// ->page($page, $page_limit)
|
->where($where)
|
||||||
|
->order('a.coin desc')
|
||||||
|
->page($page, $page_limit)
|
||||||
->select();
|
->select();
|
||||||
if(!$list){
|
if(!$list){
|
||||||
return V(0,"暂无数据");
|
return V(0,"暂无数据");
|
||||||
}
|
}
|
||||||
$rum_lists = [];
|
$rum_lists = [];
|
||||||
//总流水
|
//总流水
|
||||||
$total_consumption = 0;
|
// $total_consumption = 0;
|
||||||
foreach ($list as $k=>$v){
|
foreach ($list as $k=>$v){
|
||||||
$search_stime = $search_stime_str;
|
$search_stime = $search_stime_str;
|
||||||
$search_etime = $search_etime_str;
|
$search_etime = $search_etime_str;
|
||||||
@@ -537,9 +539,9 @@ class Guild extends adminApi
|
|||||||
$rum_lists[$k]['room_name']=$room_info['room_name']?? '';
|
$rum_lists[$k]['room_name']=$room_info['room_name']?? '';
|
||||||
$rum_lists[$k]['room_cover']=$room_info['room_cover']?? '';
|
$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]['consumption']= $v['coin'];//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]['add_time'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||||
$total_consumption += $rum_lists[$k]['consumption'];
|
// $total_consumption += $rum_lists[$k]['consumption'];
|
||||||
//幸运币统计
|
//幸运币统计
|
||||||
$where_lucky = [];
|
$where_lucky = [];
|
||||||
if($search_stime !== ''){
|
if($search_stime !== ''){
|
||||||
@@ -553,11 +555,11 @@ class Guild extends adminApi
|
|||||||
}
|
}
|
||||||
$rum_lists[$k]['lucky_coin'] = db::name('vs_room_luck_value')->where('room_id',$room_id)->where($where_lucky)->sum('luck_value');
|
$rum_lists[$k]['lucky_coin'] = db::name('vs_room_luck_value')->where('room_id',$room_id)->where($where_lucky)->sum('luck_value');
|
||||||
}
|
}
|
||||||
usort($rum_lists, function($a, $b) {
|
// usort($rum_lists, function($a, $b) {
|
||||||
return $b['consumption'] - $a['consumption'];
|
// return $b['consumption'] - $a['consumption'];
|
||||||
});
|
// });
|
||||||
//分页
|
// //分页
|
||||||
$rum_lists = array_slice($rum_lists, ($page-1)*$page_limit, $page_limit);
|
// $rum_lists = array_slice($rum_lists, ($page-1)*$page_limit, $page_limit);
|
||||||
//幸运币统计
|
//幸运币统计
|
||||||
|
|
||||||
$where_lucky = [];
|
$where_lucky = [];
|
||||||
@@ -573,7 +575,7 @@ class Guild extends adminApi
|
|||||||
$return_data = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
'total_consumption' => $total_consumption,
|
'total_consumption' => model('Guild')->getGuildFlow($guild_id,0,strtotime($search_stime_str), strtotime($search_etime_str)),
|
||||||
'total_lucky_coin' => db::name('vs_room_luck_value')->whereIn('room_id',$room_ids)->where($where_lucky)->sum('luck_value'),
|
'total_lucky_coin' => db::name('vs_room_luck_value')->whereIn('room_id',$room_ids)->where($where_lucky)->sum('luck_value'),
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'lists' => $rum_lists
|
'lists' => $rum_lists
|
||||||
|
|||||||
@@ -94,31 +94,74 @@ class Guild extends Model
|
|||||||
*
|
*
|
||||||
*工会当日流水
|
*工会当日流水
|
||||||
*/
|
*/
|
||||||
|
// public function getTodayMoney($guild_id,$stoday="",$etoday=""){
|
||||||
|
// //获取所有工会房间ID
|
||||||
|
// $guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->where(['apply_time'=>['>',0],'status'=>1])->field('room_id,apply_time,quit_time')->select();
|
||||||
|
// $transaction = 0;
|
||||||
|
// foreach ($guild_user_data as $k => $v) {
|
||||||
|
// if(empty($stoday) && empty($etoday)){
|
||||||
|
// $stoday_seach = strtotime(date('Y-m-d 00:00:00',time()));
|
||||||
|
// $etoday_seach = strtotime(date('Y-m-d 23:59:59',time()));
|
||||||
|
// }else{
|
||||||
|
// $stoday_seach = strtotime($stoday);
|
||||||
|
// $etoday_seach = strtotime($etoday);
|
||||||
|
// }
|
||||||
|
// if($v['apply_time'] && $stoday_seach < $v['apply_time']){
|
||||||
|
// $stoday_seach = $v['apply_time'];
|
||||||
|
// }
|
||||||
|
// if($v['quit_time'] && ($etoday > $v['quit_time'])){
|
||||||
|
// $etoday_seach = $v['quit_time'];
|
||||||
|
// }
|
||||||
|
// $transaction_one = db::name('vs_give_gift')
|
||||||
|
// ->where('from_id',$v['room_id'])
|
||||||
|
// ->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$stoday_seach, $etoday_seach]]])
|
||||||
|
// ->sum('total_price');
|
||||||
|
// $transaction += $transaction_one;
|
||||||
|
// }
|
||||||
|
// return $transaction;
|
||||||
|
// }
|
||||||
|
|
||||||
public function getTodayMoney($guild_id,$stoday="",$etoday=""){
|
public function getTodayMoney($guild_id,$stoday="",$etoday=""){
|
||||||
//获取所有工会房间ID
|
$where = [];
|
||||||
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->where(['apply_time'=>['>',0],'status'=>1])->field('room_id,apply_time,quit_time')->select();
|
$where['guild_id'] = $guild_id;
|
||||||
$transaction = 0;
|
|
||||||
foreach ($guild_user_data as $k => $v) {
|
|
||||||
if(empty($stoday) && empty($etoday)){
|
if(empty($stoday) && empty($etoday)){
|
||||||
$stoday_seach = strtotime(date('Y-m-d 00:00:00',time()));
|
$where['day'] = date('Y-m-d');
|
||||||
$etoday_seach = strtotime(date('Y-m-d 23:59:59',time()));
|
|
||||||
}else{
|
}else{
|
||||||
$stoday_seach = strtotime($stoday);
|
if(!empty($stoday)){
|
||||||
$etoday_seach = strtotime($etoday);
|
$where['createtime'] = ['>=',strtotime($stoday)];
|
||||||
}
|
}
|
||||||
if($v['apply_time'] && $stoday_seach < $v['apply_time']){
|
if(!empty($etime)){
|
||||||
$stoday_seach = $v['apply_time'];
|
$where['createtime'] = ['<',strtotime($etoday)];
|
||||||
}
|
}
|
||||||
if($v['quit_time'] && ($etoday > $v['quit_time'])){
|
if(!empty($stime) && !empty($etime)){
|
||||||
$etoday_seach = $v['quit_time'];
|
$where['createtime'] = [['>=',strtotime($stoday)],['<',strtotime($etoday)]];
|
||||||
}
|
}
|
||||||
$transaction_one = db::name('vs_give_gift')
|
|
||||||
->where('from_id',$v['room_id'])
|
|
||||||
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$stoday_seach, $etoday_seach]]])
|
|
||||||
->sum('total_price');
|
|
||||||
$transaction += $transaction_one;
|
|
||||||
}
|
}
|
||||||
return $transaction;
|
$guild_flow = db::name('vs_guild_flow')
|
||||||
|
->where($where)
|
||||||
|
->sum('flow_price');
|
||||||
|
return $guild_flow;
|
||||||
|
}
|
||||||
|
//获取公会流水
|
||||||
|
public function getGuildFlow($guild_id=0,$room_id=0,$stoday="",$etoday=""){
|
||||||
|
$where = [];
|
||||||
|
if($guild_id!=0) {
|
||||||
|
$where['guild_id'] = $guild_id;
|
||||||
|
}
|
||||||
|
if($room_id!=0){
|
||||||
|
$where['room_id'] = $room_id;
|
||||||
|
}
|
||||||
|
if(!empty($stoday)){
|
||||||
|
$where['createtime'] = ['>=',strtotime($stoday)];
|
||||||
|
}
|
||||||
|
if(!empty($etime)){
|
||||||
|
$where['createtime'] = ['<',strtotime($etoday)];
|
||||||
|
}
|
||||||
|
if(!empty($stime) && !empty($etime)){
|
||||||
|
$where['createtime'] = [['>=',strtotime($stoday)],['<',strtotime($etoday)]];
|
||||||
|
}
|
||||||
|
$guild_flow = db::name('vs_guild_flow')->where($where)->sum('flow_price');
|
||||||
|
return $guild_flow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -130,11 +173,12 @@ class Guild extends Model
|
|||||||
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->where(['apply_time'=>['>',0],'status'=>1])->field('room_id,apply_time,createtime,quit_time')->select();
|
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->where(['apply_time'=>['>',0],'status'=>1])->field('room_id,apply_time,createtime,quit_time')->select();
|
||||||
$transaction = 0;
|
$transaction = 0;
|
||||||
foreach ($guild_user_data as $k => $v) {
|
foreach ($guild_user_data as $k => $v) {
|
||||||
if(empty($stoday) && empty($etoday)){
|
|
||||||
$stoday_seach = strtotime("2025-12-21 00:00:00");
|
$stoday_seach = strtotime("2025-12-21 00:00:00");
|
||||||
$etoday_seach = time();
|
$etoday_seach = time();
|
||||||
}else{
|
if(!empty($stoday)){
|
||||||
$stoday_seach = strtotime($stoday);
|
$stoday_seach = strtotime($stoday);
|
||||||
|
}
|
||||||
|
if(!empty($etoday)){
|
||||||
$etoday_seach = strtotime($etoday);
|
$etoday_seach = strtotime($etoday);
|
||||||
}
|
}
|
||||||
if($v['apply_time'] && $stoday_seach < $v['apply_time']){
|
if($v['apply_time'] && $stoday_seach < $v['apply_time']){
|
||||||
@@ -145,7 +189,8 @@ class Guild extends Model
|
|||||||
}
|
}
|
||||||
$transaction_one = db::name('vs_room_luck_value')
|
$transaction_one = db::name('vs_room_luck_value')
|
||||||
->where('room_id',$v['room_id'])
|
->where('room_id',$v['room_id'])
|
||||||
->where(['createtime' => ['between', [$stoday_seach, $etoday_seach]]])
|
->where(['createtime'=>['>=',$stoday_seach]])
|
||||||
|
->where(['createtime'=>['<',$etoday_seach]])
|
||||||
->sum('luck_value');
|
->sum('luck_value');
|
||||||
$transaction += $transaction_one;
|
$transaction += $transaction_one;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user