小组服务任务

1下发单次任务时,将任务模板的任务累计进行天数+1,结算时用于判断任务是否超时
2任务结算时判断【其他任务】未完成的情况下,要刷新任务的开始结束时间。超时则关闭
This commit is contained in:
chenbo 2023-09-21 16:54:05 +08:00
parent d6ecaf63d9
commit c7587538b6
2 changed files with 52 additions and 10 deletions

View File

@ -79,6 +79,8 @@ class TaskLogic extends BaseLogic
if ($v['types'] == 3) {
$task = Task::where('template_id', $v['id'])->find();
if ($task) {
// 累计任务进行天数,单次任务结算时,用于判断任务是否超时
TaskTemplate::where('id', $v['id'])->inc('day_count')->update();
// Task::where('template_id', $v['id'])->update(['start_time' => strtotime($task['start_time']) + 86400, 'end_time' => strtotime($task['end_time']) + 86400]);
// TaskTemplate::where('id', $v['id'])->inc('day_count')->update();
return true;
@ -400,7 +402,7 @@ class TaskLogic extends BaseLogic
self::dealTownTask1($taskSchedulePlan);
break;
case 'town_task_type_2':
// 协助总负责人开展工作任务
// 协助总负责人开展工作任务 单次任务 周期内未完成要刷新任务的时间
self::dealTownTask2($taskSchedulePlan);
break;
case 'town_task_type_3':
@ -474,6 +476,24 @@ class TaskLogic extends BaseLogic
{
$taskTemplateInfo = $taskSchedulePlan['template_info'];
$taskScheduleInfo = $taskSchedulePlan['scheduling'];
$day = $taskTemplateInfo['stage_day_one'] + $taskTemplateInfo['stage_day_two'];
if($taskTemplateInfo['day_count']>$day){
Task::where('id', $taskSchedulePlan['task_id'])->update(['status' =>5]);
Log::info($taskTemplateInfo['title'] . '结算失败,任务为超时:' . json_encode($taskSchedulePlan));
return false;
}
$task = Task::where('id', $taskSchedulePlan['task_id'])->field('director_uid,status,money,start_time,end_time')->with('director_info')->find();
if($taskTemplateInfo['day_count'] <= $day){
TaskSchedulingPlan::where('id', $taskSchedulePlan['id'])->update(['is_pay' => 0]);
try{
Task::where('id', $taskSchedulePlan['task_id'])->update(['create_time' => $task['start_time']+86400,'update_time' =>time(),'start_time'=>$task['start_time']+86400,'end_time'=>$task['start_time']+86400+86399]);
}catch(\Exception $e){
$start_time = strtotime(date('Y-m-d'));
Task::where('id', $taskSchedulePlan['task_id'])->update(['create_time' => $start_time+86400,'update_time' =>time(),'start_time'=>$start_time+86400,'end_time'=> $start_time + 86400+86399]);
}
}
}
private static function dealTownTask3($taskSchedulePlan)

View File

@ -93,6 +93,11 @@ class TaskInformationJob
$arr['money'] = $task_35['money'];
$arr['company_account_type'] = 2;
}else{
/**
* 判断入股任务 单次类型 是否超时
* 未超时时刷新开始结束时间
* 超时则关闭
*/
if($data['template_info']['day_count']<=$day){
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 0]);
try{
@ -100,10 +105,10 @@ class TaskInformationJob
}catch(\Exception $e){
$start_time = strtotime(date('Y-m-d'));
Task::where('id', $data['task_id'])->update(['create_time' => $start_time+86400,'update_time' =>time(),'start_time'=>$start_time+86400,'end_time'=> $start_time + 86400+86399]);
}
return false;
}
if($data['template_info']['day_count']>$day){
Task::where('id', $data['task_id'])->update(['status' =>5]);
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
@ -117,15 +122,32 @@ class TaskInformationJob
}
else {
//其他类型任务
$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('其他任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
Task::where('id', $data['task_id'])->update(['status' => 5]);
return false;
$task = Task::where('id', $data['task_id'])->with('director_info')->find();
if ($task['status'] == 3) {
$name = $task['director_info']['nickname'];
$arr['status'] = 1;
$arr['money'] = $task['money'];
} else if ($task['status'] == 2) {
// 是否超时
$day= $data['template_info']['stage_day_one'] + $data['template_info']['stage_day_two'];
if($data['template_info']['day_count'] >= $day){
Task::where('id', $data['task_id'])->update(['status' =>5]);
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
return false;
}
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['start_time']+86400,'update_time' =>time(),'start_time'=>$task['start_time']+86400,'end_time'=>$task['start_time']+86400+86399]);
}catch(\Exception $e){
$start_time = strtotime(date('Y-m-d'));
Task::where('id', $data['task_id'])->update(['create_time' => $start_time+86400,'update_time' =>time(),'start_time'=>$start_time+86400,'end_time'=> $start_time + 86400+86399]);
}
return false;
}
}
$name = $task_count['director_info']['nickname'];
$arr['status'] = 1;
$arr['money'] = $task_count['money'];
}
} catch (\Exception $e) {
Log::error('line:'.$e->getLine().'异常报错:任务结算失败:' . $data['template_info']['title'] . $e->getMessage() . json_encode($data));