From e1620c483aaeb1d2116f65fb1d9377bc2f431348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 16 Dec 2020 16:34:15 +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 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/HttpServer/Route/Middleware.php b/HttpServer/Route/Middleware.php index bcddb3d3..6765841d 100644 --- a/HttpServer/Route/Middleware.php +++ b/HttpServer/Route/Middleware.php @@ -56,9 +56,9 @@ class Middleware public function getGenerate(Node $node): mixed { try { - if (is_array($node->handler) && is_object($node->handler[0])) { - $this->set_attributes($node); - } +// if (is_array($node->handler) && is_object($node->handler[0])) { +// } + $this->set_attributes($node); return $node->callback = Reduce::reduce(function () use ($node) { if (!request()->isOption) { var_dump($node); @@ -82,9 +82,13 @@ class Middleware */ private function set_attributes(Node $node) { + if (!is_array($node->handler)) { + return; + } [$controller, $action] = $node->handler; $attributes = Snowflake::app()->getAttributes(); $annotation = $attributes->getByClass(get_class($controller), $action); + var_dump($annotation); foreach ($annotation as $item) { if ($item instanceof Interceptor) { $node->addInterceptor($item->interceptor);