From 54045e6bae78472eb9ad92792e73aaa7f886c9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 4 Mar 2021 00:20:21 +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/Middleware.php | 6 ++++-- HttpServer/Route/Middleware.php | 1 - HttpServer/Route/Node.php | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Annotation/Route/Middleware.php b/Annotation/Route/Middleware.php index 15412b25..aaa9c767 100644 --- a/Annotation/Route/Middleware.php +++ b/Annotation/Route/Middleware.php @@ -25,14 +25,16 @@ use Snowflake\Snowflake; if (is_string($this->middleware)) { $this->middleware = [$this->middleware]; } + + $array = []; foreach ($this->middleware as $key => $value) { $sn = Snowflake::createObject($value); - if (!($sn instanceof \HttpServer\IInterface\Middleware)) { continue; } - $this->middleware[$key] = [$sn, 'onHandler']; + $array[] = [$sn, 'onHandler']; } + $this->middleware = $array; } diff --git a/HttpServer/Route/Middleware.php b/HttpServer/Route/Middleware.php index a23c40e1..6eab96c2 100644 --- a/HttpServer/Route/Middleware.php +++ b/HttpServer/Route/Middleware.php @@ -76,7 +76,6 @@ class Middleware if (empty($annotation)) { return; } - var_dump($annotation, $action); foreach ($annotation as $name => $_attribute) { foreach ($_attribute as $attribute) { if ($attribute instanceof Interceptor) { diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 99dc7a8e..c11d18d6 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -405,6 +405,7 @@ class Node extends HttpService $class = [$class]; } foreach ($class as $closure) { + var_dump($closure); if (in_array($closure, $this->middleware)) { continue; }