优化下游结算

master
chenzhi 4 years ago
parent d946a4c91c
commit f91b2a5dce

@ -69,30 +69,30 @@ class CompanyStatementSetController extends Controller {
echo $nowdate.":".PHP_EOL;
echo "--周结begin".PHP_EOL;
$this->cpStatement(0,$stime);
echo "∟----CP周结统计ok".PHP_EOL;
// $this->cpStatement(0,$stime);
// echo "∟----CP周结统计ok".PHP_EOL;
$this->promoteCompanyStatement(0,$stime);
echo "∟----推广公司周结统计ok".PHP_EOL;
// $this->promoteCompanyStatement(0,$stime);
// echo "∟----推广公司周结统计ok".PHP_EOL;
$this->promoteUserPool(0,$stime);
echo "∟----推广个人周结ok".PHP_EOL;
// $this->promoteUserPool(0,$stime);
// echo "∟----推广个人周结ok".PHP_EOL;
}
if($d == 1){
echo $nowdate.":".PHP_EOL;
echo "--月结&补点begin".PHP_EOL;
$this->cpStatement(1,$stime);
$this->cpStatement(2,$stime);
echo "∟----CP月结&补点统计ok".PHP_EOL;
// $this->cpStatement(1,$stime);
// $this->cpStatement(2,$stime);
// echo "∟----CP月结&补点统计ok".PHP_EOL;
$this->promoteCompanyStatement(1,$stime);
$this->promoteCompanyStatement(2,$stime);
echo "∟----推广公司月结&补点统计ok".PHP_EOL;
$this->promoteUserPool(1,$stime);
// $this->promoteUserPool(1,$stime);
// $this->promoteUserPool(2,$stime);
echo "∟----推广个人月结&补点统计ok".PHP_EOL;
// echo "∟----推广个人月结&补点统计ok".PHP_EOL;
}
}else{
echo $nowdate."非周一和月初,无需任何处理".PHP_EOL;
@ -502,8 +502,7 @@ class CompanyStatementSetController extends Controller {
unset($tmpp);
unset($js_id);
$this->getPromoteCompanySpend($pcList,array_unique(array_keys($pcList)),$begintime,$endtime);
// dd($pcList);
//数据整合
$verify_log=json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]);
$StatementDb = M("CompanyStatement","tab_");
@ -513,14 +512,12 @@ class CompanyStatementSetController extends Controller {
$RewardRecord = M("RewardRecord","tab_");
foreach($pcList as $k=>$v){
if(!isset($pc[$k])){continue;}//不存在的公司不结算
if($pc[$k]['has_ratio'] == 1){
$company_ratio = $this->getCompanyRatio($v['paymount'],$pc[$k]['turnover_ratio']);
$company_ratio = $this->getCompanyRatio($v['pay_amount'],$pc[$k]['turnover_ratio']);
}else{
$company_ratio = 0;
}
$add_data=[];
//1.获取甲乙方信息
if($v['first_company_type'] > 0){
@ -705,6 +702,8 @@ class CompanyStatementSetController extends Controller {
"s.pay_time"=>['between', [$begintime,$endtime]],
];
for ($i=0; $i <count($idarr); $i++) {
$company_id = $idarr[$i];
$pres = $Promote->field("group_concat(id) ids,count(id) count")->where("company_id = '{$company_id}'")->group("company_id")->find();
if($pres['count'] ==0 ){continue;}
$spenMap['s.promote_id']=["in",$pres['ids']];

Loading…
Cancel
Save