From 2ff538886cb089bc9fb78ee171a31568bec93a24 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 31 Aug 2020 17:42:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8A=E6=B8=B8=E7=BB=93?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementSetController.class.php | 103 +++++++++--------- 1 file changed, 54 insertions(+), 49 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index cbaf8468c..cbf58355a 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -299,55 +299,60 @@ class CompanyStatementSetController extends Controller { $promote_ratio = $cp[$add_data['company_id']]['channel_rate'] ?? 0; $fax_ratio = $cp[$add_data['company_id']]['taxation_rate'] ?? 0; //游戏统计 - if(!isset($v['list'])){continue;} - foreach($v['list'] as $ke=>$va){ - $game =[]; - $game['pay_amount'] =$va['pay_money']; - $game['game_name'] =$ke; - //获取游戏id及比例 - $game_id = $GameDb->where("relation_game_name='{$ke}' OR original_package_name='{$ke}'")->field("id,relation_game_id")->find(); - if(empty($game_id) && isset($va['unique_code']) && !empty($va['unique_code'])){ - $unique_code = $va['unique_code']; - $game_id = $GameDb->where("unique_code='{$unique_code }'")->field("id,relation_game_id")->find(); - } - if(empty($game_id)){ - $game['relation_game_id']=0; - $tratio = 0; - }else{ - //获取比例 - $game['relation_game_id']=$game_id['relation_game_id']; - if($type == 1){ - $tratio = getGameCpRadio($game_id['id'],$va['pay_money'],true); - }elseif($type == 0){ - $tratio = getGameCpRadio($game_id['id'],$va['pay_money'],false); - }else{ - //补丁 - $tratio1 = getGameCpRadio($game_id['id'],$va['pay_money'],true); - $tratio2 = getGameCpRadio($game_id['id'],$va['pay_money'],false); - $tratio = $tratio1-$tratio2; - if($tratio <= 0){continue;} - } - } - if($v['first_company_type'] == 1){ - $game['first_ratio']=$tratio-0; - $game['second_ratio']=100-$tratio; - }else{ - $game['first_ratio']=100-$tratio; - $game['second_ratio']=$tratio-0; - } - $add_data['pay_amount'] += $va['pay_money']; - - $game['sum_money']=round($va['pay_money']*(100-$promote_ratio)*$tratio*(100-$fax_ratio)/(100*100*100),2);//结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率) - - $add_data['statement_money'] += $game['sum_money']; + if (isset($v['list'])) { + foreach ($v['list'] as $ke=>$va) { + $game =[]; + $game['pay_amount'] =$va['pay_money']; + $game['game_name'] =$ke; + //获取游戏id及比例 + $game_id = $GameDb->where("relation_game_name='{$ke}' OR original_package_name='{$ke}'")->field("id,relation_game_id")->find(); + if (empty($game_id) && isset($va['unique_code']) && !empty($va['unique_code'])) { + $unique_code = $va['unique_code']; + $game_id = $GameDb->where("unique_code='{$unique_code }'")->field("id,relation_game_id")->find(); + } + if (empty($game_id)) { + $game['relation_game_id']=0; + $tratio = 0; + } else { + //获取比例 + $game['relation_game_id']=$game_id['relation_game_id']; + if ($type == 1) { + $tratio = getGameCpRadio($game_id['id'], $va['pay_money'], true); + } elseif ($type == 0) { + $tratio = getGameCpRadio($game_id['id'], $va['pay_money'], false); + } else { + //补丁 + $tratio1 = getGameCpRadio($game_id['id'], $va['pay_money'], true); + $tratio2 = getGameCpRadio($game_id['id'], $va['pay_money'], false); + $tratio = $tratio1-$tratio2; + if ($tratio <= 0) { + continue; + } + } + } + if ($v['first_company_type'] == 1) { + $game['first_ratio']=$tratio-0; + $game['second_ratio']=100-$tratio; + } else { + $game['first_ratio']=100-$tratio; + $game['second_ratio']=$tratio-0; + } + $add_data['pay_amount'] += $va['pay_money']; + + $game['sum_money']=round($va['pay_money']*(100-$promote_ratio)*$tratio*(100-$fax_ratio)/(100*100*100), 2);//结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率) + + $add_data['statement_money'] += $game['sum_money']; - $game['fax_ratio']=$fax_ratio; - $game['promote_ratio']=$promote_ratio; + $game['fax_ratio']=$fax_ratio; + $game['promote_ratio']=$promote_ratio; - $game['statement_begin_time']=$statement_begin_time; - $game['statement_end_time']=$statement_end_time; - $game['statement_type']=0; - $add_data['statement_info'][] = $game; + $game['statement_begin_time']=$statement_begin_time; + $game['statement_end_time']=$statement_end_time; + $game['statement_type']=0; + $add_data['statement_info'][] = $game; + } + }else{ + $add_data['statement_info'] = []; } $add_data['platform_amount'] = $add_data['pay_amount']; if($type < 2){ @@ -411,9 +416,9 @@ class CompanyStatementSetController extends Controller { //金额为0不补点 continue; } - if($add_data['platform_amount'] == 0){ + if($add_data['platform_amount'] == 0 && $add_data['statement_money'] == 0){ //全等于0表示没有流水,小于0依旧要结算 - return; + continue; } //添加 if($recount && $company_id !== false){