From 4418e004ad185484cade2b4b8388d8e89e0c270e Mon Sep 17 00:00:00 2001 From: dongwei <838456736@qq.com> Date: Wed, 16 Jan 2019 17:58:22 +0800 Subject: [PATCH] read me --- README.md | 32 +++++++++++++++++++++++++++++++- src/Client.php | 1 + src/Middleware/Security.php | 1 - 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe99d1a..b386176 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,36 @@ return [ 发布的rpc方法必须在此文件注册,否则无法访问 ``` +####lumen配置config/rpc.php +```php + env('APP_NAME'), + 'log_path' => "/logs/rpc-".date("Y-m-d").".log",//rpc日志路径 + 'log_formatter' => \App\Logging\LogstashFormatter::class, //rpc日志格式 + // json rpc server 配置 + 'server' => [ + 'name' => env('APP_NAME'), + 'map' => base_path('app/Rpc/method.php'), //rpc注册文件 + ], + // json rpc client 配置 + 'client' => [ + 'auth' => [ + 'local' => false, + 'base_uri' => 'http://hw.api.test', + ], + 'erp' => [ + 'local' => false, + 'base_uri' => 'http://hw.api.test', + ], + 'sapi' => [ + 'local' => true,//当前项目标记为true + 'base_uri' => 'http://hw.api.test', + ], + ], +]; + +``` ####rpc server文件 ```php call('user.info',[13232]); ``` -####工具 +###工具 ``` http://host/rpc/tool.html 调用工具 http://host/rpc/doc.html 文档地址 diff --git a/src/Client.php b/src/Client.php index 2f146e4..acc58d0 100644 --- a/src/Client.php +++ b/src/Client.php @@ -109,6 +109,7 @@ class Client protected function post($payload) { try { + $headers = [ 'client_app' => $this->config['app'], ]; diff --git a/src/Middleware/Security.php b/src/Middleware/Security.php index 5158a24..5007b02 100644 --- a/src/Middleware/Security.php +++ b/src/Middleware/Security.php @@ -26,7 +26,6 @@ class Security */ public function handle($request, Closure $next) { - app('log')->info("rpc security middleware call here"); $ip = $request->getClientIp(); if ($this->isClientIPPermitted($ip) == false) { return new JsonResponse("$ip is forbidden", 403);