优化比例获取

master
chenzhi 4 years ago
parent 108db9fca7
commit 6031a5aeca

@ -104,7 +104,7 @@ class StatementWarningSetController extends Controller {
$this->setCompanyIsWm(); $this->setCompanyIsWm();
$this->getAllWmAmount(); $this->getAllWmAmount();
$this->cpStatement(); // $this->cpStatement();
$this->pcStatement(); $this->pcStatement();
$this->puStatement(); $this->puStatement();
@ -317,7 +317,7 @@ class StatementWarningSetController extends Controller {
'company_belong'=>0 'company_belong'=>0
])->getField("id company_id,company_name,develop_type",true); ])->getField("id company_id,company_name,develop_type",true);
$company = $this->getPromoteCompanyGameSpend($company); $company = $this->getPromoteCompanyGameSpend($company,0);
$pcStatementAmount = $this->addStatementWarningInfo($company,0); $pcStatementAmount = $this->addStatementWarningInfo($company,0);
$savedata = [ $savedata = [
'type'=>2, 'type'=>2,
@ -334,7 +334,7 @@ class StatementWarningSetController extends Controller {
$this->statementWarningModel->add($savedata); $this->statementWarningModel->add($savedata);
} }
} }
private function getPromoteCompanyGameSpend($company) private function getPromoteCompanyGameSpend($company,$companyBelong)
{ {
$where = [ $where = [
'tab_spend.is_check'=>1, 'tab_spend.is_check'=>1,
@ -356,7 +356,7 @@ class StatementWarningSetController extends Controller {
foreach ($items as $key => $val) { foreach ($items as $key => $val) {
$relationGameId = $games[$val['relation_game_name']]; $relationGameId = $games[$val['relation_game_name']];
$radio = end($CompanyGameRatio->getGameRadio($val['company_id'],$relationGameId,0,$this->beginThismonth,$this->endThismonth)); $radio = end($CompanyGameRatio->getGameRadio($val['company_id'],$relationGameId,$companyBelong,$this->beginThismonth,$this->endThismonth));
$radio = $CompanyGameRatio->getTurnoverRatio($val['amount'],$radio['ratio'],$radio['turnover_ratio']); $radio = $CompanyGameRatio->getTurnoverRatio($val['amount'],$radio['ratio'],$radio['turnover_ratio']);
$statementMoney =round($val['amount']*$radio/100,2); $statementMoney =round($val['amount']*$radio/100,2);
if(isset($company[$val['company_id']]['statement_money'])){ if(isset($company[$val['company_id']]['statement_money'])){
@ -379,7 +379,7 @@ class StatementWarningSetController extends Controller {
$puStatementAmount = 0; $puStatementAmount = 0;
if($company) { if($company) {
$company = $this->getPuSpecialStatement( $this->getPromoteCompanyGameSpend($company) ); $company = $this->getPuSpecialStatement( $this->getPromoteCompanyGameSpend($company,1) );
foreach ($company as $key => $value) { foreach ($company as $key => $value) {
if(!array_key_exists('statement_money',$value) ) { if(!array_key_exists('statement_money',$value) ) {
unset($company[$key]); unset($company[$key]);

Loading…
Cancel
Save