This commit is contained in:
2021-03-04 00:11:47 +08:00
parent b3bb429523
commit 0921ca12ae
+14 -13
View File
@@ -73,22 +73,23 @@ class Middleware
[$controller, $action] = $node->handler; [$controller, $action] = $node->handler;
$attributes = Snowflake::app()->getAttributes(); $attributes = Snowflake::app()->getAttributes();
$annotation = $attributes->getMethods(get_class($controller), $action); $annotation = $attributes->getMethods(get_class($controller), $action);
var_dump($annotation);
if (empty($annotation)) { if (empty($annotation)) {
return; return;
} }
foreach ($annotation as $attribute) { foreach ($annotation as $name => $_attribute) {
if ($attribute instanceof Interceptor) { foreach ($_attribute as $attribute){
$node->addInterceptor($attribute->interceptor); if ($attribute instanceof Interceptor) {
} $node->addInterceptor($attribute->interceptor);
if ($attribute instanceof After) { }
$node->addAfter($attribute->after); if ($attribute instanceof After) {
} $node->addAfter($attribute->after);
if ($attribute instanceof RMiddleware) { }
$node->addMiddleware($attribute->middleware); if ($attribute instanceof RMiddleware) {
} $node->addMiddleware($attribute->middleware);
if ($attribute instanceof Limits) { }
$node->addLimits($attribute->limits); if ($attribute instanceof Limits) {
$node->addLimits($attribute->limits);
}
} }
} }
} }