From 7cb8d3908c8e22032d896e71986746c9fc6b2b71 Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 24 Aug 2023 16:44:57 +0800 Subject: [PATCH] * testcase: refactor the batchChangeModule method. --- module/testcase/control.php | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/module/testcase/control.php b/module/testcase/control.php index 5abc381a1a..dde1cd0f5f 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -938,36 +938,15 @@ class testcase extends control */ public function batchChangeModule($moduleID) { - if($this->post->caseIdList) + $caseIdList = zget($_POST, 'caseIdList', array()); + $sceneIdList = zget($_POST, 'sceneIdList', array()); + if($caseIdList || $sceneIdList) { - $caseIdList = $this->post->caseIdList; - $caseIdList = array_unique($caseIdList); - unset($_POST['caseIdList']); - $allChanges = $this->testcase->batchChangeModule($caseIdList, $moduleID); + $this->testcase->batchChangeModule($caseIdList, $sceneIdList, $moduleID); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - - if (!empty($allChanges[1])) - { - foreach($allChanges[1] as $caseID => $changes) - { - $this->loadModel('action'); - $actionID = $this->action->create('case', $caseID, 'Edited'); - $this->action->logHistory($actionID, $changes); - } - } - - if (!empty($allChanges[0])) - { - foreach($allChanges[0] as $sceneID => $changes) - { - $this->loadModel('action'); - $actionID = $this->action->create('scene', $sceneID, 'Edited'); - $this->action->logHistory($actionID, $changes); - } - } } - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'load' => $this->session->caseList)); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => $this->session->caseList)); } /**