|
|
@ -299,55 +299,60 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
$promote_ratio = $cp[$add_data['company_id']]['channel_rate'] ?? 0;
|
|
|
|
$promote_ratio = $cp[$add_data['company_id']]['channel_rate'] ?? 0;
|
|
|
|
$fax_ratio = $cp[$add_data['company_id']]['taxation_rate'] ?? 0;
|
|
|
|
$fax_ratio = $cp[$add_data['company_id']]['taxation_rate'] ?? 0;
|
|
|
|
//游戏统计
|
|
|
|
//游戏统计
|
|
|
|
if(!isset($v['list'])){continue;}
|
|
|
|
if (isset($v['list'])) {
|
|
|
|
foreach($v['list'] as $ke=>$va){
|
|
|
|
foreach ($v['list'] as $ke=>$va) {
|
|
|
|
$game =[];
|
|
|
|
$game =[];
|
|
|
|
$game['pay_amount'] =$va['pay_money'];
|
|
|
|
$game['pay_amount'] =$va['pay_money'];
|
|
|
|
$game['game_name'] =$ke;
|
|
|
|
$game['game_name'] =$ke;
|
|
|
|
//获取游戏id及比例
|
|
|
|
//获取游戏id及比例
|
|
|
|
$game_id = $GameDb->where("relation_game_name='{$ke}' OR original_package_name='{$ke}'")->field("id,relation_game_id")->find();
|
|
|
|
$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'])){
|
|
|
|
if (empty($game_id) && isset($va['unique_code']) && !empty($va['unique_code'])) {
|
|
|
|
$unique_code = $va['unique_code'];
|
|
|
|
$unique_code = $va['unique_code'];
|
|
|
|
$game_id = $GameDb->where("unique_code='{$unique_code }'")->field("id,relation_game_id")->find();
|
|
|
|
$game_id = $GameDb->where("unique_code='{$unique_code }'")->field("id,relation_game_id")->find();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(empty($game_id)){
|
|
|
|
if (empty($game_id)) {
|
|
|
|
$game['relation_game_id']=0;
|
|
|
|
$game['relation_game_id']=0;
|
|
|
|
$tratio = 0;
|
|
|
|
$tratio = 0;
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
//获取比例
|
|
|
|
//获取比例
|
|
|
|
$game['relation_game_id']=$game_id['relation_game_id'];
|
|
|
|
$game['relation_game_id']=$game_id['relation_game_id'];
|
|
|
|
if($type == 1){
|
|
|
|
if ($type == 1) {
|
|
|
|
$tratio = getGameCpRadio($game_id['id'],$va['pay_money'],true);
|
|
|
|
$tratio = getGameCpRadio($game_id['id'], $va['pay_money'], true);
|
|
|
|
}elseif($type == 0){
|
|
|
|
} elseif ($type == 0) {
|
|
|
|
$tratio = getGameCpRadio($game_id['id'],$va['pay_money'],false);
|
|
|
|
$tratio = getGameCpRadio($game_id['id'], $va['pay_money'], false);
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
//补丁
|
|
|
|
//补丁
|
|
|
|
$tratio1 = getGameCpRadio($game_id['id'],$va['pay_money'],true);
|
|
|
|
$tratio1 = getGameCpRadio($game_id['id'], $va['pay_money'], true);
|
|
|
|
$tratio2 = getGameCpRadio($game_id['id'],$va['pay_money'],false);
|
|
|
|
$tratio2 = getGameCpRadio($game_id['id'], $va['pay_money'], false);
|
|
|
|
$tratio = $tratio1-$tratio2;
|
|
|
|
$tratio = $tratio1-$tratio2;
|
|
|
|
if($tratio <= 0){continue;}
|
|
|
|
if ($tratio <= 0) {
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($v['first_company_type'] == 1){
|
|
|
|
}
|
|
|
|
$game['first_ratio']=$tratio-0;
|
|
|
|
}
|
|
|
|
$game['second_ratio']=100-$tratio;
|
|
|
|
if ($v['first_company_type'] == 1) {
|
|
|
|
}else{
|
|
|
|
$game['first_ratio']=$tratio-0;
|
|
|
|
$game['first_ratio']=100-$tratio;
|
|
|
|
$game['second_ratio']=100-$tratio;
|
|
|
|
$game['second_ratio']=$tratio-0;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
$game['first_ratio']=100-$tratio;
|
|
|
|
$add_data['pay_amount'] += $va['pay_money'];
|
|
|
|
$game['second_ratio']=$tratio-0;
|
|
|
|
|
|
|
|
}
|
|
|
|
$game['sum_money']=round($va['pay_money']*(100-$promote_ratio)*$tratio*(100-$fax_ratio)/(100*100*100),2);//结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率)
|
|
|
|
$add_data['pay_amount'] += $va['pay_money'];
|
|
|
|
|
|
|
|
|
|
|
|
$add_data['statement_money'] += $game['sum_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['fax_ratio']=$fax_ratio;
|
|
|
|
$game['promote_ratio']=$promote_ratio;
|
|
|
|
$game['promote_ratio']=$promote_ratio;
|
|
|
|
|
|
|
|
|
|
|
|
$game['statement_begin_time']=$statement_begin_time;
|
|
|
|
$game['statement_begin_time']=$statement_begin_time;
|
|
|
|
$game['statement_end_time']=$statement_end_time;
|
|
|
|
$game['statement_end_time']=$statement_end_time;
|
|
|
|
$game['statement_type']=0;
|
|
|
|
$game['statement_type']=0;
|
|
|
|
$add_data['statement_info'][] = $game;
|
|
|
|
$add_data['statement_info'][] = $game;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$add_data['statement_info'] = [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$add_data['platform_amount'] = $add_data['pay_amount'];
|
|
|
|
$add_data['platform_amount'] = $add_data['pay_amount'];
|
|
|
|
if($type < 2){
|
|
|
|
if($type < 2){
|
|
|
@ -411,9 +416,9 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
//金额为0不补点
|
|
|
|
//金额为0不补点
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($add_data['platform_amount'] == 0){
|
|
|
|
if($add_data['platform_amount'] == 0 && $add_data['statement_money'] == 0){
|
|
|
|
//全等于0表示没有流水,小于0依旧要结算
|
|
|
|
//全等于0表示没有流水,小于0依旧要结算
|
|
|
|
return;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//添加
|
|
|
|
//添加
|
|
|
|
if($recount && $company_id !== false){
|
|
|
|
if($recount && $company_id !== false){
|
|
|
|