* Modify bug model create function.

This commit is contained in:
songchenxuan
2023-05-11 07:53:58 +00:00
committed by qixinzhi
parent 721c2f0840
commit bec69acdbf
2 changed files with 7 additions and 8 deletions
+3
View File
@@ -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);
+4 -8
View File
@@ -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;
}