From 98681a0dfa030b7d3c21f5f4a837f5a247666687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Mar 2021 15:21:12 +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 --- Annotation/Route/Cmd.php | 51 -------------------------------- Annotation/Route/RpcService.php | 52 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 51 deletions(-) delete mode 100644 Annotation/Route/Cmd.php create mode 100644 Annotation/Route/RpcService.php diff --git a/Annotation/Route/Cmd.php b/Annotation/Route/Cmd.php deleted file mode 100644 index f6062d6f..00000000 --- a/Annotation/Route/Cmd.php +++ /dev/null @@ -1,51 +0,0 @@ -getRouter(); - - $router->addRoute($this->cmd, $handler, Request::HTTP_CMD); - - return $router; - } - - -} diff --git a/Annotation/Route/RpcService.php b/Annotation/Route/RpcService.php new file mode 100644 index 00000000..e546e5ca --- /dev/null +++ b/Annotation/Route/RpcService.php @@ -0,0 +1,52 @@ +uri = 'rpc/' . $this->port . '/' . ltrim($this->cmd, '/'); + } + + + /** + * @param array $handler + * @return Router + * @throws ConfigException + * @throws Exception + */ + public function execute(array $handler): Router + { + // TODO: Implement setHandler() method. + $router = Snowflake::app()->getRouter(); + + $router->addRoute($this->uri, $handler, Request::HTTP_CMD); + + return $router; + } + + +}