From bec69acdbf093b222a9ac767df1a8bb2a0dae484 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Thu, 11 May 2023 09:47:32 +0800 Subject: [PATCH] * Modify bug model create function. --- module/bug/control.php | 3 +++ module/bug/model.php | 12 ++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 1c136d60b8..14ddc6537e 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -345,6 +345,9 @@ class bug extends control $checkExist = $this->bugZen->checkExistBug($bug); if($checkExist['status'] == 'exists') $this->send(array('result' => 'success', 'id' => $checkExist['id'], 'message' => sprintf($this->lang->duplicate, $this->lang->bug->common), 'locate' => $this->createLink('bug', 'view', "bugID={$checkExist['id']}"))); + $bugID = $this->bug->create($bug); + if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); + /* Set from param if there is a object to transfer bug. */ setcookie('lastBugModule', (int)$formData->data->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); diff --git a/module/bug/model.php b/module/bug/model.php index 62854a42b4..8ff9bfb7fa 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -47,14 +47,14 @@ class bugModel extends model } /** + * bug的入库操作。 * Insert bug into zt_bug. - * bug的入库操作 * * @param object $bug * @access public - * @return array|false + * @return int|false */ - public function create(object $bug): array|false + public function create(object $bug): int|false { $this->dao->insert(TABLE_BUG)->data($bug) ->autoCheck() @@ -63,11 +63,7 @@ class bugModel extends model ->checkFlow() ->exec(); - if(!dao::isError()) - { - $bugID = $this->dao->lastInsertID(); - return array('status' => 'created', 'id' => $bugID); - } + if(!dao::isError()) return $this->dao->lastInsertID(); return false; }