调试工具
This commit is contained in:
parent
99f5b6c8f8
commit
69e7fd3f5c
242
composer.lock
generated
242
composer.lock
generated
|
@ -18,13 +18,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a",
|
||||
"reference": "5527a48b7313d15261292c149e55e26eae771b0a",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1"
|
||||
|
@ -91,13 +85,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
|
||||
"reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/promises": "^1.0",
|
||||
|
@ -162,13 +150,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
|
||||
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.0"
|
||||
|
@ -219,13 +201,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115",
|
||||
"reference": "9f83dded91781a01c63574e387eaa769be769115",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
|
@ -282,23 +258,17 @@
|
|||
},
|
||||
{
|
||||
"name": "illuminate/contracts",
|
||||
"version": "v5.7.20",
|
||||
"version": "v5.7.23",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/contracts.git",
|
||||
"reference": "758927e5e925c1d442a1faaa1356675ceba0194c"
|
||||
"reference": "3d67e2d7c9087ae3a2a53d9b102697e5f482d6d0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/758927e5e925c1d442a1faaa1356675ceba0194c",
|
||||
"reference": "758927e5e925c1d442a1faaa1356675ceba0194c",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/3d67e2d7c9087ae3a2a53d9b102697e5f482d6d0",
|
||||
"reference": "3d67e2d7c9087ae3a2a53d9b102697e5f482d6d0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
|
@ -328,11 +298,11 @@
|
|||
],
|
||||
"description": "The Illuminate Contracts package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2018-11-15T13:49:08+00:00"
|
||||
"time": "2019-01-09T10:34:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/filesystem",
|
||||
"version": "v5.7.20",
|
||||
"version": "v5.7.23",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/filesystem.git",
|
||||
|
@ -342,13 +312,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/filesystem/zipball/19ba2ac5f85b7505d7c2bf6307d10633f9f3c6b0",
|
||||
"reference": "19ba2ac5f85b7505d7c2bf6307d10633f9f3c6b0",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "5.7.*",
|
||||
|
@ -390,23 +354,17 @@
|
|||
},
|
||||
{
|
||||
"name": "illuminate/http",
|
||||
"version": "v5.7.20",
|
||||
"version": "v5.7.23",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/http.git",
|
||||
"reference": "4592866213f7283a345aae2b04d0685450fd2d73"
|
||||
"reference": "28f7a7ffa944d49b63023e99c1fda2e5fb56df0e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/http/zipball/4592866213f7283a345aae2b04d0685450fd2d73",
|
||||
"reference": "4592866213f7283a345aae2b04d0685450fd2d73",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"url": "https://api.github.com/repos/illuminate/http/zipball/28f7a7ffa944d49b63023e99c1fda2e5fb56df0e",
|
||||
"reference": "28f7a7ffa944d49b63023e99c1fda2e5fb56df0e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/session": "5.7.*",
|
||||
|
@ -438,11 +396,11 @@
|
|||
],
|
||||
"description": "The Illuminate Http package.",
|
||||
"homepage": "https://laravel.com",
|
||||
"time": "2019-01-04T23:18:04+00:00"
|
||||
"time": "2019-01-12T14:14:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/session",
|
||||
"version": "v5.7.20",
|
||||
"version": "v5.7.23",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/session.git",
|
||||
|
@ -452,13 +410,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/session/zipball/7e2a7bcf01a16e03c2f97bffccc7e7f0fd0ed9da",
|
||||
"reference": "7e2a7bcf01a16e03c2f97bffccc7e7f0fd0ed9da",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "5.7.*",
|
||||
|
@ -498,7 +450,7 @@
|
|||
},
|
||||
{
|
||||
"name": "illuminate/support",
|
||||
"version": "v5.7.20",
|
||||
"version": "v5.7.23",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/support.git",
|
||||
|
@ -508,13 +460,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/support/zipball/ea3f30dd824bba52bcff4290dc7431b0ffb478e1",
|
||||
"reference": "ea3f30dd824bba52bcff4290dc7431b0ffb478e1",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/inflector": "^1.1",
|
||||
|
@ -573,13 +519,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/influxdata/influxdb-php/zipball/570bd5cdedb9b1c1628dceea5785bc40e08f7e48",
|
||||
"reference": "570bd5cdedb9b1c1628dceea5785bc40e08f7e48",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^6.0",
|
||||
|
@ -639,13 +579,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/itxq/api-doc-php/zipball/79ac71cf09da49491cfb92722d6f6e13ad8f6482",
|
||||
"reference": "79ac71cf09da49491cfb92722d6f6e13ad8f6482",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.6.0"
|
||||
|
@ -681,13 +615,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
|
||||
"reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
|
@ -765,13 +693,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9",
|
||||
"reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.9",
|
||||
|
@ -829,13 +751,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
|
||||
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
|
@ -884,13 +800,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
|
@ -940,13 +850,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
|
||||
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
|
@ -993,13 +897,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
|
||||
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
|
@ -1047,13 +945,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa",
|
||||
"reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3"
|
||||
|
@ -1093,13 +985,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf",
|
||||
"reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3"
|
||||
|
@ -1167,13 +1053,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/64cb33c81e37d19b7715d4a6a4d49c1c382066dd",
|
||||
"reference": "64cb33c81e37d19b7715d4a6a4d49c1c382066dd",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
|
@ -1229,13 +1109,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/887de6d34c86cf0cb6cbf910afb170cdb743cb5e",
|
||||
"reference": "887de6d34c86cf0cb6cbf910afb170cdb743cb5e",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
|
@ -1299,13 +1173,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/9094d69e8c6ee3fe186a0ec5a4f1401e506071ce",
|
||||
"reference": "9094d69e8c6ee3fe186a0ec5a4f1401e506071ce",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3"
|
||||
|
@ -1354,13 +1222,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/a633d422a09242064ba24e44a6e1494c5126de86",
|
||||
"reference": "a633d422a09242064ba24e44a6e1494c5126de86",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
|
@ -1414,13 +1276,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/83de6543328917c18d5498eeb6bb6d36f7aab31b",
|
||||
"reference": "83de6543328917c18d5498eeb6bb6d36f7aab31b",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
|
@ -1509,13 +1365,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
|
||||
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
|
@ -1573,13 +1423,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
|
||||
"reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
|
@ -1638,13 +1482,7 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/939fb792d73f2ce80e6ae9019d205fc480f1c9a0",
|
||||
"reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
|
|
|
@ -4,10 +4,11 @@ namespace JsonRpc;
|
|||
|
||||
use GuzzleHttp\Exception\ServerException;
|
||||
use JsonRpc\Exception\RpcServerException;
|
||||
use JsonRpc\Server\JsonRpcBase;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Logger;
|
||||
|
||||
class Client
|
||||
class Client extends JsonRpc
|
||||
{
|
||||
/**
|
||||
* all configuration information
|
||||
|
@ -48,7 +49,6 @@ class Client
|
|||
$this->server_config = $this->config['client'][$k];
|
||||
|
||||
$default = [
|
||||
'app' => $k,
|
||||
'timeout' => 3,
|
||||
'allow_redirects' => false,
|
||||
];
|
||||
|
@ -93,7 +93,6 @@ class Client
|
|||
protected function post($payload)
|
||||
{
|
||||
try {
|
||||
|
||||
$headers = [
|
||||
'X-Client-App' => $this->config['app'],
|
||||
];
|
||||
|
@ -103,14 +102,19 @@ class Client
|
|||
'json' => $payload,
|
||||
]);
|
||||
} catch (ServerException $e) {
|
||||
throw new RpcServerException($e->getMessage(), $e->getCode());
|
||||
$ex = new RpcServerException(self::ErrorMsg[JsonRpc::Rpc_Error_Internal_Error], JsonRpc::Rpc_Error_Internal_Error);
|
||||
if (env("APP_DEBUG") == true) {
|
||||
$resp = $e->getResponse();
|
||||
$ex->setResponse($e->getResponse());
|
||||
}
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
try {
|
||||
$body = \GuzzleHttp\json_decode($resp->getBody(), true);
|
||||
app('rpc.logger')->info("client_response", $body);
|
||||
if (empty($body)) {
|
||||
throw new RpcServerException('http response empty', 500);
|
||||
throw new RpcServerException('http response empty', JsonRpc::Rpc_Error_System_Error);
|
||||
}
|
||||
if (isset($body['error']) && isset($body['error']['code']) && isset($body['error']['message'])) {
|
||||
$message = is_array($body['error']['message']) ? json_encode($body['error']['message']) : $body['error']['message'];
|
||||
|
@ -121,7 +125,11 @@ class Client
|
|||
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
app('rpc.logger')->error('client_decode_error', array_merge($this->server_config, $payload));
|
||||
throw new RpcServerException('json decode error', -32700);
|
||||
$ex = new RpcServerException($e->getMessage(), JsonRpc::Rpc_Error_Parse_Error);
|
||||
if (env("APP_DEBUG") == true) {
|
||||
$ex->setResponse($resp);
|
||||
}
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,4 +4,16 @@ namespace JsonRpc\Exception;
|
|||
|
||||
class RpcServerException extends \Exception
|
||||
{
|
||||
protected $response;
|
||||
|
||||
public function setResponse($resp)
|
||||
{
|
||||
$this->response = $resp;
|
||||
}
|
||||
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace JsonRpc\Server;
|
||||
namespace JsonRpc;
|
||||
|
||||
class JsonRpcBase
|
||||
class JsonRpc
|
||||
{
|
||||
const Rpc_Error_Parse_Error = -32700; //Parse error语法解析错误 服务端接收到无效的json。该错误发送于服务器尝试解析json文本
|
||||
const Rpc_Error_Invalid_Request = -32600; //Invalid Request无效请求 发送的json不是一个有效的请求对象。
|
|
@ -4,8 +4,9 @@ namespace JsonRpc\Server;
|
|||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use JsonRpc\Exception\RpcServerException;
|
||||
use JsonRpc\JsonRpc;
|
||||
|
||||
class JsonRpcMethod extends JsonRpcBase
|
||||
class JsonRpcMethod extends JsonRpc
|
||||
{
|
||||
protected $id;
|
||||
protected $request;
|
||||
|
|
|
@ -5,8 +5,9 @@ namespace JsonRpc\Server;
|
|||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use JsonRpc\JsonRpc;
|
||||
|
||||
class JsonRpcServer extends JsonRpcBase
|
||||
class JsonRpcServer extends JsonRpc
|
||||
{
|
||||
/**
|
||||
* @var Request
|
||||
|
|
|
@ -42,7 +42,12 @@ class JsonRpcTool
|
|||
$result = app('rpc.' . $this->config['name'])->call($method, $params);
|
||||
$view->share('result', json_encode($result, JSON_PRETTY_PRINT));
|
||||
} catch (RpcServerException $exception) {
|
||||
$view->share('error', ['code' => $exception->getCode(), 'message' => $exception->getMessage()]);
|
||||
$resp = $exception->getResponse();
|
||||
$view->share('error', [
|
||||
'code' => $exception->getCode(),
|
||||
'message' => $exception->getMessage(),
|
||||
'resp' => $resp]
|
||||
);
|
||||
}
|
||||
}
|
||||
$methods = $this->getMethods();
|
||||
|
|
|
@ -77,9 +77,13 @@
|
|||
</form>
|
||||
<div class="row col-md-12">
|
||||
@if( !empty($error) )
|
||||
<div id='alert' class="alert alert-danger" role="alert">
|
||||
RpcServerException: {{$error['message']}} with code {{$error['code']}}
|
||||
<div id='alert' class="alert alert-danger" role="alert" style="width: 100%">
|
||||
code : {{$error['code']}} <br>
|
||||
message : {{$error['message']}}
|
||||
</div>
|
||||
<h5>返回内容:</h5>
|
||||
<iframe style="width: 100%;height: 500px;border: none;" srcdoc='{{$error['resp']->getBody()}}'></iframe>
|
||||
<hr>
|
||||
@endif
|
||||
@if( !empty($result) )
|
||||
<h5>Result:</h5>
|
||||
|
|
Loading…
Reference in New Issue
Block a user