|
|
|
@ -9,6 +9,11 @@ use Think\Controller;
|
|
|
|
|
*/
|
|
|
|
|
class CompanyStatementSetController extends Controller {
|
|
|
|
|
public $cpapihost;
|
|
|
|
|
public $TYPE=[
|
|
|
|
|
"0"=>"周结",
|
|
|
|
|
"1"=>"月结",
|
|
|
|
|
"2"=>"补点"
|
|
|
|
|
];
|
|
|
|
|
public $token = "LYHTQDJS";
|
|
|
|
|
|
|
|
|
|
public function _initialize(){
|
|
|
|
@ -71,7 +76,7 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
|
echo "∟----推广公司周结统计ok".PHP_EOL;
|
|
|
|
|
|
|
|
|
|
$this->promoteUserPool(0,$stime);
|
|
|
|
|
echo "∟----推广个人月结&补点统计ok".PHP_EOL;
|
|
|
|
|
echo "∟----推广个人周结ok".PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
if($d == 1){
|
|
|
|
|
echo $nowdate.":".PHP_EOL;
|
|
|
|
@ -86,7 +91,7 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
|
echo "∟----推广公司月结&补点统计ok".PHP_EOL;
|
|
|
|
|
|
|
|
|
|
$this->promoteUserPool(1,$stime);
|
|
|
|
|
$this->promoteUserPool(2,$stime);
|
|
|
|
|
// $this->promoteUserPool(2,$stime);
|
|
|
|
|
echo "∟----推广个人月结&补点统计ok".PHP_EOL;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
@ -665,10 +670,54 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
|
$pcList[$k]['list'] = $v;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public function promoteUserPool($type,$stime,$recount = false){
|
|
|
|
|
$t = $this->setBeginAndEndTime($type,$stime);
|
|
|
|
|
$begintime = $t[0];
|
|
|
|
|
$endtime = $t[1];
|
|
|
|
|
|
|
|
|
|
$basedata = [
|
|
|
|
|
"pay_amount"=>0,
|
|
|
|
|
"statement_money"=>0,
|
|
|
|
|
"lack_statement_money"=>0,
|
|
|
|
|
"withdraw_type"=>$type,
|
|
|
|
|
"platform_amount"=>0,
|
|
|
|
|
"create_lack_ids"=>[],
|
|
|
|
|
"del_lack_ids"=>[],
|
|
|
|
|
"statement_begin_time"=>$begintime,
|
|
|
|
|
"statement_end_time"=>$endtime,
|
|
|
|
|
"fine"=>0,
|
|
|
|
|
"reward"=>0,
|
|
|
|
|
"verify_status"=>0,
|
|
|
|
|
"company_type"=>2,
|
|
|
|
|
"verify_log"=>json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]),
|
|
|
|
|
"op_time"=>time()
|
|
|
|
|
];
|
|
|
|
|
$users = $user = $basedata;
|
|
|
|
|
$users['is_payment'] = 1;
|
|
|
|
|
$users['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
|
|
|
|
|
|
|
|
|
|
$user['is_payment'] = 2;
|
|
|
|
|
$user['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($type == 0){//周结
|
|
|
|
|
$this->doPromoteUserPool($user,$users,$type,$stime,$recount);
|
|
|
|
|
}else{
|
|
|
|
|
$users['withdraw_type'] = 1;
|
|
|
|
|
$user['withdraw_type'] = 1;
|
|
|
|
|
//月结&补点
|
|
|
|
|
$this->doPromoteUserPool($user,$users,1,$stime,$recount);
|
|
|
|
|
$this->doPromoteUserPool($user,$users,2,$stime,$recount);
|
|
|
|
|
}
|
|
|
|
|
$this->savePromotateUserPool($users);
|
|
|
|
|
$this->savePromotateUserPool($user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 下游个人汇总单
|
|
|
|
|
*/
|
|
|
|
|
public function promoteUserPool($type,$stime,$recount = false)
|
|
|
|
|
public function doPromoteUserPool(&$user,&$users,$type,$stime,$recount = false)
|
|
|
|
|
{
|
|
|
|
|
$t = $this->setBeginAndEndTime($type,$stime);
|
|
|
|
|
$begintime = $t[0];
|
|
|
|
@ -718,33 +767,7 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
|
$RewardRecord = M("RewardRecord","tab_");
|
|
|
|
|
$LackStatement = M("company_lack_statement_info","tab_");
|
|
|
|
|
$StatementInfo = M("company_statement_info","tab_");
|
|
|
|
|
$basedata = [
|
|
|
|
|
"pay_amount"=>0,
|
|
|
|
|
"statement_money"=>0,
|
|
|
|
|
"lack_statement_money"=>0,
|
|
|
|
|
"withdraw_type"=>$type,
|
|
|
|
|
"platform_amount"=>0,
|
|
|
|
|
"create_lack_ids"=>[],
|
|
|
|
|
"del_lack_ids"=>[],
|
|
|
|
|
"statement_begin_time"=>$begintime,
|
|
|
|
|
"statement_end_time"=>$endtime,
|
|
|
|
|
"fine"=>0,
|
|
|
|
|
"reward"=>0,
|
|
|
|
|
"verify_status"=>0,
|
|
|
|
|
"company_type"=>2,
|
|
|
|
|
"verify_log"=>json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]),
|
|
|
|
|
"op_time"=>time()
|
|
|
|
|
];
|
|
|
|
|
$users = $user = $basedata;
|
|
|
|
|
$users['is_payment'] = 1;
|
|
|
|
|
$users['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
|
|
|
|
|
|
|
|
|
|
$user['is_payment'] = 2;
|
|
|
|
|
$user['statement_num'] = "PL_".date('Ymd').date('His').sp_random_num(3);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach($pc as $k=>&$v){
|
|
|
|
|
//获取其他信息
|
|
|
|
|
$v = $this->getCompanyOtherInfo($v,$k);
|
|
|
|
@ -916,15 +939,12 @@ class CompanyStatementSetController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this->savePromotateUserPool($users,$type);
|
|
|
|
|
$this->savePromotateUserPool($user,$type);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 保存信息汇总信息
|
|
|
|
|
*/
|
|
|
|
|
public function savePromotateUserPool($data){
|
|
|
|
|
if(empty($data['create_lack_ids']) && empty($data['del_lack_ids']) && empty($data['info_ids'])){ return;}
|
|
|
|
|
if($data['statement_money'] == 0 && $type ==2){ return;}
|
|
|
|
|
if($data['statement_money'] == 0){
|
|
|
|
|
$data['verify_status'] = 5;
|
|
|
|
|
$data['verify_log'] = json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s"),"verify_user"=>"system","verify_time"=>date("Y-m-d H:i:s"),"payment_user"=>"system","payment_time"=>date("Y-m-d H:i:s")]);
|
|
|
|
|