From 2aac5c6aee96912215cf3dc2459cf5c33f88d1f8 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 23 May 2023 16:37:32 +0800 Subject: [PATCH] * Adjust annotations and data types. --- module/task/control.php | 11 ++++++----- module/task/model.php | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index 926172f068..4de956b27b 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -273,21 +273,22 @@ class task extends control } /** + * 批量更改任务所属模块。 * Batch change the module of task. * * @param int $moduleID * @access public * @return void */ - public function batchChangeModule($moduleID) + public function batchChangeModule(int $moduleID) { if($this->post->taskIDList) { - $taskIDList = $this->post->taskIDList; + $taskIDList = (array)$this->post->taskIDList; $taskIDList = array_unique($taskIDList); - unset($_POST['taskIDList']); $allChanges = $this->task->batchChangeModule($taskIDList, $moduleID); - if(dao::isError()) return print(js::error(dao::getError())); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + foreach($allChanges as $taskID => $changes) { $this->loadModel('action'); @@ -296,7 +297,7 @@ class task extends control } if(!dao::isError()) $this->loadModel('score')->create('ajax', 'batchOther'); } - return print(js::reload('parent')); + return $this->send(array('result' => 'success', 'load' => true)); } /** diff --git a/module/task/model.php b/module/task/model.php index 35a028e2b8..f8c45a0129 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -1119,6 +1119,7 @@ class taskModel extends model } /** + * 批量更改任务所属模块。 * Batch change the module of task. * * @param array $taskIdList @@ -1126,7 +1127,7 @@ class taskModel extends model * @access public * @return array */ - public function batchChangeModule($taskIdList, $moduleID) + public function batchChangeModule(array $taskIdList, int $moduleID): array { $now = helper::now(); $allChanges = array();