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