fixed 后台在任务运行中删除了任务模板,导致结算出现异常

This commit is contained in:
chenbo 2023-11-24 13:46:20 +08:00
parent 0c54ba8c34
commit 13ae414917

View File

@ -22,6 +22,7 @@ use app\common\logic\ShopRequestLogic;
use app\common\logic\task_template\TaskTemplateLogic; use app\common\logic\task_template\TaskTemplateLogic;
use app\adminapi\validate\task_template\TaskTemplateValidate; use app\adminapi\validate\task_template\TaskTemplateValidate;
use app\common\model\Company; use app\common\model\Company;
use app\common\model\task\Task;
/** /**
@ -102,6 +103,10 @@ class TaskTemplateController extends BaseAdminController
public function delete() public function delete()
{ {
$params = (new TaskTemplateValidate())->post()->goCheck('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); TaskTemplateLogic::delete($params);
return $this->success('删除成功', [], 1, 1); return $this->success('删除成功', [], 1, 1);
} }