diff --git a/app/adminapi/controller/task_template/TaskTemplateController.php b/app/adminapi/controller/task_template/TaskTemplateController.php index d4c2cef3c..a90c397ea 100644 --- a/app/adminapi/controller/task_template/TaskTemplateController.php +++ b/app/adminapi/controller/task_template/TaskTemplateController.php @@ -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); }