From 642e16a07c4d648653889bd034231ad7ebcddcfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 28 Oct 2021 15:40:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/JsonRpcConsumers.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/JsonRpcConsumers.php b/src/JsonRpcConsumers.php index 76cfd1a..e4b1724 100644 --- a/src/JsonRpcConsumers.php +++ b/src/JsonRpcConsumers.php @@ -4,9 +4,8 @@ namespace Kiri\Rpc; use Exception; -use Kiri\Consul\Catalog\Catalog; use Kiri\Context; -use Kiri\Kiri; +use Kiri\Core\Number; use Kiri\Pool\Pool; use Swoole\Client; use Swoole\Coroutine; @@ -61,6 +60,9 @@ abstract class JsonRpcConsumers implements OnRpcConsumerInterface } else { $client = $this->clientNotCoroutine($config); } + + if (empty($id)) $id = Number::create(time()); + $client->send(json_encode(['jsonrpc' => $version, 'service' => $service, 'method' => $method, 'params' => $data, 'id' => $id])); $read = $client->recv(); $client->close();