工会流水计算

This commit is contained in:
2025-09-30 10:53:49 +08:00
parent 9772866432
commit f48d6ff512
2 changed files with 31 additions and 36 deletions

View File

@@ -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++;
}