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

View File

@@ -325,16 +325,8 @@ class api extends control
return $this->sendSuccess(array('locate' => $this->createLink('api', 'index', "libID=$libID")));
}
$lib = fixer::input('post')
->join('groups', ',')
->join('users', ',')
->get();
if($lib->acl == 'private') $lib->users = $this->app->user->account;
if($lib->acl == 'custom' && strpos($lib->users, $this->app->user->account) === false) $lib->users .= ',' . $this->app->user->account;
/* save api doc library */
$libID = $this->doc->createApiLib($lib);
$libID = $this->doc->createApiLib();
if(dao::isError())
{
return $this->sendError(dao::getError());

View File

@@ -229,15 +229,16 @@ $lang->doc->ge = ':';
$lang->doc->point = '.';
$lang->doclib = new stdclass();
$lang->doclib->name = 'Name';
$lang->doclib->control = 'Access Control';
$lang->doclib->group = 'Group';
$lang->doclib->user = 'User';
$lang->doclib->files = 'Attachments';
$lang->doclib->all = 'All Libraries';
$lang->doclib->select = 'Select';
$lang->doclib->execution = $lang->executionCommon . ' Library';
$lang->doclib->product = $lang->productCommon . ' Library';
$lang->doclib->name = 'Name';
$lang->doclib->control = 'Access Control';
$lang->doclib->group = 'Group';
$lang->doclib->user = 'User';
$lang->doclib->files = 'Attachments';
$lang->doclib->all = 'All Libraries';
$lang->doclib->select = 'Select';
$lang->doclib->execution = $lang->executionCommon . ' Library';
$lang->doclib->product = $lang->productCommon . ' Library';
$lang->doclib->apiLibName = 'Api Library Name';
$lang->doclib->aclListA['default'] = 'Default';
$lang->doclib->aclListA['custom'] = 'Custom';

View File

@@ -229,15 +229,16 @@ $lang->doc->ge = '个';
$lang->doc->point = '、';
$lang->doclib = new stdclass();
$lang->doclib->name = '文档库名称';
$lang->doclib->control = '访问控制';
$lang->doclib->group = '分组';
$lang->doclib->user = '用户';
$lang->doclib->files = '附件库';
$lang->doclib->all = '所有文档库';
$lang->doclib->select = '选择文档库';
$lang->doclib->execution = $lang->executionCommon . '库';
$lang->doclib->product = $lang->productCommon . '库';
$lang->doclib->name = '文档库名称';
$lang->doclib->control = '访问控制';
$lang->doclib->group = '分组';
$lang->doclib->user = '用户';
$lang->doclib->files = '附件库';
$lang->doclib->all = '所有文档库';
$lang->doclib->select = '选择文档库';
$lang->doclib->execution = $lang->executionCommon . '库';
$lang->doclib->product = $lang->productCommon . '库';
$lang->doclib->apiLibName = '接口库名称';
$lang->doclib->aclListA['default'] = '默认';
$lang->doclib->aclListA['custom'] = '自定义';

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();
}