加幸运币统计字段

This commit is contained in:
2025-12-22 09:44:34 +08:00
parent 0630170a72
commit 5dde1fa795
6 changed files with 133 additions and 13 deletions

View File

@@ -96,7 +96,7 @@ 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)->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;
foreach ($guild_user_data as $k => $v) {
if(empty($stoday) && empty($etoday)){
@@ -106,8 +106,8 @@ class Guild extends Model
$stoday_seach = strtotime($stoday);
$etoday_seach = strtotime($etoday);
}
if($v['createtime'] && $stoday_seach < $v['createtime']){
$stoday_seach = $v['createtime'];
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'];
@@ -121,6 +121,37 @@ class Guild extends Model
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;
}
/*
* 工会个人流水
*/