From 301a283833648c9d218450775060947764db390d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 3 Mar 2021 20:06:32 +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/Annotation.php | 5 +++-- HttpServer/Route/Middleware.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Annotation/Annotation.php b/Annotation/Annotation.php index 8d31a547..c9c23040 100644 --- a/Annotation/Annotation.php +++ b/Annotation/Annotation.php @@ -26,12 +26,13 @@ class Annotation extends Component /** * @param string $className + * @param string $method * @return array 根据类名获取注解 * 根据类名获取注解 */ - public function getMethods(string $className): array + public function getMethods(string $className, string $method = ''): array { - return $this->_loader->getMethod($className); + return $this->_loader->getMethod($className, $method); } diff --git a/HttpServer/Route/Middleware.php b/HttpServer/Route/Middleware.php index 4bb1e150..9e08b0b4 100644 --- a/HttpServer/Route/Middleware.php +++ b/HttpServer/Route/Middleware.php @@ -72,7 +72,7 @@ class Middleware } [$controller, $action] = $node->handler; $attributes = Snowflake::app()->getAttributes(); - $annotation = $attributes->getAnnotationByMethod($controller, $action); + $annotation = $attributes->getMethods($controller, $action); if (count($annotation) < 1) { return; }