修复结算错误

This commit is contained in:
mkm 2023-09-09 09:46:59 +08:00
parent cd910e865d
commit 4532cfabcf

View File

@ -51,25 +51,19 @@ class TaskInformationJob
return false;
}
$transaction_pool=$data['template_info']['transaction_pool'];//交易金额剩余池
if(bcadd($shang_date_total_price['arr']['total_price'],$transaction_pool,2)>$shang_date_total_price['arr']['day_money']){
if($shang_date_total_price['arr']['total_price']>$shang_date_total_price['arr']['day_money']){
$day_money=bcsub($shang_date_total_price['arr']['total_price'],$shang_date_total_price['arr']['day_money'],2);//当天还剩多少
$shang_date_total_price['arr']['supplement']=$day_money;
$transaction_pool=bcadd($transaction_pool,$day_money,2);
}else{
$shang_date_total_price['arr']['supplement']=0;
$shang_date_total_price['arr']['after_transaction_pool']=0;
$day_money=0;
$transaction_pool=bcadd($transaction_pool,$shang_date_total_price['arr']['total_price'],2);
$transaction_pool=bcsub($transaction_pool,$shang_date_total_price['arr']['day_money'],2);
if($transaction_pool<0){
$transaction_pool=0;
}
}
$shang_date_total_price['arr']['before_transaction_pool']=$day_money;
Task::where('id', $data['task_id'])->update(['status' => 3,'extend'=>json_encode($shang_date_total_price)]);
TaskTemplate::where('id',$data['template_info']['id'])->update(['transaction_pool'=>$transaction_pool]);
$count_money=bcadd($shang_date_total_price['arr']['total_price'],$transaction_pool,2);
if($count_money>$shang_date_total_price['arr']['day_money']){
$day_money=bcsub($count_money,$shang_date_total_price['arr']['day_money'],2);//当计算剩余池before_transaction_pool
$shang_date_total_price['arr']['before_transaction_pool']=$transaction_pool;//变化前
$shang_date_total_price['arr']['after_transaction_pool']=$day_money;//变化后
Task::where('id', $data['task_id'])->update(['status' => 3,'extend'=>json_encode(['transaction'=>$shang_date_total_price])]);
TaskTemplate::where('id',$data['template_info']['id'])->update(['transaction_pool'=>$day_money]);
$shang_date_total_price['arr']['status']=1;
}else{
Log::info('交易金额任务,交易金额小于今日金额:' . json_encode($data));
Task::where('id', $data['task_id'])->update(['status' => 5]);
return false;
}
$name = $shang_date_total_price['name'];
$arr['status'] = $shang_date_total_price['arr']['status'];
@ -100,7 +94,7 @@ class TaskInformationJob
$arr['company_account_type'] = 2;
}else{
if($data['template_info']['day_count']<=$day){
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 0]);
try{
Task::where('id', $data['task_id'])->update(['create_time' => $task_35['start_time']+86400,'update_time' =>time(),'start_time'=>$task_35['start_time']+86400,'end_time'=>$task_35['start_time']+86400+86399]);
}catch(\Exception $e){