Merge pull request '优化独立减罚' (#280) from hotfix/fiance_statement_bug_20210420 into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/280
master
廖金灵 4 years ago
commit 8375c5f9bd

@ -1593,6 +1593,10 @@ class CompanyStatementSetController extends Controller {
$where = [
"_string"=>"first_company_type = '2' OR second_company_type = '2'"
];
//单一公司调试
// $where['_string'] = "( " . $where['_string'] .") AND ( first_company_id = '509' OR first_company_id = '509' )";
//获取哪些要结算
if($type == 1){//月结
$where['settlement_type']=2;
@ -1680,7 +1684,32 @@ class CompanyStatementSetController extends Controller {
$v['reward'] = 0;
}
$v['platform_amount'] = 0;
if(!isset($v['list'])){continue;}
if(!isset($v['list']) && $v['fine'] == 0 && $v['reward'] == 0){continue;}
if(!array_key_exists('list',$v) && ($v['fine'] > 0 || $v['reward'] > 0)){
//没有流水,但是有罚款
$sta_info = [
"account" => $v['account'],
"game_list" => [
[
"pay_amount" => 0,
"relation_game_id" => 0,
"game_name" => "其他",
"p_id" => 0,
"all_pay_amount" => 0,
"game_type_name" => "其他",
"ratio"=>0,
"sum_money" => 0,
"fax_ratio" => 0,
"statement_begin_time" => $statement_begin_time,
"statement_end_time" => $statement_end_time,
"fine" => $v['fine'],
"reward" => $v['reward'],
"statement_type" => 0
]
]
];
$v['statement_info'][] = $sta_info;
}else{
$company_belong = $pc[$v['id']]['company_belong'];
//服务器费用
if ($type < 2) {
@ -1697,70 +1726,62 @@ class CompanyStatementSetController extends Controller {
$v['statement_money'] -= $v['server_fee'];
}
}
$promoteCompanyGameRatio = D("CompanyGameRatio")->getPromoteCompanyGameRatio($v['id'],$v['game_ids'],$begintime,$endtime,$company_belong);
$promoteCompanyGameRatio = D("CompanyGameRatio")->getPromoteCompanyGameRatio($v['id'], $v['game_ids'], $begintime, $endtime, $company_belong);
$handleed_data = [];
foreach($v['list'] as $ke=>$va){
foreach ($v['list'] as $ke=>$va) {
$templist = $va['game_list'];
$va['game_list'] = [];
foreach($templist as $p_id => $p_info){
foreach ($templist as $p_id => $p_info) {
$ratioCount = count($promoteCompanyGameRatio[$p_info['relation_game_id']]);
$isMoreRatio = $ratioCount > 1 ? true : false;
if(!$isMoreRatio){
if (!$isMoreRatio) {
$tmp_game_ratio = $promoteCompanyGameRatio[$p_info['relation_game_id']][0];
if($type == 1){
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
if ($type == 1) {
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'], $tmp_game_ratio['ratio'], $tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
// $tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
// $tratio = $tmp_game_ratio['ratio'];
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
// if ($v['id'] == 5) {
// dump($p_info['all_pay_amount']);
// dump($turnover_type);
// dump($tmp_game_ratio);
// }
} elseif ($type == 0) {
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'], $k, $begintime, $endtime);
if ($turnover_type == 2||$turnover_type == 4) {
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'], $tmp_game_ratio['ratio'], $tmp_game_ratio['turnover_ratio']);
} else {
$tratio = $tmp_game_ratio['ratio'];
}
}else{
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
} else {
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'], $k, $begintime, $endtime);
if ($turnover_type == 2||$turnover_type == 4) {
continue;
}
//补点
$tratio1 =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio1 =$this->getTurnoverRatio($p_info['all_pay_amount'], $tmp_game_ratio['ratio'], $tmp_game_ratio['turnover_ratio']);
$tratio2 =$tmp_game_ratio['ratio'];
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){ continue;}
if ($tratio <= 0) {
continue;
}
}
$tratio -= 0;
if($type == 2){
if ($type == 2) {
$p_info['increment_ratio']=$tratio;
}else{
} else {
$p_info['ratio']=$tratio;
}
$p_info['pay_amount'] = $this->getRelationGameIdPromoteSpend($p_info["p_id"],$p_info['relation_game_id'],$tmp_game_ratio['begintime'],$tmp_game_ratio['endtime']);
$p_info['pay_amount'] = $this->getRelationGameIdPromoteSpend($p_info["p_id"], $p_info['relation_game_id'], $tmp_game_ratio['begintime'], $tmp_game_ratio['endtime']);
$p_info['pay_amount'] = number_format($p_info['pay_amount'],2,'.','');
$p_info['pay_amount'] = number_format($p_info['pay_amount'], 2, '.', '');
$v['platform_amount'] += $p_info['pay_amount'];
$p_info['sum_money']=round($p_info['pay_amount']*$tratio/100,2); //个人等于 结算金额*比例
$p_info['sum_money']=round($p_info['pay_amount']*$tratio/100, 2); //个人等于 结算金额*比例
$v['pay_amount'] += $p_info['sum_money'];
$v['statement_money'] += $p_info['sum_money'];
$p_info['fax_ratio']=$fax_ratio;
$p_info['statement_begin_time']=$statement_begin_time;
$p_info['statement_end_time']=$statement_end_time;
$RewardRecordRes = $this->getPromoteUserGameRewardRecord($v['id'],$statement_begin_time,$statement_end_time);
$RewardRecordRes = $this->getPromoteUserGameRewardRecord($v['id'], $statement_begin_time, $statement_end_time);
if (
($handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['fine'] || $handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['fine'] == '0')
@ -1774,73 +1795,59 @@ class CompanyStatementSetController extends Controller {
$handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['fine'] = (string)$RewardRecordRes['fine'];
$handleed_data[$v['id'].$statement_begin_time.$statement_end_time]['reward'] = (string)$RewardRecordRes['reward'];
}
// if ($p_info['relation_game_id'] == 191 && $v['id'] == 334) {
// dump($RewardRecordRes);
// }
$p_info['statement_type']=0;
if ($p_info['pay_amount'] !='0') {
$va['game_list'][] = $p_info;
}
}else{
} else {
for ($i=0; $i < $ratioCount; $i++) {
$temp_game = [];
$tmp_game_ratio = $promoteCompanyGameRatio[$p_info['relation_game_id']][$i];
if($type == 1){
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
if ($type == 1) {
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'], $tmp_game_ratio['ratio'], $tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
// if ($v['id'] == 5) {
// dump($p_info['all_pay_amount']);
// dump($turnover_type);
// dump($tmp_game_ratio);
// }
} elseif ($type == 0) {
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'], $k, $begintime, $endtime);
if ($turnover_type == 2 || $turnover_type == 4) {
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'], $tmp_game_ratio['ratio'], $tmp_game_ratio['turnover_ratio']);
} else {
$tratio = $tmp_game_ratio['ratio'];
}
}else{
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
} else {
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'], $k, $begintime, $endtime);
if ($turnover_type == 2 || $turnover_type == 4) {
continue;
}
//补点
$tratio1 =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio1 =$this->getTurnoverRatio($p_info['all_pay_amount'], $tmp_game_ratio['ratio'], $tmp_game_ratio['turnover_ratio']);
$tratio2 =$tmp_game_ratio['ratio'];
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){ continue;}
if ($tratio <= 0) {
continue;
}
}
$tratio -= 0;
if($type == 2){
if ($type == 2) {
$temp_game['increment_ratio']=$tratio;
}else{
} else {
$temp_game['ratio']=$tratio;
}
$temp_game['pay_amount'] = $this->getRelationGameIdPromoteSpend($p_info["p_id"],$p_info['relation_game_id'],$tmp_game_ratio['begintime'],$tmp_game_ratio['endtime']);
$temp_game['pay_amount'] = $this->getRelationGameIdPromoteSpend($p_info["p_id"], $p_info['relation_game_id'], $tmp_game_ratio['begintime'], $tmp_game_ratio['endtime']);
$temp_game['pay_amount'] -=0;
$temp_game['pay_amount'] = number_format($temp_game['pay_amount'],2,'.','');
$temp_game['pay_amount'] = number_format($temp_game['pay_amount'], 2, '.', '');
$v['platform_amount'] += $temp_game['pay_amount'];
$temp_game['sum_money']=round($temp_game['pay_amount']*$tratio/100,2); //个人等于 结算金额*比例
$temp_game['sum_money']=round($temp_game['pay_amount']*$tratio/100, 2); //个人等于 结算金额*比例
$v['pay_amount'] += $temp_game['sum_money'];
$v['statement_money'] += $temp_game['sum_money'];
$temp_game['fax_ratio']=$fax_ratio-0;
$temp_game['statement_begin_time']=date("Y.m.d",$tmp_game_ratio['begintime']);
$temp_game['statement_end_time']=date("Y.m.d",$tmp_game_ratio['endtime']);
$temp_game['statement_begin_time']=date("Y.m.d", $tmp_game_ratio['begintime']);
$temp_game['statement_end_time']=date("Y.m.d", $tmp_game_ratio['endtime']);
$temp_game['statement_type']=0;
$RewardRecordRes = $this->getPromoteUserGameRewardRecord($v['id'],$temp_game['statement_begin_time'],$temp_game['statement_end_time']);
$RewardRecordRes = $this->getPromoteUserGameRewardRecord($v['id'], $temp_game['statement_begin_time'], $temp_game['statement_end_time']);
if (
($handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['fine'] || $handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['fine'] == '0')
@ -1854,10 +1861,6 @@ class CompanyStatementSetController extends Controller {
$handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['fine'] = (string)$RewardRecordRes['fine'];
$handleed_data[$v['id'].$temp_game['statement_begin_time'].$temp_game['statement_end_time']]['reward'] = (string)$RewardRecordRes['reward'];
}
// if ($p_info['relation_game_id'] == 191 && $v['id'] == 334) {
// dump($RewardRecordRes);
// }
$temp_game['statement_type']=0;
$temp_game['relation_game_id']=$p_info["relation_game_id"];
@ -1868,11 +1871,11 @@ class CompanyStatementSetController extends Controller {
if ($temp_game['pay_amount'] != '0') {
$va['game_list'][] = $temp_game;
}
}
}
}
$v['statement_info'][] = $va;
}
}
$company_info = [
'account'=>$v['account'],

Loading…
Cancel
Save