diff --git a/application/admin/command/Api.php b/application/admin/command/Api.php index ab449127..2c719842 100644 --- a/application/admin/command/Api.php +++ b/application/admin/command/Api.php @@ -23,9 +23,10 @@ class Api extends Command ->addOption('template', 'e', Option::VALUE_OPTIONAL, '', 'index.html') ->addOption('force', 'f', Option::VALUE_OPTIONAL, 'force override general file', false) ->addOption('title', 't', Option::VALUE_OPTIONAL, 'document title', $site['name']) - ->addOption('author', 'a', Option::VALUE_OPTIONAL, 'document author', $site['name']) ->addOption('class', 'c', Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'extend class', null) ->addOption('language', 'l', Option::VALUE_OPTIONAL, 'language', 'zh-cn') + ->addOption('addon', 'a', Option::VALUE_OPTIONAL, 'addon name', null) + ->addOption('controller', 'r', Option::VALUE_REQUIRED | Option::VALUE_IS_ARRAY, 'controller name', null) ->setDescription('Build Api document from controller'); } @@ -58,12 +59,21 @@ class Api extends Command $classes = $input->getOption('class'); // 标题 $title = $input->getOption('title'); - // 作者 - $author = $input->getOption('author'); // 模块 $module = $input->getOption('module'); + // 插件 + $addon = $input->getOption('addon'); - $moduleDir = APP_PATH . $module . DS; + $moduleDir = $addonDir = ''; + if ($addon) { + $addonInfo = get_addon_info($addon); + if (!$addonInfo) { + throw new Exception('addon not found'); + } + $moduleDir = ADDON_PATH . $addon . DS; + } else { + $moduleDir = APP_PATH . $module . DS; + } if (!is_dir($moduleDir)) { throw new Exception('module not found'); } @@ -81,31 +91,44 @@ class Api extends Command } } - $controllerDir = $moduleDir . Config::get('url_controller_layer') . DS; - $files = new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($controllerDir), - \RecursiveIteratorIterator::LEAVES_ONLY - ); + //控制器名 + $controller = $input->getOption('controller') ?: []; + if (!$controller) { + $controllerDir = $moduleDir . Config::get('url_controller_layer') . DS; + $files = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($controllerDir), + \RecursiveIteratorIterator::LEAVES_ONLY + ); - foreach ($files as $name => $file) { - if (!$file->isDir() && $file->getExtension() == 'php') { - $filePath = $file->getRealPath(); + foreach ($files as $name => $file) { + if (!$file->isDir() && $file->getExtension() == 'php') { + $filePath = $file->getRealPath(); + $classes[] = $this->get_class_from_file($filePath); + } + } + } else { + foreach ($controller as $index => $item) { + $filePath = $moduleDir . Config::get('url_controller_layer') . DS . $item . '.php'; $classes[] = $this->get_class_from_file($filePath); } } + $classes = array_unique(array_filter($classes)); $config = [ 'sitename' => config('site.name'), 'title' => $title, - 'author' => $author, + 'author' => config('site.name'), 'description' => '', 'apiurl' => $url, 'language' => $language, ]; - $builder = new Builder($classes); - $content = $builder->render($template_file, ['config' => $config, 'lang' => $lang]); - + try { + $builder = new Builder($classes); + $content = $builder->render($template_file, ['config' => $config, 'lang' => $lang]); + } catch (\Exception $e) { + print_r($e); + } if (!file_put_contents($output_file, $content)) { throw new Exception('Cannot save the content to ' . $output_file); } diff --git a/application/admin/command/Api/lang/zh-cn.php b/application/admin/command/Api/lang/zh-cn.php index 2154aa4d..7f0ecc76 100644 --- a/application/admin/command/Api/lang/zh-cn.php +++ b/application/admin/command/Api/lang/zh-cn.php @@ -16,6 +16,9 @@ return [ 'Tokentips' => 'Token在会员注册或登录后都会返回,WEB端同时存在于Cookie中', 'Apiurltips' => 'API接口URL', 'Savetips' => '点击保存后Token和Api url都将保存在本地Localstorage中', + 'Authorization' => '权限', + 'NeedLogin' => '登录', + 'NeedRight' => '鉴权', 'ReturnHeaders' => '响应头', 'ReturnParameters' => '返回参数', 'Response' => '响应输出', diff --git a/application/admin/command/Api/library/Builder.php b/application/admin/command/Api/library/Builder.php index ff9b08e5..169930ab 100755 --- a/application/admin/command/Api/library/Builder.php +++ b/application/admin/command/Api/library/Builder.php @@ -43,9 +43,11 @@ class Builder continue; } Extractor::getClassMethodAnnotations($class); + //Extractor::getClassPropertyValues($class); } $allClassAnnotation = Extractor::getAllClassAnnotations(); $allClassMethodAnnotation = Extractor::getAllClassMethodAnnotations(); + //$allClassPropertyValue = Extractor::getAllClassPropertyValues(); // foreach ($allClassMethodAnnotation as $className => &$methods) { // foreach ($methods as &$method) { @@ -162,10 +164,12 @@ class Builder list($allClassAnnotations, $allClassMethodAnnotations) = $this->extractAnnotations(); $sectorArr = []; - foreach ($allClassAnnotations as $index => $allClassAnnotation) { + foreach ($allClassAnnotations as $index => &$allClassAnnotation) { $sector = isset($allClassAnnotation['ApiSector']) ? $allClassAnnotation['ApiSector'][0] : $allClassAnnotation['ApiTitle'][0]; $sectorArr[$sector] = isset($allClassAnnotation['ApiWeigh']) ? $allClassAnnotation['ApiWeigh'][0] : 0; } + unset($allClassAnnotation); + arsort($sectorArr); $routes = include_once CONF_PATH . 'route.php'; $subdomain = false; @@ -175,7 +179,7 @@ class Builder $counter = 0; $section = null; $weigh = 0; - $docslist = []; + $docsList = []; foreach ($allClassMethodAnnotations as $class => $methods) { foreach ($methods as $name => $docs) { if (isset($docs['ApiSector'][0])) { @@ -190,28 +194,30 @@ class Builder if ($subdomain) { $route = substr($route, 4); } - $docslist[$section][$class . $name] = [ - 'id' => $counter, - 'method' => is_array($docs['ApiMethod'][0]) ? $docs['ApiMethod'][0]['data'] : $docs['ApiMethod'][0], - 'method_label' => $this->generateBadgeForMethod($docs), - 'section' => $section, - 'route' => $route, - 'title' => is_array($docs['ApiTitle'][0]) ? $docs['ApiTitle'][0]['data'] : $docs['ApiTitle'][0], - 'summary' => is_array($docs['ApiSummary'][0]) ? $docs['ApiSummary'][0]['data'] : $docs['ApiSummary'][0], - 'body' => isset($docs['ApiBody'][0]) ? is_array($docs['ApiBody'][0]) ? $docs['ApiBody'][0]['data'] : $docs['ApiBody'][0] : '', - 'headerslist' => $this->generateHeadersTemplate($docs), - 'paramslist' => $this->generateParamsTemplate($docs), - 'returnheaderslist' => $this->generateReturnHeadersTemplate($docs), - 'returnparamslist' => $this->generateReturnParamsTemplate($docs), - 'weigh' => is_array($docs['ApiWeigh'][0]) ? $docs['ApiWeigh'][0]['data'] : $docs['ApiWeigh'][0], - 'return' => isset($docs['ApiReturn']) ? is_array($docs['ApiReturn'][0]) ? $docs['ApiReturn'][0]['data'] : $docs['ApiReturn'][0] : '', + $docsList[$section][$name] = [ + 'id' => $counter, + 'method' => is_array($docs['ApiMethod'][0]) ? $docs['ApiMethod'][0]['data'] : $docs['ApiMethod'][0], + 'methodLabel' => $this->generateBadgeForMethod($docs), + 'section' => $section, + 'route' => $route, + 'title' => is_array($docs['ApiTitle'][0]) ? $docs['ApiTitle'][0]['data'] : $docs['ApiTitle'][0], + 'summary' => is_array($docs['ApiSummary'][0]) ? $docs['ApiSummary'][0]['data'] : $docs['ApiSummary'][0], + 'body' => isset($docs['ApiBody'][0]) ? is_array($docs['ApiBody'][0]) ? $docs['ApiBody'][0]['data'] : $docs['ApiBody'][0] : '', + 'headersList' => $this->generateHeadersTemplate($docs), + 'paramsList' => $this->generateParamsTemplate($docs), + 'returnHeadersList' => $this->generateReturnHeadersTemplate($docs), + 'returnParamsList' => $this->generateReturnParamsTemplate($docs), + 'weigh' => is_array($docs['ApiWeigh'][0]) ? $docs['ApiWeigh'][0]['data'] : $docs['ApiWeigh'][0], + 'return' => isset($docs['ApiReturn']) ? is_array($docs['ApiReturn'][0]) ? $docs['ApiReturn'][0]['data'] : $docs['ApiReturn'][0] : '', + 'needLogin' => $docs['ApiPermissionLogin'][0], + 'needRight' => $docs['ApiPermissionRight'][0], ]; $counter++; } } //重建排序 - foreach ($docslist as $index => &$methods) { + foreach ($docsList as $index => &$methods) { $methodSectorArr = []; foreach ($methods as $name => $method) { $methodSectorArr[$name] = isset($method['weigh']) ? $method['weigh'] : 0; @@ -219,9 +225,8 @@ class Builder arsort($methodSectorArr); $methods = array_merge(array_flip(array_keys($methodSectorArr)), $methods); } - $docslist = array_merge(array_flip(array_keys($sectorArr)), $docslist); - $docslist = array_filter($docslist , function($v) {return is_array($v) ; }) ; - return $docslist; + $docsList = array_merge(array_flip(array_keys($sectorArr)), $docsList); + return $docsList; } public function getView() @@ -237,8 +242,8 @@ class Builder */ public function render($template, $vars = []) { - $docslist = $this->parse(); + $docsList = $this->parse(); - return $this->view->display(file_get_contents($template), array_merge($vars, ['docslist' => $docslist])); + return $this->view->display(file_get_contents($template), array_merge($vars, ['docsList' => $docsList])); } } diff --git a/application/admin/command/Api/library/Extractor.php b/application/admin/command/Api/library/Extractor.php index 5591921b..40115365 100644 --- a/application/admin/command/Api/library/Extractor.php +++ b/application/admin/command/Api/library/Extractor.php @@ -24,6 +24,8 @@ class Extractor private static $classMethodAnnotationCache; + private static $classPropertyValueCache; + /** * Indicates that annotations should has strict behavior, 'false' by default * @var boolean @@ -66,14 +68,16 @@ class Extractor /** * Gets all anotations with pattern @SomeAnnotation() from a given class * - * @param string $className class name to get annotations + * @param string $className class name to get annotations * @return array self::$classAnnotationCache all annotated elements */ public static function getClassAnnotations($className) { if (!isset(self::$classAnnotationCache[$className])) { $class = new \ReflectionClass($className); - self::$classAnnotationCache[$className] = self::parseAnnotations($class->getDocComment()); + $annotationArr = self::parseAnnotations($class->getDocComment()); + $annotationArr['ApiTitle'] = !isset($annotationArr['ApiTitle'][0]) || !trim($annotationArr['ApiTitle'][0]) ? [$class->getShortName()] : $annotationArr['ApiTitle']; + self::$classAnnotationCache[$className] = $annotationArr; } return self::$classAnnotationCache[$className]; @@ -96,6 +100,17 @@ class Extractor return self::$classMethodAnnotationCache[$className]; } + public static function getClassPropertyValues($className) + { + $class = new \ReflectionClass($className); + + foreach ($class->getProperties() as $object) { + self::$classPropertyValueCache[$className][$object->name] = self::getClassPropertyValue($className, $object->name); + } + + return self::$classMethodAnnotationCache[$className]; + } + public static function getAllClassAnnotations() { return self::$classAnnotationCache; @@ -106,11 +121,25 @@ class Extractor return self::$classMethodAnnotationCache; } + public static function getAllClassPropertyValues() + { + return self::$classPropertyValueCache; + } + + public static function getClassPropertyValue($className, $property) + { + $_SERVER['REQUEST_METHOD'] = 'GET'; + $reflectionClass = new \ReflectionClass($className); + $reflectionProperty = $reflectionClass->getProperty($property); + $reflectionProperty->setAccessible(true); + return $reflectionProperty->getValue($reflectionClass->newInstanceWithoutConstructor()); + } + /** * Gets all anotations with pattern @SomeAnnotation() from a determinated method of a given class * - * @param string $className class name - * @param string $methodName method name to get annotations + * @param string $className class name + * @param string $methodName method name to get annotations * @return array self::$annotationCache all annotated elements of a method given */ public static function getMethodAnnotations($className, $methodName) @@ -138,8 +167,8 @@ class Extractor * Gets all anotations with pattern @SomeAnnotation() from a determinated method of a given class * and instance its abcAnnotation class * - * @param string $className class name - * @param string $methodName method name to get annotations + * @param string $className class name + * @param string $methodName method name to get annotations * @return array self::$annotationCache all annotated objects of a method given */ public function getMethodAnnotationsObjects($className, $methodName) @@ -189,7 +218,11 @@ class Extractor $methodName = $method->getName(); $methodAnnotations = self::parseAnnotations($docblockMethod); + $methodAnnotations['ApiTitle'] = !isset($methodAnnotations['ApiTitle'][0]) || !trim($methodAnnotations['ApiTitle'][0]) ? [$method->getName()] : $methodAnnotations['ApiTitle']; + $classAnnotations = self::parseAnnotations($dockblockClass); + $classAnnotations['ApiTitle'] = !isset($classAnnotations['ApiTitle'][0]) || !trim($classAnnotations['ApiTitle'][0]) ? [$class->getShortName()] : $classAnnotations['ApiTitle']; + if (isset($methodAnnotations['ApiInternal']) || $methodName == '_initialize' || $methodName == '_empty') { return []; } @@ -264,15 +297,15 @@ class Extractor } } $methodAnnotations['ApiPermissionLogin'] = [!in_array('*', $noNeedLogin) && !in_array($methodName, $noNeedLogin)]; - $methodAnnotations['ApiPermissionRight'] = [!in_array('*', $noNeedRight) && !in_array($methodName, $noNeedRight)]; + $methodAnnotations['ApiPermissionRight'] = !$methodAnnotations['ApiPermissionLogin'][0] ? false : [!in_array('*', $noNeedRight) && !in_array($methodName, $noNeedRight)]; return $methodAnnotations; } /** * Parse annotations * - * @param string $docblock - * @param string $name + * @param string $docblock + * @param string $name * @return array parsed annotations params */ private static function parseCustomAnnotations($docblock, $name = 'param') @@ -291,7 +324,7 @@ class Extractor /** * Parse annotations * - * @param string $docblock + * @param string $docblock * @return array parsed annotations params */ private static function parseAnnotations($docblock) @@ -337,7 +370,7 @@ class Extractor /** * Parse individual annotation arguments * - * @param string $content arguments string + * @param string $content arguments string * @return array annotated arguments */ private static function parseArgs($content) @@ -480,8 +513,8 @@ class Extractor /** * Try determinate the original type variable of a string * - * @param string $val string containing possibles variables that can be cast to bool or int - * @param boolean $trim indicate if the value passed should be trimmed after to try cast + * @param string $val string containing possibles variables that can be cast to bool or int + * @param boolean $trim indicate if the value passed should be trimmed after to try cast * @return mixed returns the value converted to original type if was possible */ private static function castValue($val, $trim = false) diff --git a/application/admin/command/Api/template/index.html b/application/admin/command/Api/template/index.html index a0b5424f..4608e506 100755 --- a/application/admin/command/Api/template/index.html +++ b/application/admin/command/Api/template/index.html @@ -27,12 +27,12 @@ font-family: "Roboto", "SF Pro SC", "SF Pro Display", "SF Pro Icons", "PingFang SC", BlinkMacSystemFont, -apple-system, "Segoe UI", "Microsoft Yahei", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-weight: 400; } - h2 { font-size: 1.6em; } + h2 { font-size: 1.2em; } hr { margin-top: 10px; } .tab-pane { padding-top: 10px; } .mt0 { margin-top: 0px; } .footer { font-size: 12px; color: #666; } - .label { display: inline-block; min-width: 65px; padding: 0.3em 0.6em 0.3em; } + .docs-list .label { display: inline-block; min-width: 65px; padding: 0.3em 0.6em 0.3em; } .string { color: green; } .number { color: darkorange; } .boolean { color: blue; } @@ -65,12 +65,24 @@ #sidebar > .list-group > a{ text-indent:0; } + #sidebar .child > a .tag{ + position: absolute; + right: 10px; + top: 11px; + } + #sidebar .child > a .pull-right{ + margin-left:3px; + } #sidebar .child { border:1px solid #ddd; border-bottom:none; } + #sidebar .child:last-child { + border-bottom:1px solid #ddd; + } #sidebar .child > a { border:0; + min-height: 40px; } #sidebar .list-group a.current { background:#f5f5f5; @@ -94,6 +106,9 @@ .label-primary { background-color: #248aff; } + .docs-list .panel .panel-body .table { + margin-bottom: 0; + } @@ -138,25 +153,34 @@ -
- {foreach name="docslist" id="docs"} +
+ {foreach name="docsList" id="docs"}

{$key}


{foreach name="docs" id="api" }

- {$api.method|strtoupper} + {$api.method|strtoupper} {$api.title} {$api.route}

@@ -177,10 +201,27 @@
{$api.summary}
+
+
{$lang.Authorization}
+
+ + + + + + + + + + + +
{$lang.NeedLogin}{$api.needLogin?'是':'否'}
{$lang.NeedRight}{$api.needRight?'是':'否'}
+
+
{$lang.Headers}
- {if $api.headerslist} + {if $api.headersList} @@ -191,7 +232,7 @@ - {foreach name="api['headerslist']" id="header"} + {foreach name="api['headersList']" id="header"} @@ -209,7 +250,7 @@
{$lang.Parameters}
- {if $api.paramslist} + {if $api.paramsList}
{$header.name} {$header.type}
@@ -220,7 +261,7 @@ - {foreach name="api['paramslist']" id="param"} + {foreach name="api['paramsList']" id="param"} @@ -246,12 +287,12 @@
- {if $api.headerslist} + {if $api.headersList}
{$lang.Headers}
- {foreach name="api['headerslist']" id="param"} + {foreach name="api['headersList']" id="param"}
@@ -262,11 +303,15 @@
{/if}
-
{$lang.Parameters}
+
{$lang.Parameters} +
+ 追加 +
+
- {if $api.paramslist} - {foreach name="api['paramslist']" id="param"} + {if $api.paramsList} + {foreach name="api['paramsList']" id="param"}
@@ -277,7 +322,7 @@ 无
{/if} -
+
@@ -298,7 +343,7 @@
{$lang.ReturnParameters}
- {if $api.returnparamslist} + {if $api.returnParamsList}
{$param.name} {$param.type}
@@ -308,7 +353,7 @@ - {foreach name="api['returnparamslist']" id="param"} + {foreach name="api['returnParamsList']" id="param"} @@ -346,10 +391,10 @@ @@ -475,7 +520,7 @@ $sample.html('
' + str + '
'); }); - $('body').on('click', '#save_data', function (e) { + $(document).on('click', '#save_data', function (e) { if (storage) { storage.setItem('token', $('#token').val()); storage.setItem('apiUrl', $('#apiUrl').val()); @@ -483,8 +528,20 @@ alert('Your browser does not support local storage'); } }); + $(document).on('click', '.btn-append', function (e) { + $($("#appendtpl").html()).insertBefore($(this).closest(".panel").find(".form-group-submit")); + return false; + }); + $(document).on('click', '.btn-remove', function (e) { + $(this).closest(".form-group").remove(); + return false; + }); + $(document).on('keyup', '.input-custom-name', function (e) { + $(this).closest(".row").find(".input-custom-value").attr("name", $(this).val()); + return false; + }); - $('body').on('click', '.send', function (e) { + $(document).on('click', '.send', function (e) { e.preventDefault(); var form = $(this).closest('form'); //added /g to get all the matched params instead of only first @@ -577,5 +634,21 @@ }); }); + diff --git a/public/api.html b/public/api.html index 3486ce13..fba5e716 100755 --- a/public/api.html +++ b/public/api.html @@ -27,12 +27,12 @@ font-family: "Roboto", "SF Pro SC", "SF Pro Display", "SF Pro Icons", "PingFang SC", BlinkMacSystemFont, -apple-system, "Segoe UI", "Microsoft Yahei", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-weight: 400; } - h2 { font-size: 1.6em; } + h2 { font-size: 1.2em; } hr { margin-top: 10px; } .tab-pane { padding-top: 10px; } .mt0 { margin-top: 0px; } .footer { font-size: 12px; color: #666; } - .label { display: inline-block; min-width: 65px; padding: 0.3em 0.6em 0.3em; } + .docs-list .label { display: inline-block; min-width: 65px; padding: 0.3em 0.6em 0.3em; } .string { color: green; } .number { color: darkorange; } .boolean { color: blue; } @@ -65,12 +65,24 @@ #sidebar > .list-group > a{ text-indent:0; } + #sidebar .child > a .tag{ + position: absolute; + right: 10px; + top: 11px; + } + #sidebar .child > a .pull-right{ + margin-left:3px; + } #sidebar .child { border:1px solid #ddd; border-bottom:none; } + #sidebar .child:last-child { + border-bottom:1px solid #ddd; + } #sidebar .child > a { border:0; + min-height: 40px; } #sidebar .list-group a.current { background:#f5f5f5; @@ -94,6 +106,9 @@ .label-primary { background-color: #248aff; } + .docs-list .panel .panel-body .table { + margin-bottom: 0; + } @@ -140,62 +155,133 @@ -
+

公共接口


@@ -221,6 +307,23 @@
加载初始化
+
+
权限
+
+
{$param.name} {$param.type}
+ + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -273,7 +376,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -288,7 +395,7 @@
-
+
@@ -351,6 +458,23 @@
上传文件
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -391,14 +515,18 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -463,6 +591,23 @@
测试描述信息
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -543,7 +688,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -558,7 +707,7 @@
-
+
@@ -649,6 +798,23 @@
无需登录的接口
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -672,13 +838,17 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -741,6 +911,23 @@
需要登录的接口
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -764,13 +951,17 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -833,6 +1024,23 @@
需要登录且需要验证有相应组的权限
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -856,13 +1064,17 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -927,6 +1139,23 @@
发送验证码
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -973,7 +1202,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -984,7 +1217,7 @@
-
+
@@ -1047,6 +1280,23 @@
检测验证码
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -1099,7 +1349,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -1114,7 +1368,7 @@
-
+
@@ -1179,6 +1433,23 @@
首页
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -1202,13 +1473,17 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -1273,6 +1548,23 @@
发送验证码
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -1319,7 +1611,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -1330,7 +1626,7 @@
-
+
@@ -1393,6 +1689,23 @@
检测验证码
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -1445,7 +1758,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -1460,7 +1777,7 @@
-
+
@@ -1525,6 +1842,23 @@
检测Token是否过期
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -1548,13 +1882,17 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -1617,6 +1955,23 @@
刷新Token
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -1640,13 +1995,17 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -1711,6 +2070,23 @@
会员中心
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -1734,13 +2110,17 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -1803,6 +2183,23 @@
会员登录
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -1849,7 +2246,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -1860,7 +2261,7 @@
-
+
@@ -1923,6 +2324,23 @@
手机验证码登录
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -1969,7 +2387,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -1980,7 +2402,7 @@
-
+
@@ -2043,6 +2465,23 @@
注册会员
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -2107,7 +2546,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -2130,7 +2573,7 @@
-
+
@@ -2193,6 +2636,23 @@
退出登录
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -2216,13 +2676,17 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -2285,6 +2749,23 @@
修改会员个人信息
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -2343,7 +2824,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -2362,7 +2847,7 @@
-
+
@@ -2425,6 +2910,23 @@
修改邮箱
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -2471,7 +2973,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -2482,7 +2988,7 @@
-
+
@@ -2545,6 +3051,23 @@
修改手机号
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -2591,7 +3114,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -2602,7 +3129,7 @@
-
+
@@ -2665,6 +3192,23 @@
第三方登录
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -2711,7 +3255,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -2722,7 +3270,7 @@
-
+
@@ -2785,6 +3333,23 @@
重置密码
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -2837,7 +3402,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -2852,7 +3421,7 @@
-
+
@@ -2917,6 +3486,23 @@
检测邮箱
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -2963,7 +3549,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -2974,7 +3564,7 @@
-
+
@@ -3037,6 +3627,23 @@
检测用户名
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -3083,7 +3690,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -3094,7 +3705,7 @@
-
+
@@ -3157,6 +3768,23 @@
检测昵称
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -3203,7 +3831,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -3214,7 +3846,7 @@
-
+
@@ -3277,6 +3909,23 @@
检测手机
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -3323,7 +3972,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -3334,7 +3987,7 @@
-
+
@@ -3397,6 +4050,23 @@
检测手机
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -3437,14 +4107,18 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -3507,6 +4181,23 @@
检测邮箱
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -3547,14 +4238,18 @@
-
参数
+
参数 +
+ 追加 +
+
-
+
@@ -3617,6 +4312,23 @@
检测手机验证码
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -3669,7 +4381,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -3684,7 +4400,7 @@
-
+
@@ -3747,6 +4463,23 @@
检测邮箱验证码
+
+
权限
+
+ + + + + + + + + + + +
登录
鉴权
+
+
Headers
@@ -3799,7 +4532,11 @@
-
参数
+
参数 +
+ 追加 +
+
@@ -3814,7 +4551,7 @@
-
+
@@ -3860,9 +4597,10 @@
- 我的网站 + Generated on 2020-12-21 11:39:26 我的网站
@@ -3988,7 +4726,7 @@ $sample.html('
' + str + '
'); }); - $('body').on('click', '#save_data', function (e) { + $(document).on('click', '#save_data', function (e) { if (storage) { storage.setItem('token', $('#token').val()); storage.setItem('apiUrl', $('#apiUrl').val()); @@ -3996,8 +4734,20 @@ alert('Your browser does not support local storage'); } }); + $(document).on('click', '.btn-append', function (e) { + $($("#appendtpl").html()).insertBefore($(this).closest(".panel").find(".form-group-submit")); + return false; + }); + $(document).on('click', '.btn-remove', function (e) { + $(this).closest(".form-group").remove(); + return false; + }); + $(document).on('keyup', '.input-custom-name', function (e) { + $(this).closest(".row").find(".input-custom-value").attr("name", $(this).val()); + return false; + }); - $('body').on('click', '.send', function (e) { + $(document).on('click', '.send', function (e) { e.preventDefault(); var form = $(this).closest('form'); //added /g to get all the matched params instead of only first @@ -4090,5 +4840,21 @@ }); }); +