* Return id when create object by API.

This commit is contained in:
holan20180123
2021-05-12 16:08:50 +08:00
parent c5ac6e1bbe
commit fcb0176f3c
3 changed files with 10 additions and 7 deletions
+2 -1
View File
@@ -57,8 +57,9 @@ class group extends control
{
if(!empty($_POST))
{
$this->group->create();
$groupID = $this->group->create();
if(dao::isError()) die(js::error(dao::getError()));
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $groupID));
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('group', 'browse'), 'parent'));
}
+4 -3
View File
@@ -61,8 +61,9 @@ class jenkins extends control
{
if($_POST)
{
$this->jenkins->create();
$jenkinsID = $this->jenkins->create();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $jenkinsID));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
@@ -116,8 +117,8 @@ class jenkins extends control
/**
* Ajax get tasks.
*
* @param int $id
*
* @param int $id
* @access public
* @return void
*/
+4 -3
View File
@@ -60,8 +60,8 @@ class jenkinsModel extends model
/**
* Get jenkins tasks.
*
* @param int $id
*
* @param int $id
* @access public
* @return array
*/
@@ -107,7 +107,8 @@ class jenkinsModel extends model
->batchCheck("url", 'URL')
->autoCheck()
->exec();
return !dao::isError();
if(dao::isError()) return false;
return $this->dao->lastInsertId();
}
/**