diff --git a/module/bug/control.php b/module/bug/control.php index f55a3246b5..d7c70ed958 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -213,8 +213,7 @@ class bug extends control $this->bugZen->checkExistBug($bug); - $action = $from == 'sonarqube' ? 'fromSonarqube' : 'Opened'; - $bugID = $this->bug->create($bug, $action); + $bugID = $this->bug->create($bug, $from); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $bug->id = $bugID; diff --git a/module/bug/model.php b/module/bug/model.php index 23e44b0a98..a11ba95d14 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -47,14 +47,15 @@ class bugModel extends model } /** - * bug的入库操作。 + * bug 的入库操作。 * Insert bug into zt_bug. * - * @param object $bug + * @param object $bug + * @param string $from * @access public * @return int|false */ - public function create(object $bug, string $action = 'Opened'): int|false + public function create(object $bug, string $from): int|false { $this->dao->insert(TABLE_BUG)->data($bug, 'laneID') ->autoCheck() @@ -67,6 +68,7 @@ class bugModel extends model $bugID = $this->dao->lastInsertID(); + $action = $from == 'sonarqube' ? 'fromSonarqube' : 'Opened'; $this->loadModel('action')->create('bug', $bugID, $action); /* Add score for create. */