加幸运币统计字段
This commit is contained in:
@@ -91,6 +91,8 @@ class Guild extends adminApi
|
|||||||
$list[$k]['updatetime'] = date('Y-m-d H:i:s',$v['updatetime']);
|
$list[$k]['updatetime'] = date('Y-m-d H:i:s',$v['updatetime']);
|
||||||
$list[$k]['user_id'] = $user['user_code']??"";
|
$list[$k]['user_id'] = $user['user_code']??"";
|
||||||
$list[$k]['intro'] = $v['intro'];
|
$list[$k]['intro'] = $v['intro'];
|
||||||
|
//幸运币流水
|
||||||
|
$list[$k]['lucky_coin'] = model('Guild')->getTodayMoneyLuckyCoin($v['id'],$search_stime,$search_etime);
|
||||||
}
|
}
|
||||||
// 数组按today_money 排序
|
// 数组按today_money 排序
|
||||||
usort($list, function($a, $b) {
|
usort($list, function($a, $b) {
|
||||||
@@ -507,10 +509,10 @@ class Guild extends adminApi
|
|||||||
$search_stime = $search_stime_str;
|
$search_stime = $search_stime_str;
|
||||||
$search_etime = $search_etime_str;
|
$search_etime = $search_etime_str;
|
||||||
if($search_stime!=""){
|
if($search_stime!=""){
|
||||||
if($search_stime!="" && $v['createtime'] < strtotime($search_stime)){
|
if($search_stime!="" && $v['apply_time'] < strtotime($search_stime)){
|
||||||
$search_stime = $search_stime;
|
$search_stime = $search_stime;
|
||||||
}else{
|
}else{
|
||||||
$search_stime = date('Y-m-d H:i:s',$v['createtime']) ;
|
$search_stime = date('Y-m-d H:i:s',$v['apply_time']) ;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$search_stime = $search_stime;
|
$search_stime = $search_stime;
|
||||||
@@ -539,17 +541,40 @@ class Guild extends adminApi
|
|||||||
$rum_lists[$k]['consumption']= model('Room')->getRoomFlow($v['room_id'],$search_stime,$search_etime);
|
$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]['add_time'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||||
$total_consumption += $rum_lists[$k]['consumption'];
|
$total_consumption += $rum_lists[$k]['consumption'];
|
||||||
|
//幸运币统计
|
||||||
|
if($search_stime !== ''){
|
||||||
|
$where_lucky['createtime'] = ['>=', strtotime($search_stime)];
|
||||||
|
}
|
||||||
|
if($search_etime !== ''){
|
||||||
|
$where_lucky['createtime'] = ['<=', strtotime($search_etime)];
|
||||||
|
}
|
||||||
|
if(!empty($search_stime) && !empty($search_etime)){
|
||||||
|
$where_lucky['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
|
||||||
|
}
|
||||||
|
$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 = [];
|
||||||
|
if($search_stime !== ''){
|
||||||
|
$where_lucky['createtime'] = ['>=', strtotime($search_stime)];
|
||||||
|
}
|
||||||
|
if($search_etime !== ''){
|
||||||
|
$where_lucky['createtime'] = ['<=', strtotime($search_etime)];
|
||||||
|
}
|
||||||
|
if(!empty($search_stime) && !empty($search_etime)){
|
||||||
|
$where_lucky['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
|
||||||
|
}
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
'total_consumption' => $total_consumption,
|
'total_consumption' => $total_consumption,
|
||||||
|
'total_lucky_coin' => db::name('vs_room_luck_value')->where($where_lucky)->sum('luck_value'),
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'lists' => $rum_lists
|
'lists' => $rum_lists
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -693,6 +693,8 @@ class Room extends adminApi
|
|||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$page_limit = input('page_limit', 10);
|
$page_limit = input('page_limit', 10);
|
||||||
$type = input('type', 1);//1:全部流水 2:日流水 3:周流水 4:月流水
|
$type = input('type', 1);//1:全部流水 2:日流水 3:周流水 4:月流水
|
||||||
|
$stime = input('stime', '');
|
||||||
|
$etime = input('etime', '');
|
||||||
if($room_id == ''){
|
if($room_id == ''){
|
||||||
return V(0,"参数错误");
|
return V(0,"参数错误");
|
||||||
}
|
}
|
||||||
@@ -718,6 +720,19 @@ class Room extends adminApi
|
|||||||
$end_time = time();
|
$end_time = time();
|
||||||
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
||||||
}
|
}
|
||||||
|
if($stime != '' && $etime != ''){
|
||||||
|
$begin_time = strtotime($stime);
|
||||||
|
$end_time = strtotime($etime);
|
||||||
|
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
||||||
|
}elseif($stime != '' && $etime == ''){
|
||||||
|
$begin_time = strtotime($stime);
|
||||||
|
$end_time = time();
|
||||||
|
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
||||||
|
}elseif($etime != '' && $stime == ''){
|
||||||
|
$end_time = strtotime($etime);
|
||||||
|
$where['a.createtime'] = ['<=', $etime];
|
||||||
|
}
|
||||||
|
|
||||||
$count = db::name('vs_give_gift')->alias('a')
|
$count = db::name('vs_give_gift')->alias('a')
|
||||||
->field('a.id')
|
->field('a.id')
|
||||||
->join('user b', 'a.user_id = b.id', 'left')
|
->join('user b', 'a.user_id = b.id', 'left')
|
||||||
@@ -747,6 +762,8 @@ class Room extends adminApi
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//幸运流水总计
|
||||||
|
$total_lucky_coin = db::name('vs_room_luck_value')->where('room_id',$room_id)->where($where)->sum('luck_value');
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
@@ -757,7 +774,8 @@ class Room extends adminApi
|
|||||||
->join('user b', 'a.user_id = b.id', 'left')
|
->join('user b', 'a.user_id = b.id', 'left')
|
||||||
->where('a.from',2)
|
->where('a.from',2)
|
||||||
->where('a.from_id',$room_id)
|
->where('a.from_id',$room_id)
|
||||||
->where($where)->sum('total_price')
|
->where($where)->sum('total_price'),
|
||||||
|
'total_lucky_coin' => $total_lucky_coin,
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
return V(1,"成功", $return_data);
|
return V(1,"成功", $return_data);
|
||||||
|
|||||||
@@ -270,15 +270,40 @@ class Statistical extends adminApi
|
|||||||
$lists[$key]['room_cover'] = db::name('vs_room')->where('id', $value['from_id'])->value('room_cover');
|
$lists[$key]['room_cover'] = db::name('vs_room')->where('id', $value['from_id'])->value('room_cover');
|
||||||
$label = db::name('vs_room')->where('id', $value['from_id'])->value('label_id');
|
$label = db::name('vs_room')->where('id', $value['from_id'])->value('label_id');
|
||||||
$lists[$key]['label'] = db::name('vs_room_label')->where('id', $label)->value('label_name');
|
$lists[$key]['label'] = db::name('vs_room_label')->where('id', $label)->value('label_name');
|
||||||
|
//幸运币统计
|
||||||
|
if($begin_time !== ''){
|
||||||
|
$where_lucky['createtime'] = ['>=', strtotime($begin_time)];
|
||||||
|
}
|
||||||
|
if($end_time !== ''){
|
||||||
|
$where_lucky['createtime'] = ['<=', strtotime($end_time)];
|
||||||
|
}
|
||||||
|
if(!empty($begin_time) && !empty($end_time)){
|
||||||
|
$where_lucky['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||||
|
}
|
||||||
|
$lists[$key]['lucky_coin'] = db::name('vs_room_luck_value')->where('room_id',$room_id)->where($where_lucky)->sum('luck_value');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$where_lucky = [];
|
||||||
|
if($room_id){
|
||||||
|
$where_lucky['room_id'] = $room_id;
|
||||||
|
}
|
||||||
|
if($begin_time !== ''){
|
||||||
|
$where_lucky['createtime'] = ['>=', strtotime($begin_time)];
|
||||||
|
}
|
||||||
|
if($end_time !== ''){
|
||||||
|
$where_lucky['createtime'] = ['<=', strtotime($end_time)];
|
||||||
|
}
|
||||||
|
if(!empty($begin_time) && !empty($end_time)){
|
||||||
|
$where_lucky['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||||
|
}
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'lists' => $lists,
|
'lists' => $lists,
|
||||||
'total' =>[
|
'total' =>[
|
||||||
'total_price' => db::name('vs_give_gift')->where($where)->sum('total_price')
|
'total_price' => db::name('vs_give_gift')->where($where)->sum('total_price'),
|
||||||
|
'total_lucky_coin' => db::name('vs_room_luck_value')->where($where_lucky)->sum('luck_value'),
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
return V(1,"成功", $return_data);
|
return V(1,"成功", $return_data);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class Guild extends Model
|
|||||||
*/
|
*/
|
||||||
public function getTodayMoney($guild_id,$stoday="",$etoday=""){
|
public function getTodayMoney($guild_id,$stoday="",$etoday=""){
|
||||||
//获取所有工会房间ID
|
//获取所有工会房间ID
|
||||||
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->field('room_id,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,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)){
|
if(empty($stoday) && empty($etoday)){
|
||||||
@@ -106,8 +106,8 @@ class Guild extends Model
|
|||||||
$stoday_seach = strtotime($stoday);
|
$stoday_seach = strtotime($stoday);
|
||||||
$etoday_seach = strtotime($etoday);
|
$etoday_seach = strtotime($etoday);
|
||||||
}
|
}
|
||||||
if($v['createtime'] && $stoday_seach < $v['createtime']){
|
if($v['apply_time'] && $stoday_seach < $v['apply_time']){
|
||||||
$stoday_seach = $v['createtime'];
|
$stoday_seach = $v['apply_time'];
|
||||||
}
|
}
|
||||||
if($v['quit_time'] && ($etoday > $v['quit_time'])){
|
if($v['quit_time'] && ($etoday > $v['quit_time'])){
|
||||||
$etoday_seach = $v['quit_time'];
|
$etoday_seach = $v['quit_time'];
|
||||||
@@ -121,6 +121,37 @@ class Guild extends Model
|
|||||||
return $transaction;
|
return $transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*工会幸运流水
|
||||||
|
*/
|
||||||
|
public function getTodayMoneyLuckyCoin($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,createtime,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',"2025-12-21"));
|
||||||
|
$etoday_seach = 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_room_luck_value')
|
||||||
|
->where('room_id',$v['room_id'])
|
||||||
|
->where(['createtime' => ['between', [$stoday_seach, $etoday_seach]]])
|
||||||
|
->sum('luck_value');
|
||||||
|
$transaction += $transaction_one;
|
||||||
|
}
|
||||||
|
return $transaction;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 工会个人流水
|
* 工会个人流水
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ class Subsidy
|
|||||||
$data_count = 0;
|
$data_count = 0;
|
||||||
foreach ($guild_list as $key => $value) {
|
foreach ($guild_list as $key => $value) {
|
||||||
//获取所有工会房间ID
|
//获取所有工会房间ID
|
||||||
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $value['id'])->field('room_id,createtime,quit_time')->select();
|
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $value['id'])->where(['apply_time'=>['>',0],'status'=>1])->field('room_id,apply_time,quit_time')->select();
|
||||||
$transaction = 0;
|
$transaction = 0;
|
||||||
foreach ($guild_user_data as $k => $v) {
|
foreach ($guild_user_data as $k => $v) {
|
||||||
$week_start_time_seach = $week_start_time;
|
$week_start_time_seach = $week_start_time;
|
||||||
$week_end_time_seach = $week_end_time;
|
$week_end_time_seach = $week_end_time;
|
||||||
if($v['createtime'] && $week_start_time_seach < $v['createtime']){
|
if($v['apply_time'] && $week_start_time_seach < $v['apply_time']){
|
||||||
$week_start_time_seach = $v['createtime'];
|
$week_start_time_seach = $v['apply_time'];
|
||||||
}
|
}
|
||||||
if($v['quit_time'] && ($week_end_time_seach > $v['quit_time'])){
|
if($v['quit_time'] && ($week_end_time_seach > $v['quit_time'])){
|
||||||
$week_end_time_seach = $v['quit_time'];
|
$week_end_time_seach = $v['quit_time'];
|
||||||
|
|||||||
@@ -86,10 +86,10 @@ class Room extends GuildAdmin
|
|||||||
$search_stime = $search_stime_str;
|
$search_stime = $search_stime_str;
|
||||||
$search_etime = $search_etime_str;
|
$search_etime = $search_etime_str;
|
||||||
if($search_stime!=""){
|
if($search_stime!=""){
|
||||||
if($search_stime!="" && $v['createtime'] < strtotime($search_stime)){
|
if($search_stime!="" && $v['apply_time'] < strtotime($search_stime)){
|
||||||
$search_stime = $search_stime;
|
$search_stime = $search_stime;
|
||||||
}else{
|
}else{
|
||||||
$search_stime = date('Y-m-d H:i:s',$v['createtime']) ;
|
$search_stime = date('Y-m-d H:i:s',$v['apply_time']) ;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$search_stime = $search_stime;
|
$search_stime = $search_stime;
|
||||||
@@ -143,7 +143,17 @@ class Room extends GuildAdmin
|
|||||||
$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'];
|
||||||
|
|
||||||
|
//幸运币统计
|
||||||
|
if($search_stime !== ''){
|
||||||
|
$where_lucky['createtime'] = ['>=', strtotime($search_stime)];
|
||||||
|
}
|
||||||
|
if($search_etime !== ''){
|
||||||
|
$where_lucky['createtime'] = ['<=', strtotime($search_etime)];
|
||||||
|
}
|
||||||
|
if(!empty($search_stime) && !empty($search_stime)){
|
||||||
|
$where_lucky['createtime'] = ['between',[strtotime($search_stime),strtotime($search_stime)]];
|
||||||
|
}
|
||||||
|
$rum_lists[$k]['lucky_coin'] = db::name('vs_room_luck_value')->where('room_id',$v['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'];
|
||||||
@@ -156,10 +166,21 @@ class Room extends GuildAdmin
|
|||||||
}
|
}
|
||||||
//分页
|
//分页
|
||||||
$rum_lists = array_slice($rum_lists, ($page-1)*$page_limit, $page_limit);
|
$rum_lists = array_slice($rum_lists, ($page-1)*$page_limit, $page_limit);
|
||||||
|
//幸运币统计
|
||||||
|
if($search_stime !== ''){
|
||||||
|
$where_lucky['createtime'] = ['>=', strtotime($search_stime)];
|
||||||
|
}
|
||||||
|
if($search_etime !== ''){
|
||||||
|
$where_lucky['createtime'] = ['<=', strtotime($search_etime)];
|
||||||
|
}
|
||||||
|
if(!empty($search_stime) && !empty($search_stime)){
|
||||||
|
$where_lucky['createtime'] = ['between',[strtotime($search_stime),strtotime($search_stime)]];
|
||||||
|
}
|
||||||
$return_data = [
|
$return_data = [
|
||||||
'page' =>$page,
|
'page' =>$page,
|
||||||
'page_limit' => $page_limit,
|
'page_limit' => $page_limit,
|
||||||
'total_consumption' => $total_consumption,
|
'total_consumption' => $total_consumption,
|
||||||
|
'total_lucky_coin' => db::name('vs_room_luck_value')->where($where_lucky)->sum('luck_value'),
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'lists' => $rum_lists
|
'lists' => $rum_lists
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user