|
|
|
@ -113,6 +113,7 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
|
|
|
|
|
|
$this->promoteCompanyStatement(1,$stime);
|
|
|
|
|
$this->promoteCompanyStatement(2,$stime);
|
|
|
|
|
$this->officeCompanyStatement($stime); //官方结算
|
|
|
|
|
echo "∟----推广公司月结&补点统计ok".PHP_EOL;
|
|
|
|
|
|
|
|
|
|
$this->promoteUserPool(1,$stime);
|
|
|
|
@ -127,6 +128,7 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
|
if($company == "pc"){
|
|
|
|
|
$this->promoteCompanyStatement(1,$stime);
|
|
|
|
|
$this->promoteCompanyStatement(2,$stime);
|
|
|
|
|
$this->officeCompanyStatement($stime); //官方结算
|
|
|
|
|
echo "∟----推广公司月结&补点统计ok".PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
if($company == "pu"){
|
|
|
|
@ -477,6 +479,81 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
return $cplList;
|
|
|
|
|
}
|
|
|
|
|
//官方结算
|
|
|
|
|
public function officeCompanyStatement($stime,$recount=false)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$t = $this->setBeginAndEndTime(1,$stime);
|
|
|
|
|
$begintime = $t[0];
|
|
|
|
|
$endtime = $t[1];
|
|
|
|
|
//获取官方信息
|
|
|
|
|
$pc_map = [
|
|
|
|
|
"id"=>["IN",$pc_id],
|
|
|
|
|
"_string"=>"(validity_start_time > 0 AND validity_end_time = 0 ) OR validity_end_time >= {$endtime}",
|
|
|
|
|
"company_type"=>1
|
|
|
|
|
];
|
|
|
|
|
//获取pc公司
|
|
|
|
|
$company = M("CompanyInfo","tab_")->field("id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank")->where("partner = '海南万盟天下科技有限公司'")->find();
|
|
|
|
|
$add_data=[
|
|
|
|
|
"first_party_info"=>json_encode($company,JSON_UNESCAPED_UNICODE),
|
|
|
|
|
"second_party_info"=>json_encode($company,JSON_UNESCAPED_UNICODE),
|
|
|
|
|
"pay_type"=>1,
|
|
|
|
|
"withdraw_type"=>1,
|
|
|
|
|
"statement_begin_time"=>$begintime,
|
|
|
|
|
"statement_end_time"=>$endtime,
|
|
|
|
|
"statement_money"=>0,
|
|
|
|
|
"pay_amount"=>0,
|
|
|
|
|
"platform_amount"=>0,
|
|
|
|
|
"verify_log"=>json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]),
|
|
|
|
|
"op_time"=>time(),
|
|
|
|
|
"is_payment"=>2,
|
|
|
|
|
"statement_info"=>[],
|
|
|
|
|
"company_belong"=>0,
|
|
|
|
|
"company_name"=>'海南万盟天下科技有限公司',
|
|
|
|
|
"company_id"=>0,
|
|
|
|
|
"company_type"=>1
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
//获取渠道及发票税率
|
|
|
|
|
$fax_ratio = 0; //税费费率
|
|
|
|
|
$company_belong = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$Promote = M("Promote","tab_");
|
|
|
|
|
$Spend = M("Spend","tab_");
|
|
|
|
|
$spenMap = [
|
|
|
|
|
"s.pay_status"=>1,
|
|
|
|
|
"s.payed_time"=>['between', [$begintime,$endtime]],
|
|
|
|
|
"s.promote_id"=>0
|
|
|
|
|
];
|
|
|
|
|
$list = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,g.relation_game_id,g.relation_game_name game_name')->where($spenMap)->group('relation_game_id')
|
|
|
|
|
->join("left join tab_game g on s.game_id = g.id")
|
|
|
|
|
->select();
|
|
|
|
|
if(empty($list)){return;}
|
|
|
|
|
$statement_begin_time = date("Y.m.d",$begintime);
|
|
|
|
|
$statement_end_time = date("Y.m.d",$endtime);
|
|
|
|
|
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
$v['fax_ratio'] = 0;
|
|
|
|
|
$v['statement_begin_time']=$statement_begin_time;
|
|
|
|
|
$v['statement_end_time']=$statement_end_time;
|
|
|
|
|
$v['ratio']=0;
|
|
|
|
|
$v['sum_money'] = 0;
|
|
|
|
|
$v['statement_type']=0;
|
|
|
|
|
|
|
|
|
|
$add_data['platform_amount'] += $v['pay_amount'];
|
|
|
|
|
$add_data['pay_amount'] += $v['pay_amount'];
|
|
|
|
|
$add_data['statement_info'][] = $v;
|
|
|
|
|
}
|
|
|
|
|
$add_data['statement_info'] = json_encode($add_data['statement_info'],JSON_UNESCAPED_UNICODE);
|
|
|
|
|
if($recount){
|
|
|
|
|
//非重算
|
|
|
|
|
return $add_data;
|
|
|
|
|
}
|
|
|
|
|
M("CompanyStatement","tab_")->add($add_data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 下游结算
|
|
|
|
|
*/
|
|
|
|
@ -1480,11 +1557,16 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
|
//获取时间
|
|
|
|
|
$stime = $dbres['statement_end_time']-0+1;
|
|
|
|
|
$company_id = $dbres['company_id'];
|
|
|
|
|
if($dbres['company_belong'] == 9){
|
|
|
|
|
//上游
|
|
|
|
|
$savedata = $this->cpStatement($dbres['withdraw_type'],$stime,$company_id);
|
|
|
|
|
|
|
|
|
|
if($company_id == 0){
|
|
|
|
|
$savedata = $this->officeCompanyStatement($stime,true);
|
|
|
|
|
}else{
|
|
|
|
|
$savedata = $this->promoteCompanyStatement($dbres['withdraw_type'],$stime,$company_id);
|
|
|
|
|
if($dbres['company_belong'] == 9){
|
|
|
|
|
//上游
|
|
|
|
|
$savedata = $this->cpStatement($dbres['withdraw_type'],$stime,$company_id);
|
|
|
|
|
}else{
|
|
|
|
|
$savedata = $this->promoteCompanyStatement($dbres['withdraw_type'],$stime,$company_id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//重写用户
|
|
|
|
|
$savedata['verify_log'] = json_encode(["create_user"=>$admin_user,"create_time"=>date("Y-m-d H:i:s")]);
|
|
|
|
|