From 39ad209ab42cbaba465484e302b1896b8f599a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=80=99=E5=AD=A6=E6=9D=B0?= Date: Sat, 5 Jan 2019 16:00:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E6=88=90=E8=BF=9Blumen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Client.php | 5 +++-- src/Providers/ClientServiceProvider.php | 2 +- src/Server/JsonRpcTool.php | 2 +- src/views/tool.blade.php | 5 +++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Client.php b/src/Client.php index 6de3664..421b5e7 100644 --- a/src/Client.php +++ b/src/Client.php @@ -27,7 +27,8 @@ class Client 'allow_redirects' => false, ]; - $this->http = new \GuzzleHttp\Client(array_merge($default,$config)); + $this->http = new \GuzzleHttp\Client(array_merge($default, $config)); + return $this; } /** @@ -83,7 +84,7 @@ class Client return $body['result']; } catch (\InvalidArgumentException $e) { - throw new RpcServerException('json decode error'); + throw new RpcServerException('json decode error', -32700); } } diff --git a/src/Providers/ClientServiceProvider.php b/src/Providers/ClientServiceProvider.php index 775ae56..eccc38e 100644 --- a/src/Providers/ClientServiceProvider.php +++ b/src/Providers/ClientServiceProvider.php @@ -23,7 +23,7 @@ class ClientServiceProvider extends ServiceProvider foreach ($config as $k => $item) { $this->app->singleton('rpc.' . $k, function () use ($k) { - app('rpc')->endpoint($k); + return app('rpc')->endpoint($k); }); } } diff --git a/src/Server/JsonRpcTool.php b/src/Server/JsonRpcTool.php index 49ce174..2c2fb17 100644 --- a/src/Server/JsonRpcTool.php +++ b/src/Server/JsonRpcTool.php @@ -40,7 +40,7 @@ class JsonRpcTool $method = $request->input('method'); try { - $result = app('rpc')->call($method, $params); + $result = app('rpc.auth')->call($method, $params); $view->share('result', json_encode($result, JSON_PRETTY_PRINT)); } catch (RpcServerException $exception) { $view->share('error', ['code' => $exception->getCode(), 'message' => $exception->getMessage()]); diff --git a/src/views/tool.blade.php b/src/views/tool.blade.php index b8b1904..d3e2826 100644 --- a/src/views/tool.blade.php +++ b/src/views/tool.blade.php @@ -2,7 +2,7 @@ Json Rpc Debug Tool - + @@ -85,7 +85,7 @@
Result:
-
{{$result}}
+
{{$result}}
@endif @@ -98,6 +98,7 @@ + \ No newline at end of file