This commit is contained in:
yaooo 2023-11-24 14:00:44 +08:00
commit 55aa3159ee
2 changed files with 19 additions and 1 deletions
app
adminapi/controller/task_template
api/controller

@ -22,6 +22,7 @@ use app\common\logic\ShopRequestLogic;
use app\common\logic\task_template\TaskTemplateLogic;
use app\adminapi\validate\task_template\TaskTemplateValidate;
use app\common\model\Company;
use app\common\model\task\Task;
/**
@ -102,6 +103,10 @@ class TaskTemplateController extends BaseAdminController
public function delete()
{
$params = (new TaskTemplateValidate())->post()->goCheck('delete');
$task = Task::where(['template_id' =>$params['id']])->whereDay('start_time', 'today')->find();
if(!empty($task)) {
$this->fail('该任务今天已在进行中,无法删除');
}
TaskTemplateLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}

@ -62,14 +62,19 @@ class CronController extends BaseApiController
*/
public function settlement(){
// $all=TaskSchedulingPlan::where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
$all = TaskSchedulingPlan::whereDay('end_time','today')
$all = TaskSchedulingPlan::whereDay('end_time','yesterday')
->withJoin(['scheduling'], 'left')
->where('scheduling.company_type', 18)
->where('is_pay',0)
->with(['template_info'])
->select()
->toArray();
foreach($all as $k=>$v){
// 任务运行中,后台删除了任务模板
if (empty($v['template_info'])) {
continue;
}
queue(TaskInformationJob::class,$v);
}
Log::info('小组服务公司定时任务结算执行成功'.date('Y-m-d H:i:s'));
@ -128,6 +133,10 @@ class CronController extends BaseApiController
->select()
->toArray();
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
// 任务运行中,后台删除了任务模板
if (empty($taskSchedulingPlan['template_info'])) {
continue;
}
queue(VillageTaskSettlementJob::class, $taskSchedulingPlan);
}
Log::info('村管理公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
@ -185,6 +194,10 @@ class CronController extends BaseApiController
->select()
->toArray();
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
// 任务运行中,后台删除了任务模板
if (empty($taskSchedulingPlan['template_info'])) {
continue;
}
// 解耦 三个角色分开结算,避免某个角色的结算逻辑出现异常,导致整个镇农科公司的任务结算都终止
$taskTemplateInfo = $taskSchedulingPlan['template_info'];
// 负责人任务结算