* Return id when create object by API.

This commit is contained in:
holan20180123
2021-05-12 17:33:59 +08:00
parent bfd4d6c323
commit 51af4491d9
14 changed files with 61 additions and 18 deletions
+8 -3
View File
@@ -1542,7 +1542,7 @@ class treeModel extends model
* @param int $rootID
* @param string $type
* @access public
* @return void
* @return array
*/
public function manageChild($rootID, $type)
{
@@ -1580,6 +1580,8 @@ class treeModel extends model
$parentPath = ',';
}
$i = 1;
$moduleIDList = array();
foreach($childs as $moduleID => $moduleName)
{
if(empty($moduleName)) continue;
@@ -1607,8 +1609,9 @@ class treeModel extends model
$module->type = $type;
$module->order = $order;
$this->dao->insert(TABLE_MODULE)->data($module)->exec();
$moduleID = $this->dao->lastInsertID();
$childPath = $parentPath . "$moduleID,";
$moduleID = $this->dao->lastInsertID();
$moduleIDList[] = $moduleID;
$childPath = $parentPath . "$moduleID,";
$this->dao->update(TABLE_MODULE)->set('path')->eq($childPath)->where('id')->eq($moduleID)->limit(1)->exec();
}
else
@@ -1619,6 +1622,8 @@ class treeModel extends model
$this->dao->update(TABLE_MODULE)->set('name')->eq(strip_tags(trim($moduleName)))->set('short')->eq($short)->set('order')->eq($order)->where('id')->eq($moduleID)->limit(1)->exec();
}
}
return $moduleIDList;
}
/**