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