fix code style
This commit is contained in:
@@ -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;
|
||||
|
||||
+27
-26
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
style='max-height:240px; max-width: 300px; overflow-y:auto'>
|
||||
<?php for($version = $api->version; $version > 0; $version--): ?>
|
||||
<li><a href='javascript:void(0)'
|
||||
data-url='<?php echo $this->createLink('api', 'index', "apiID=$apiID&version=$version"); ?>'>#<?php echo $version; ?></a>
|
||||
data-url='<?php echo $this->createLink('api', 'index', "libID=0&moduleID=0&apiID=$apiID&version=$version"); ?>'>#<?php echo $version; ?></a>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<?php if($edit): ?>
|
||||
<h2>
|
||||
<span class='label label-id'><?php echo $api->id;?></span>
|
||||
<?php echo html::a($this->createLink('api', 'index', "apiID=$api->id"), $api->title, '', "title='$api->title'");?>
|
||||
<?php echo html::a($this->createLink('api', 'index', "libID=0&moduleID=0&apiID=$api->id"), $api->title, '', "title='$api->title'");?>
|
||||
<small> <?php echo $lang->arrow . ' ' . $lang->api->edit;?></small>
|
||||
</h2>
|
||||
<div
|
||||
@@ -64,21 +64,21 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->formTitle; ?></th>
|
||||
<td colspan='2'><?php echo html::input('title', $api->title, "class='form-control' required"); ?></td>
|
||||
<td colspan='2'><?php echo html::input('title', '', "class='form-control' required"); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->path; ?></th>
|
||||
<td colspan='2'><?php echo html::input('path', $api->path, "class='form-control'"); ?></td>
|
||||
<td colspan='2'><?php echo html::input('path', '', "class='form-control'"); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->protocol; ?></th>
|
||||
<td><?php echo html::radio('protocol', $lang->api->protocalOptions, $api->protocol ? $api->protocol : 'HTTP'); ?></td>
|
||||
<td><?php echo html::radio('protocol', $lang->api->protocalOptions, 'HTTP'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->method; ?></th>
|
||||
<td>
|
||||
<span
|
||||
id='moduleBox'><?php echo html::select('method', $lang->api->methodOptions, $api->method ? $api->method : 'GET', "class='form-control chosen'"); ?></span>
|
||||
id='moduleBox'><?php echo html::select('method', $lang->api->methodOptions, 'GET', "class='form-control chosen'"); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -146,13 +146,13 @@
|
||||
<div class='col-md-3 col-lg-2'>
|
||||
<div class="table-row">
|
||||
<span class='input-group-addon w-60px'><?php echo $lang->api->default; ?></span>
|
||||
<?php echo html::input('params[0][default]', $param->default, "class='form-control'"); ?>
|
||||
<?php echo html::input('params[0][default]', $param['default'], "class='form-control'"); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-3 col-lg-2'>
|
||||
<div class="table-row">
|
||||
<span class='input-group-addon w-50px'><?php echo $lang->api->desc; ?></span>
|
||||
<?php echo html::textarea('params[0][desc]', $param->desc, "class='form-control' style='height:32px'"); ?>
|
||||
<?php echo html::textarea('params[0][desc]', $param['desc'], "class='form-control' style='height:32px'"); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-3 col-lg-2'>
|
||||
|
||||
@@ -73,9 +73,9 @@
|
||||
<?php foreach($apiList as $api): ?>
|
||||
<li class="list-group-item">
|
||||
<div class="heading <?php echo $api->method;?>">
|
||||
<a href="<?php echo helper::createLink('api', 'index', 'apiID='. $api->id) ?>">
|
||||
<a href="<?php echo helper::createLink('api', 'index', 'libID=0&moduleID=0&apiID='. $api->id) ?>">
|
||||
<span class="label label-primary"><?php echo $api->method; ?></span>
|
||||
<span class="label label-warning"><?php echo apiModel::getApiStatusText($api->status); ?></span>
|
||||
<span class="label label-warning" style="width: 60px"><?php echo apiModel::getApiStatusText($api->status); ?></span>
|
||||
<span class="path"><?php echo $api->path; ?></span>
|
||||
<span class="desc"><?php echo $api->title; ?></span>
|
||||
</a>
|
||||
|
||||
@@ -2180,7 +2180,7 @@ EOT;
|
||||
{
|
||||
$treeMenu[0] .= '<li' . ($doc->id == $docID ? ' class="active"' : ' class="independent"') . '>';
|
||||
|
||||
$treeMenu[0] .= html::a(inlink('index', "apiID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> " . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title' title='{$doc->title}'");
|
||||
$treeMenu[0] .= html::a(inlink('index', "libID=0&moduelID=0&apiID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> " . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title' title='{$doc->title}'");
|
||||
|
||||
$treeMenu[0] .= '</li>';
|
||||
}
|
||||
@@ -2296,7 +2296,7 @@ EOT;
|
||||
{
|
||||
$treeMenu[$module->id] .= '<li' . ($doc->id == $docID ? ' class="active"' : ' class="doc"') . '>';
|
||||
|
||||
$treeMenu[$module->id] .= html::a(inlink('index', "apiID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> " . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title' title='{$doc->title}'");
|
||||
$treeMenu[$module->id] .= html::a(inlink('index', "libID=0&moduleID=0&apiID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> " . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title' title='{$doc->title}'");
|
||||
|
||||
$treeMenu[$module->id] .= '</li>';
|
||||
}
|
||||
@@ -2318,7 +2318,7 @@ EOT;
|
||||
|
||||
if($type == static::DOC_TYPE_API)
|
||||
{
|
||||
$li = html::a(inlink('index', "libID=$libID&module={$module->id}"), $module->name, '', "data-app='{$this->app->tab}' class='doc-title' title='{$module->name}'");
|
||||
$li = html::a(inlink('index', "libID=$libID&moduleID={$module->id}"), $module->name, '', "data-app='{$this->app->tab}' class='doc-title' title='{$module->name}'");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2340,7 +2340,8 @@ EOT;
|
||||
if($type == static::DOC_TYPE_API)
|
||||
{
|
||||
$params = $_GET;
|
||||
if(intval($params['module']) > 0 && $params['module'] == $module->id)
|
||||
$moduleID = isset($params['moduleID']) ? $params['moduleID'] : 0;
|
||||
if($moduleID && $moduleID == $module->id)
|
||||
{
|
||||
array_push($class, 'active');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user