From f48d6ff51257244232f63c84e43c9031d3277b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=92=8A?= Date: Tue, 30 Sep 2025 10:53:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BC=9A=E6=B5=81=E6=B0=B4=E8=AE=A1?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/adminapi/model/Guild.php | 34 ++++++++++------------------ application/api/model/Guild.php | 33 +++++++++++++++------------ 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/application/adminapi/model/Guild.php b/application/adminapi/model/Guild.php index 3405a2c..0c32e3c 100644 --- a/application/adminapi/model/Guild.php +++ b/application/adminapi/model/Guild.php @@ -95,36 +95,26 @@ class Guild extends Model *工会当日流水 */ public function getTodayMoney($guild_id,$stoday="",$etoday=""){ - $where = []; - if(empty($stoday) && empty($etoday)){ - $stoday = strtotime(date('Y-m-d 00:00:00')); - $etoday = strtotime(date('Y-m-d 23:59:59')); - $where['createtime'] = ['between', [$stoday, $etoday]]; - }else{ - if(!empty($stoday)){ - $where['createtime'] = ['>=', strtotime($stoday."00:00:00")]; - } - if(!empty($etoday)){ - $where['createtime'] = ['<=', strtotime($etoday." 23:59:59")]; - } - if(!empty($stoday) && !empty($etoday)){ - $where['createtime'] = ['between', [strtotime($stoday." 00:00:00"), strtotime($etoday." 23:59:59")]]; - } - } - //获取所有工会房间ID $guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->field('room_id,createtime,quit_time')->select(); $transaction = 0; foreach ($guild_user_data as $k => $v) { - if($v['createtime'] && $stoday < $v['createtime']){ - $stoday = $v['createtime']; + 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['createtime'] && $stoday_seach < $v['createtime']){ + $stoday_seach = $v['createtime']; } if($v['quit_time'] && ($etoday > $v['quit_time'])){ - $etoday = $v['quit_time']; + $etoday_seach = $v['quit_time']; } $transaction_one = db::name('vs_give_gift') - ->whereIn('from_id',$v['room_id']) - ->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$stoday, $etoday]]]) + ->where('from_id',$v['room_id']) + ->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$stoday_seach, $etoday_seach]]]) ->sum('total_price'); $transaction += $transaction_one; } diff --git a/application/api/model/Guild.php b/application/api/model/Guild.php index 0630b87..b16cb7f 100644 --- a/application/api/model/Guild.php +++ b/application/api/model/Guild.php @@ -645,9 +645,15 @@ class Guild extends Model $ss = 0; if($total_transaction){ //根据工会流水 获取补贴比例 单位% - $subsidy_config = db::name('vs_guild_subsidy_config')->where('end_amount >= '. $total_transaction) - ->where('end_amount > '. $total_transaction)->value('subsidy_ratio'); - $ss = round($total_transaction * ($subsidy_config / 100),2) ; + //获取补贴配置 + $config = db::name('vs_guild_subsidy_config')->where(['status' => 1])->order('end_amount desc')->select(); //配置查询 + foreach ($config as $k => $v) { + if ($total_transaction >= $v['end_amount']) { + $subsidy_ratio = $v['subsidy_ratio']; + $ss = ($total_transaction * ($subsidy_ratio / 100)) / get_system_config_value('rmb_coin_ratio');//转为钻石 + break; // 找到匹配项后提前退出循环 + } + } } //待开发 $data['list'][1]['name'] = "本周流水"; @@ -790,19 +796,18 @@ class Guild extends Model $room_data = []; $i=0; foreach ($list as $k=>$v){ - $add_guild_time = $v['createtime']; if(!$start_time){ - $start_time = $add_guild_time; - $end_time = time(); - } else{ - $start_time = $start_time; - $end_time = strtotime($end_time." 23:59:59"); + $start_time_seach = $value['createtime']; + $end_time_seach = time(); + }else{ + $start_time_seach = strtotime($start_time." 00:00:00"); + $end_time_seach = strtotime($end_time." 23:59:59"); } - if($v['createtime'] && $start_time_all < $v['createtime']){ - $start_time = $v['createtime']; + if($value['createtime'] && $start_time_all < $value['createtime']){ + $start_time_seach = $value['createtime']; } - if($v['quit_time'] && ($end_time_all > $v['quit_time'])){ - $start_time = $v['quit_time']; + if($value['quit_time'] && ($end_time_all > $value['quit_time'])){ + $end_time_seach = $value['quit_time']; } $room_info = db::name('vs_room')->where(['id'=>$v['room_id'],'room_status'=>1,'delete_time'=>0])->find(); if($room_info){ @@ -812,7 +817,7 @@ class Guild extends Model $room_data[$i]['room_cover'] = localpath_to_netpath($room_info['room_cover']); $room_data[$i]['total_price'] = db::name('vs_give_gift') ->where('from_id',$v['room_id']) - ->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time, $end_time]]]) + ->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time_seach, $end_time_seach]]]) ->sum('total_price'); $i++; }