From e9ba9fae734847906385452dd883cf16d9518c36 Mon Sep 17 00:00:00 2001 From: lisida <506400117@qq.com> Date: Thu, 14 Feb 2019 17:41:52 +0800 Subject: [PATCH 01/11] test --- src/Server/JsonRpcTool.php | 16 +++++++++++++++- src/views/doc.blade.php | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Server/JsonRpcTool.php b/src/Server/JsonRpcTool.php index 1297ab9..a195c04 100644 --- a/src/Server/JsonRpcTool.php +++ b/src/Server/JsonRpcTool.php @@ -4,6 +4,7 @@ namespace JsonRpc\Server; use Illuminate\Http\Request; use Illuminate\View\Factory; +use itxq\apidoc\BootstrapApiDoc; use JsonRpc\Exception\RpcServerException; use Monolog\Logger; @@ -50,8 +51,21 @@ class JsonRpcTool ); } } + $methods = []; + foreach ($this->config['map'] as $key => $item) { + if (!in_array($item[0], $methods)) { + $methods[] = $item[0]; + } + } + $config = [ + 'class' => $methods, + 'filter_method' => [], + ]; + + $api = new BootstrapApiDoc($config); + $data = $api->getApiDocTmp(); $methods = $this->getMethods(); - $view->share('method', $method); + $view->share('data',json_encode($data)); $view->share('endpoint', $this->getEndpoint()); $view->share('methods', $methods); $view->share('params', json_encode($params, JSON_PRETTY_PRINT)); diff --git a/src/views/doc.blade.php b/src/views/doc.blade.php index 3320ca9..5b61d8c 100644 --- a/src/views/doc.blade.php +++ b/src/views/doc.blade.php @@ -102,5 +102,9 @@ + \ No newline at end of file From d5d06d3b849128578b0cf619afe436ebc6a491fa Mon Sep 17 00:00:00 2001 From: lisida <506400117@qq.com> Date: Thu, 14 Feb 2019 18:08:21 +0800 Subject: [PATCH 02/11] push --- src/views/doc.blade.php | 117 +++++++++++++++++++++++++++------------- 1 file changed, 80 insertions(+), 37 deletions(-) diff --git a/src/views/doc.blade.php b/src/views/doc.blade.php index 5b61d8c..c833883 100644 --- a/src/views/doc.blade.php +++ b/src/views/doc.blade.php @@ -1,13 +1,13 @@ - Json Rpc Doc + Json Rpc Debug Tool @@ -45,8 +43,8 @@
- {{----}} +
{{--
--}} {{----}} @@ -57,39 +55,60 @@ {{--
--}}
-
+
+

+ 请求参数 +

+ + + + + + + + +
参数类型描述默认值是否必须
+
+
+
-
- - {{----}} + +
{{$params}}
+
- {{--@if( !empty($error) )--}} - {{----}} - {{--@endif--}} - {{--@if( !empty($result) )--}} - {{--
Result:
--}} + @if( !empty($error) ) + + @if($error['resp']) +
返回内容:
+ +
+ @endif + @endif + @if( !empty($result) ) +
Result:
- {{--
--}} - {{--
{{$result}}
--}} - {{--
--}} - {{--@endif--}} +
+
{{$result}}
+
+ @endif
@@ -101,10 +120,34 @@ - - + + \ No newline at end of file From 5a670b51d377b7ab4660928203b4a32c9630e009 Mon Sep 17 00:00:00 2001 From: lisida <506400117@qq.com> Date: Thu, 14 Feb 2019 18:15:22 +0800 Subject: [PATCH 03/11] push --- src/views/doc.blade.php | 113 ++++++++++++--------------------------- src/views/tool.blade.php | 39 ++++++++++++-- 2 files changed, 69 insertions(+), 83 deletions(-) diff --git a/src/views/doc.blade.php b/src/views/doc.blade.php index c833883..3320ca9 100644 --- a/src/views/doc.blade.php +++ b/src/views/doc.blade.php @@ -1,13 +1,13 @@ - Json Rpc Debug Tool + Json Rpc Doc @@ -43,8 +45,8 @@
- + {{----}}
{{--
--}} {{----}} @@ -55,60 +57,39 @@ {{--
--}}
+
-
-

- 请求参数 -

- - - - - - - - -
参数类型描述默认值是否必须
-
-
-
+
- -
{{$params}}
- + + {{----}}
- @if( !empty($error) ) - - @if($error['resp']) -
返回内容:
- -
- @endif - @endif - @if( !empty($result) ) -
Result:
+ {{--@if( !empty($error) )--}} + {{----}} + {{--@endif--}} + {{--@if( !empty($result) )--}} + {{--
Result:
--}} -
-
{{$result}}
-
- @endif + {{--
--}} + {{--
{{$result}}
--}} + {{--
--}} + {{--@endif--}}
@@ -120,34 +101,6 @@ - - \ No newline at end of file diff --git a/src/views/tool.blade.php b/src/views/tool.blade.php index 04f31d7..c833883 100644 --- a/src/views/tool.blade.php +++ b/src/views/tool.blade.php @@ -55,7 +55,6 @@ {{----}}
-
+
+

+ 请求参数 +

+ + + + + + + + +
参数类型描述默认值是否必须
+
+
+
-
{{$params}}
@@ -107,13 +121,32 @@ - From 7a4b3b9be4fa0f2c571ffbc02c9cd4d791700650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=8D=9A=E8=BD=A9?= Date: Thu, 14 Feb 2019 18:34:22 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/tool.blade.php | 69 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 7 deletions(-) diff --git a/src/views/tool.blade.php b/src/views/tool.blade.php index c833883..c93ce2b 100644 --- a/src/views/tool.blade.php +++ b/src/views/tool.blade.php @@ -67,7 +67,7 @@

请求参数

- +
@@ -77,6 +77,27 @@
参数 类型
+
+

+ 返回参数 +

+ + + + + + + + +
参数类型描述默认值是否必须
+
+
+

+ 状态码说明 +

+ +
+
@@ -128,15 +149,34 @@ editor.on('change', function (e) { $('#params').val(editor.getValue()) }) + $(document).ready(function(){ + intTable(); + var valKey =$("#method option:first-child").text(); + var data = ; + var methodArray = data[valKey]; + changeTable(methodArray) + }); $('#method').bind('change', function() { var valKey = $("#method").find("option:selected").text(); var data = ; var methodArray = data[valKey]; - $("#methodRequird").empty(); - var html = "参数类型描述默认值是否必须"; - $(html).appendTo("#methodRequird"); - console.log(methodArray, valKey) - methodArray.map(function (val, index) { + intTable() + changeTable(methodArray) + }) + function intTable() { + $("#paramRequird").empty(); + $("#returnRequird").empty(); + $("#codeRequird").empty(); + var html1 = "参数类型描述默认值是否必须"; + var html2 = "参数类型描述/tr>"; + var html3 = "状态码描述"; + $(html1).appendTo("#paramRequird"); + $(html2).appendTo("#returnRequird"); + $(html3).appendTo("#codeRequird"); + } + + function changeTable(params) { + params.param.map(function (val, index) { var $trTemp = $(""); //往行里面追加 td单元格 $trTemp.append(""+ data[i].param_name +""); @@ -146,7 +186,22 @@ $trTemp.append(""+ data[i].param_require +""); $trTemp.appendTo("#methodRequird"); }) - }) + params.return.map(function (val, index) { + var $trTemp = $(""); + //往行里面追加 td单元格 + $trTemp.append(""+ data[i].return_name +""); + $trTemp.append(""+ data[i].return_type +""); + $trTemp.append(""+ data[i].return_title +""); + $trTemp.appendTo("#methodRequird"); + }) + params.code.map(function (val, index) { + var $trTemp = $(""); + //往行里面追加 td单元格 + $trTemp.append(""+ data[i].code +""); + $trTemp.append(""+ data[i].content +""); + $trTemp.appendTo("#methodRequird"); + }) + } From 853b20b6d4dc34bff47aaa58080cbee6c1ac83ef Mon Sep 17 00:00:00 2001 From: lisida <506400117@qq.com> Date: Thu, 14 Feb 2019 18:42:07 +0800 Subject: [PATCH 05/11] push --- src/views/tool.blade.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/views/tool.blade.php b/src/views/tool.blade.php index c93ce2b..c84092b 100644 --- a/src/views/tool.blade.php +++ b/src/views/tool.blade.php @@ -179,27 +179,27 @@ params.param.map(function (val, index) { var $trTemp = $(""); //往行里面追加 td单元格 - $trTemp.append(""+ data[i].param_name +""); - $trTemp.append(""+ data[i].param_type +""); - $trTemp.append(""+ data[i].param_title +""); - $trTemp.append(""+ data[i].param_default +""); - $trTemp.append(""+ data[i].param_require +""); - $trTemp.appendTo("#methodRequird"); + $trTemp.append(""+ val.param_name +""); + $trTemp.append(""+ val.param_type +""); + $trTemp.append(""+ val.param_title +""); + $trTemp.append(""+ val.param_default +""); + $trTemp.append(""+ val.param_require +""); + $trTemp.appendTo("#paramRequird"); }) params.return.map(function (val, index) { var $trTemp = $(""); //往行里面追加 td单元格 - $trTemp.append(""+ data[i].return_name +""); - $trTemp.append(""+ data[i].return_type +""); - $trTemp.append(""+ data[i].return_title +""); - $trTemp.appendTo("#methodRequird"); + $trTemp.append(""+ val.return_name +""); + $trTemp.append(""+ val.return_type +""); + $trTemp.append(""+ val.return_title +""); + $trTemp.appendTo("#returnRequird"); }) params.code.map(function (val, index) { var $trTemp = $(""); //往行里面追加 td单元格 - $trTemp.append(""+ data[i].code +""); - $trTemp.append(""+ data[i].content +""); - $trTemp.appendTo("#methodRequird"); + $trTemp.append(""+ val.code +""); + $trTemp.append(""+ val.content +""); + $trTemp.appendTo("#codeRequird"); }) } From 82034913bd700cbd9cabe7507494c928cd7ae40a Mon Sep 17 00:00:00 2001 From: lisida <506400117@qq.com> Date: Thu, 14 Feb 2019 19:07:42 +0800 Subject: [PATCH 06/11] push --- src/views/tool.blade.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/tool.blade.php b/src/views/tool.blade.php index c84092b..92f1dd1 100644 --- a/src/views/tool.blade.php +++ b/src/views/tool.blade.php @@ -144,6 +144,7 @@ From 375e3394391f2201e1e1a845d2cbdb51d25364b3 Mon Sep 17 00:00:00 2001 From: lisida <506400117@qq.com> Date: Fri, 15 Feb 2019 16:30:31 +0800 Subject: [PATCH 11/11] push --- src/views/tool.blade.php | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/views/tool.blade.php b/src/views/tool.blade.php index 3d6f2a4..b6184c0 100644 --- a/src/views/tool.blade.php +++ b/src/views/tool.blade.php @@ -21,7 +21,7 @@