diff --git a/module/api/control.php b/module/api/control.php index 9dedd4e9dd..001e7bb419 100644 --- a/module/api/control.php +++ b/module/api/control.php @@ -32,7 +32,7 @@ class api extends control * @access public * @return void */ - public function index($libID = 0, $moduleID = 0, $apiID = 0, $version = 1) + public function index($libID = 0, $moduleID = 0, $apiID = 0, $version = 0) { /* Get all api doc libraries. */ $libs = $this->doc->getApiLibs(); @@ -150,7 +150,7 @@ class api extends control $this->action->create('api', $apiID, 'Edited'); $this->sendSuccess([ - 'locate' => helper::createLink('api', 'index', "apiID=$apiID"), + 'locate' => helper::createLink('api', 'index', "libID=0&moduleID=0&apiID=$apiID"), ]); exit; } @@ -206,7 +206,7 @@ class api extends control if(empty($apiID)) return $this->sendError(dao::getError()); $this->action->create('api', $apiID, 'Created'); - return $this->sendSuccess(array('locate' => helper::createLink('api', 'index', "apiID=$apiID"))); + return $this->sendSuccess(array('locate' => helper::createLink('api', 'index', "libID=0&moduleID=0&apiID=$apiID"))); } $libs = $this->doc->getLibs('api', '', $libID); @@ -272,7 +272,7 @@ class api extends control public function ajaxGetParamsTypeOptions($scope) { if(empty($scope)) die(); - $options = []; + $options = array(); if($scope == apiModel::SCOPE_BODY) { $options = $this->lang->api->allParamsTypeOptions; diff --git a/module/api/lang/zh-cn.php b/module/api/lang/zh-cn.php index 85c1696b63..77793088c8 100644 --- a/module/api/lang/zh-cn.php +++ b/module/api/lang/zh-cn.php @@ -39,6 +39,7 @@ $lang->api->module = '模块'; $lang->api->apiDoc = '接口'; $lang->api->manageType = '维护模块'; $lang->api->doing = '开发中'; +$lang->api->done = '开发完成'; $lang->api->basicInfo = '基本信息'; $lang->api->principal = '负责人'; $lang->api->apiDesc = '接口说明'; @@ -75,52 +76,52 @@ $lang->api->desc = '描述'; $lang->api->customType = '自定义结构'; $lang->api->format = '格式化'; $lang->api->methodOptions = [ - 'GET' => 'GET', - 'POST' => 'POST', - 'PUT' => 'PUT', - 'DELETE' => 'DELETE', - 'PATCH' => 'PATCH', + 'GET' => 'GET', + 'POST' => 'POST', + 'PUT' => 'PUT', + 'DELETE' => 'DELETE', + 'PATCH' => 'PATCH', 'OPTIONS' => 'OPTIONS', - 'HEAD' => 'HEAD' + 'HEAD' => 'HEAD' ]; $lang->api->protocalOptions = [ - 'HTTP' => 'HTTP', + 'HTTP' => 'HTTP', 'HTTPS' => 'HTTPS', ]; $lang->api->requestTypeOptions = [ - 'application/json' => 'application/json', + 'application/json' => 'application/json', 'application/x-www-form-urlencoded' => 'application/x-www-form-urlencoded', - 'multipart/form-data' => 'multipart/form-data' + 'multipart/form-data' => 'multipart/form-data' ]; $lang->api->statusOptions = [ - 'doing' => '开发中', - 'done' => '开发完成', + 'doing' => '开发中', + 'done' => '开发完成', 'hidden' => '不显示' ]; $lang->api->paramsScopeOptions = [ 'formData' => 'formData', - 'path' => 'path', - 'query' => 'query', - 'body' => 'body', - 'header' => 'header', - 'cookie' => 'cookie', + 'path' => 'path', + 'query' => 'query', + 'body' => 'body', + 'header' => 'header', + 'cookie' => 'cookie', ]; /* Api global common params */ $lang->api->paramsTypeOptions = [ - 'string' => 'string', - 'date' => 'date', + 'string' => 'string', + 'date' => 'date', 'datetime' => 'datetime', - 'boolean' => 'boolean', - 'int' => 'int', - 'long' => 'long', - 'float' => 'float', - 'double' => 'double', - 'decimal' => 'decimal' + 'boolean' => 'boolean', + 'int' => 'int', + 'long' => 'long', + 'float' => 'float', + 'double' => 'double', + 'decimal' => 'decimal' ]; /* Api params */ $lang->api->paramsTypeCustomOptions = [ - 'file' => 'file', - 'ref' => 'ref', + 'file' => 'file', + 'ref' => 'ref', 'custom' => '自定义' ]; $lang->api->allParamsTypeOptions = array_merge($lang->api->paramsTypeOptions, $lang->api->paramsTypeCustomOptions); diff --git a/module/api/model.php b/module/api/model.php index df5d2c1b7b..1862eadcf0 100644 --- a/module/api/model.php +++ b/module/api/model.php @@ -306,7 +306,7 @@ class apiModel extends model 'protocol' => $data->protocol, 'method' => $data->method, 'requestType' => $data->requestType, - 'responseType' => $data->responseType, + 'responseType' => isset($data->responseType) ? $data->responseType : '', 'status' => $data->status, 'owner' => $data->owner, 'desc' => $data->desc, diff --git a/module/api/view/content.html.php b/module/api/view/content.html.php index f23c44db18..e0b296e9f8 100644 --- a/module/api/view/content.html.php +++ b/module/api/view/content.html.php @@ -19,7 +19,7 @@ style='max-height:240px; max-width: 300px; overflow-y:auto'> version; $version > 0; $version--): ?>