更新
This commit is contained in:
parent
9669673fec
commit
b7d65315c6
@ -31,19 +31,21 @@ class TaskInformationJob
|
||||
//信息更新
|
||||
if ($data['template_info']['type'] == 31) {
|
||||
if ($data['template_info']['information_count'] < $data['template_info']['information_day_count']) {
|
||||
Log::info('任务结算失败,信息更新未达到要求:' . json_encode($data));
|
||||
Log::info('信息更新任务,信息更新未达到要求:' . json_encode($data));
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5]);
|
||||
return false;
|
||||
}
|
||||
$name = '小组队长';
|
||||
$arr['status'] = 1;
|
||||
$task = Task::where('id', $data['task_id'])->field('director_uid,money')->where('status', 3)->find();
|
||||
$arr['money'] = $task['money'];
|
||||
Task::where('id', $data['task_id'])->update(['status' => 3]);
|
||||
} elseif
|
||||
//交易金额
|
||||
($data['template_info']['type'] == 33) {
|
||||
$shang_date_total_price = App(RemoteController::class)->shang_date_total_price($company);
|
||||
if ($shang_date_total_price == false) {
|
||||
Log::info('任务结算失败,交易金额未达到要求:' . json_encode($data));
|
||||
Log::info('交易金额任务,交易金额未达到要求:' . json_encode($data));
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5]);
|
||||
return false;
|
||||
}
|
||||
@ -52,30 +54,34 @@ class TaskInformationJob
|
||||
}
|
||||
$name = $shang_date_total_price['name'];
|
||||
$arr['status'] = $shang_date_total_price['arr']['status'];
|
||||
$task = Task::where('id', $data['task_id'])->field('money')->find();
|
||||
$arr['money'] = $task['money'];
|
||||
} elseif
|
||||
//三轮车
|
||||
($data['template_info']['type'] == 32){
|
||||
$task = Task::where('id', $data['task_id'])->field('director_uid')->where('status', 3)->with('director_info')->find();
|
||||
$task = Task::where('id', $data['task_id'])->field('director_uid,money')->where('status', 3)->with('director_info')->find();
|
||||
if(empty($task)){
|
||||
Log::info('三轮车任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5]);
|
||||
return true;
|
||||
}
|
||||
$name=$task['director_info']['nickname'];
|
||||
$arr['status'] = 1;
|
||||
$arr['money'] = $task['money'];
|
||||
}
|
||||
else {
|
||||
//其他类型任务
|
||||
$task_count = Task::where('id', $data['task_id'])->field('director_uid')->where('status', 3)->with('director_info')->find();
|
||||
$task_count = Task::where('id', $data['task_id'])->field('director_uid,money')->where('status', 3)->with('director_info')->find();
|
||||
if (empty($task_count)) {
|
||||
Log::info('列105 任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
|
||||
Log::info('其他任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5]);
|
||||
return false;
|
||||
}
|
||||
$name = $task_count['director_info']['nickname'];
|
||||
$arr['status'] = 1;
|
||||
$arr['money'] = $task_count['money'];
|
||||
}
|
||||
|
||||
$arr['money'] = $data['template_info']['money'];
|
||||
$arr['company_id'] = $data['scheduling']['company_id'];
|
||||
$arr['msg'] = '来自任务【' . $data['template_info']['title'] . '】,完成方:' . $name . ',任务结算';
|
||||
$arr['proportion_one'] = $data['template_info']['proportion_one'];
|
||||
@ -83,14 +89,14 @@ class TaskInformationJob
|
||||
$arr['sn'] = $data['sn'];
|
||||
$arr['id'] = $data['id'];
|
||||
} catch (\Exception $e) {
|
||||
Log::info('列122 任务结算失败:' . $data['template_info']['title'] . $e->getMessage() . json_encode($data));
|
||||
Log::error('异常报错:任务结算失败:' . $data['template_info']['title'] . $e->getMessage() . json_encode($data));
|
||||
return false;
|
||||
}
|
||||
if ($arr['status'] == 1) {
|
||||
(new ShareProfit())->first($arr, $company);
|
||||
} else {
|
||||
Task::where('id', $data['task_id'])->update(['status' => 5,'extend'=>json_encode($shang_date_total_price)]);
|
||||
Log::info('89-任务结算失败:' . $data['template_info']['title'] . '未完成' . json_encode($data));
|
||||
Log::info('任务status=0结算失败:' . $data['template_info']['title'] . '未完成' . json_encode($data));
|
||||
}
|
||||
//如果任务执行成功后 记得删除任务,不然这个任务会重复执行,直到达到最大重试次数后失败后,执行failed方法
|
||||
$job->delete();
|
||||
|
@ -16,8 +16,8 @@ class TaskCron extends Task
|
||||
|
||||
public function configure()
|
||||
{
|
||||
$this->daily(); //设置任务的周期,每天执行一次,更多的方法可以查看源代码,都有注释
|
||||
// $this->everyMinute();//每分钟
|
||||
// $this->daily(); //设置任务的周期,每天执行一次,更多的方法可以查看源代码,都有注释
|
||||
$this->everyMinute();//每分钟
|
||||
}
|
||||
/**
|
||||
* 执行任务
|
||||
@ -45,8 +45,8 @@ class TaskCron extends Task
|
||||
foreach ($v['template'] as $kk => $vv) {
|
||||
queue(TaskAdd::class,['data'=>$vv,'data_two'=>$v]);
|
||||
}
|
||||
$company_id[] = $v['company_id'];
|
||||
}
|
||||
$company_id[] = $v['company_id'];
|
||||
Company::where('id', 'in', $company_id)->inc('day_count')->update();
|
||||
TaskScheduling::where('id', 'in', $plan_ids)->update(['cron_time' => time()]);
|
||||
Log::error('定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
|
@ -25,7 +25,7 @@ class TaskSettlementCron extends Task{
|
||||
foreach($all as $k=>$v){
|
||||
queue(TaskInformationJob::class,$v);
|
||||
}
|
||||
Log::error('定时任务结算执行成功'.date('Y-m-d H:i:s'));
|
||||
Log::info('定时任务结算执行成功'.date('Y-m-d H:i:s'));
|
||||
|
||||
//...具体的任务执行
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user