优化补点

master
chenzhi 4 years ago
parent 859f5b58c9
commit 6ce7377dc1

@ -1456,10 +1456,12 @@ class CompanyStatementSetController extends Controller {
"statement_info"=>json_encode($v['statement_info'],JSON_UNESCAPED_UNICODE)
];
}
//无需补点不统计其他金额
if($type == 2 && $v['statement_money'] == 0){
continue ;
}
//聚合未结算数据
$lsres = $LackStatement->where("company_id='{$k}' and is_pool = 0")->select();
// dd($lsres);
$del_lack_ids = [];
if(count($lsres) > 0){
//进行聚合
@ -1492,52 +1494,48 @@ class CompanyStatementSetController extends Controller {
if($v['platform_amount'] == 0 && $v['statement_money'] == 0){
continue ;
}
if($type == 2 && $v['statement_money'] == 0){
//补点不存
if($v['platform_amount'] < 300){
//存未满
// if($lackcompany['pay_amount'] != 0){
$lask_id = $LackStatement->add($lackcompany);
$countdata['create_lack_ids'][] =$lask_id;
$countdata['lack_statement_money'] +=$lackcompany['statement_money'];
$countdata['lack_platform_amount'] +=$lackcompany['platform_amount'];
// }
}else{
if($v['platform_amount'] < 300){
//存未满
// if($lackcompany['pay_amount'] != 0){
$lask_id = $LackStatement->add($lackcompany);
$countdata['create_lack_ids'][] =$lask_id;
$countdata['lack_statement_money'] +=$lackcompany['statement_money'];
$countdata['lack_platform_amount'] +=$lackcompany['platform_amount'];
// }
}else{
// if($v['pay_amount'] != 0){
//存成功配置单号
$company =[
"pool_id"=>0,
"company_id"=>$k,
"company_type"=>2,
"company_name"=>$v['partner'],
"company_info"=>json_encode($company_info,JSON_UNESCAPED_UNICODE),
"statement_money"=>$v['statement_money'],
"pay_amount"=>$v['pay_amount'],
"platform_amount"=>$v['platform_amount'],
"fine"=>$v['fine'],
"reward"=>$v['reward'],
"statement_begin_time"=>$begintime,
"statement_end_time"=>$endtime,
"statement_info"=>json_encode($v['statement_info'],JSON_UNESCAPED_UNICODE),
"statement_num"=>"JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5)
];
if($v['is_payment'] == 1){
$company['verify_status'] = 0;
}else{
$company['verify_status'] = 2;
}
$companyid = $StatementInfo->add($company);
$countdata['info_ids'][] =$companyid;
$countdata['del_lack_ids'] =array_merge($countdata['del_lack_ids'],$del_lack_ids);
$countdata['statement_money'] +=$v['statement_money'];
$countdata['pay_amount'] +=$v['pay_amount'];
$countdata['platform_amount'] +=$v['platform_amount'];
$countdata['fine'] +=$v['fine'];
$countdata['reward'] +=$v['reward'];
// }
}
// if($v['pay_amount'] != 0){
//存成功配置单号
$company =[
"pool_id"=>0,
"company_id"=>$k,
"company_type"=>2,
"company_name"=>$v['partner'],
"company_info"=>json_encode($company_info,JSON_UNESCAPED_UNICODE),
"statement_money"=>$v['statement_money'],
"pay_amount"=>$v['pay_amount'],
"platform_amount"=>$v['platform_amount'],
"fine"=>$v['fine'],
"reward"=>$v['reward'],
"statement_begin_time"=>$begintime,
"statement_end_time"=>$endtime,
"statement_info"=>json_encode($v['statement_info'],JSON_UNESCAPED_UNICODE),
"statement_num"=>"JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5)
];
if($v['is_payment'] == 1){
$company['verify_status'] = 0;
}else{
$company['verify_status'] = 2;
}
$companyid = $StatementInfo->add($company);
$countdata['info_ids'][] =$companyid;
$countdata['del_lack_ids'] =array_merge($countdata['del_lack_ids'],$del_lack_ids);
$countdata['statement_money'] +=$v['statement_money'];
$countdata['pay_amount'] +=$v['pay_amount'];
$countdata['platform_amount'] +=$v['platform_amount'];
$countdata['fine'] +=$v['fine'];
$countdata['reward'] +=$v['reward'];
// }
}
}
}

Loading…
Cancel
Save