* Get the parent task ID from URL.

This commit is contained in:
hufangzhou
2023-05-11 16:07:54 +08:00
parent 6701df6ac4
commit da20605d4b
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -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. */
+2 -3
View File
@@ -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();