This commit is contained in:
hufangzhou
2022-03-22 10:14:18 +08:00
parent e91bf2520c
commit b3003228e0
4 changed files with 33 additions and 30 deletions
+12 -3
View File
@@ -196,20 +196,29 @@ class docModel extends model
/**
* creat a api doc library.
*
* @param stdClass $data form data.
* @return int
* @author thanatos thanatos915@163.com
*/
public function createApiLib($data)
public function createApiLib()
{
/* replace doc library name */
$this->lang->doclib->name = '接口库名称';
$this->lang->doclib->name = $this->lang->doclib->apiLibName;
$data = fixer::input('post')
->trim('name')
->join('groups', ',')
->join('users', ',')
->get();
if($data->acl == 'private') $data->users = $this->app->user->account;
if($data->acl == 'custom' && strpos($data->users, $this->app->user->account) === false) $data->users .= ',' . $this->app->user->account;
$data->type = static::DOC_TYPE_API;
$this->dao->insert(TABLE_DOCLIB)->data($data)->autoCheck()
->batchCheck($this->config->api->createlib->requiredFields, 'notempty')
->check('name', 'unique', "`type` = '" . static::DOC_TYPE_API . "'")
->exec();
return $this->dao->lastInsertID();
}