From 0921ca12aefde8cc5d1c4b1deb4bef4e6272a6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 4 Mar 2021 00:11:47 +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 --- HttpServer/Route/Middleware.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/HttpServer/Route/Middleware.php b/HttpServer/Route/Middleware.php index 125cc246..1ad931ae 100644 --- a/HttpServer/Route/Middleware.php +++ b/HttpServer/Route/Middleware.php @@ -73,22 +73,23 @@ class Middleware [$controller, $action] = $node->handler; $attributes = Snowflake::app()->getAttributes(); $annotation = $attributes->getMethods(get_class($controller), $action); - var_dump($annotation); if (empty($annotation)) { return; } - foreach ($annotation as $attribute) { - if ($attribute instanceof Interceptor) { - $node->addInterceptor($attribute->interceptor); - } - if ($attribute instanceof After) { - $node->addAfter($attribute->after); - } - if ($attribute instanceof RMiddleware) { - $node->addMiddleware($attribute->middleware); - } - if ($attribute instanceof Limits) { - $node->addLimits($attribute->limits); + foreach ($annotation as $name => $_attribute) { + foreach ($_attribute as $attribute){ + if ($attribute instanceof Interceptor) { + $node->addInterceptor($attribute->interceptor); + } + if ($attribute instanceof After) { + $node->addAfter($attribute->after); + } + if ($attribute instanceof RMiddleware) { + $node->addMiddleware($attribute->middleware); + } + if ($attribute instanceof Limits) { + $node->addLimits($attribute->limits); + } } } }