From da20605d4b5b73ee05d2dd0ace216a5ddd974c60 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Thu, 11 May 2023 16:07:54 +0800 Subject: [PATCH] * Get the parent task ID from URL. --- module/task/control.php | 2 +- module/task/model.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index 9fe04e0100..4acaf7afb6 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -128,7 +128,7 @@ class task extends control /* 批量创建任务。 Batch create tasks. */ $postData = form::data($this->config->task->form->batchCreate); $tasks = $this->taskZen->prepareTasks4BatchCreate($execution, $postData->rawdata); - $taskIdList = $this->task->batchCreate($execution, $tasks, $output); + $taskIdList = $this->task->batchCreate($execution, $tasks, $taskID, $output); if(dao::isError()) return print(js::error(dao::getError())); /* 接口调用返回任务编号列表。 Return task id list when call the API. */ diff --git a/module/task/model.php b/module/task/model.php index c10555ab28..f568dced22 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -138,11 +138,12 @@ class taskModel extends model * * @param object $execution * @param array $tasks + * @param int $parentID * @param array $output * @access public * @return array|false */ - public function batchCreate(object $execution, array $tasks, array $output): array|false + public function batchCreate(object $execution, array $tasks, int $parentID, array $output): array|false { /* 检查必填项。 Check required fields. */ $tasks = $this->checkRequired4BatchCreate($execution, $tasks); @@ -153,8 +154,6 @@ class taskModel extends model $this->loadModel('score'); $this->loadModel('action'); - /* 判断创建的任务是不是由任务拆分而来。 Judge whether the created task is split from the task. */ - $parentID = !empty($tasks[1]->parent) ? $tasks[1]->parent : 0; $oldParentTask = $this->dao->findById((int)$parentID)->from(TABLE_TASK)->fetch(); $taskIdList = array();