优化新增重算

master
chenzhi 4 years ago
parent 53b9513935
commit 9d8ed80fcc

@ -722,7 +722,7 @@ class CompanyStatementController extends ThinkController
if($v['second_company_type'] == 1){ if($v['second_company_type'] == 1){
$up_company_id[] = $v['second_company_id']; $up_company_id[] = $v['second_company_id'];
}else{ }else{
$dowm_company_id = $v['second_company_id']; $dowm_company_id[] = $v['second_company_id'];
} }
}else{ }else{
if($v['first_company_type'] == 1){ if($v['first_company_type'] == 1){
@ -767,14 +767,14 @@ class CompanyStatementController extends ThinkController
$stime = strtotime($date); $stime = strtotime($date);
$w = (int)date("w",strtotime($date)); $w = (int)date("w",strtotime($date));
$d = (int)date("d",strtotime($date)); $d = (int)date("d",strtotime($date));
if($w == 1){ // if($w == 1){
if(!empty($up_company_id)){ // if(!empty($up_company_id)){
$CompanyStatementSet->cpStatement(0,$stime,$up_company_id,false); // $CompanyStatementSet->cpStatement(0,$stime,$up_company_id,false);
} // }
if(!empty($dowm_company_id)){ // if(!empty($dowm_company_id)){
$CompanyStatementSet->promoteCompanyStatement(0,$stime,$dowm_company_id,false); // $CompanyStatementSet->promoteCompanyStatement(0,$stime,$dowm_company_id,false);
} // }
} // }
if($d == 1){ if($d == 1){
if(!empty($up_company_id)){ if(!empty($up_company_id)){
$CompanyStatementSet->cpStatement(1,$stime,$up_company_id,false); $CompanyStatementSet->cpStatement(1,$stime,$up_company_id,false);
@ -782,7 +782,7 @@ class CompanyStatementController extends ThinkController
} }
if(!empty($dowm_company_id)){ if(!empty($dowm_company_id)){
$CompanyStatementSet->promoteCompanyStatement(1,$stime,$dowm_company_id,false); $CompanyStatementSet->promoteCompanyStatement(1,$stime,$dowm_company_id,false);
$CompanyStatementSet->promoteCompanyStatement(2,$stime,$dowm_company_id,false); // $CompanyStatementSet->promoteCompanyStatement(2,$stime,$dowm_company_id,false);
} }
} }

@ -241,6 +241,7 @@ 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']]['invoice_rate'] ?? 0; $fax_ratio = $cp[$add_data['company_id']]['invoice_rate'] ?? 0;
//游戏统计 //游戏统计
if(!isset($v['list'])){continue;}
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'];
@ -425,7 +426,6 @@ class CompanyStatementSetController extends Controller {
$where['settlement_type']=1; $where['settlement_type']=1;
$pcDbRes = M("CompanyRelation","tab_")->where($where)->select(); $pcDbRes = M("CompanyRelation","tab_")->where($where)->select();
} }
$pcList=[]; $pcList=[];
$js_id = [];//己方公司 $js_id = [];//己方公司
foreach ($pcDbRes as $k => $v) { foreach ($pcDbRes as $k => $v) {
@ -452,6 +452,7 @@ class CompanyStatementSetController extends Controller {
foreach ($tmpp as $v) { foreach ($tmpp as $v) {
$pc[$v['id']]=$v; $pc[$v['id']]=$v;
} }
unset($tmpp); unset($tmpp);
//获取己方公司 //获取己方公司
$our = []; $our = [];
@ -469,7 +470,9 @@ class CompanyStatementSetController extends Controller {
$statement_begin_time = date("Y-m-d",$begintime); $statement_begin_time = date("Y-m-d",$begintime);
$statement_end_time = date("Y-m-d",$endtime); $statement_end_time = date("Y-m-d",$endtime);
$RewardRecord = M("RewardRecord","tab_"); $RewardRecord = M("RewardRecord","tab_");
foreach($pcList as $k=>$v){ foreach($pcList as $k=>$v){
if(!isset($pc[$k])){continue;}//不存在的公司不结算 if(!isset($pc[$k])){continue;}//不存在的公司不结算
$add_data=[]; $add_data=[];
@ -509,8 +512,7 @@ class CompanyStatementSetController extends Controller {
$company_belong = $pc[$add_data['company_id']]['company_belong']; $company_belong = $pc[$add_data['company_id']]['company_belong'];
$add_data['company_belong']=$company_belong; $add_data['company_belong']=$company_belong;
$add_data['company_type']=$pc[$add_data['company_id']]['company_type']; $add_data['company_type']=$pc[$add_data['company_id']]['company_type'];
if(!isset($v['list'])){continue;}
//游戏统计 //游戏统计
foreach($v['list'] as $ke=>$va){ foreach($v['list'] as $ke=>$va){
$game =[]; $game =[];
@ -597,20 +599,13 @@ class CompanyStatementSetController extends Controller {
if($add_data['platform_amount'] <= 0){ if($add_data['platform_amount'] <= 0){
return; return;
} }
// dd($add_data);
//添加 //添加
if($recount && $company_id !== false){ if($recount && $company_id !== false){
//非重算 //非重算
return $add_data; return $add_data;
} }
$StatementDb->add($add_data); $StatementDb->add($add_data);
// if($company_id === false){
// //非重算
// $StatementDb->add($add_data);
// }else{
// return $add_data;
// }
} }
} }
//设定开始结束时间 //设定开始结束时间
@ -763,6 +758,7 @@ class CompanyStatementSetController extends Controller {
$v['fine'] = 0; $v['fine'] = 0;
$v['reward'] = 0; $v['reward'] = 0;
$v['platform_amount'] = 0; $v['platform_amount'] = 0;
if(!isset($v['list'])){continue;}
foreach($v['list'] as $ke=>$va){ foreach($v['list'] as $ke=>$va){
$game =[]; $game =[];
$game['pay_amount'] =$va['pay_amount']; $game['pay_amount'] =$va['pay_amount'];

Loading…
Cancel
Save