This commit is contained in:
2020-12-16 15:49:17 +08:00
parent 675d7692f6
commit 0de229e3b4
+3 -4
View File
@@ -56,9 +56,9 @@ class Middleware
public function getGenerate(Node $node): mixed public function getGenerate(Node $node): mixed
{ {
try { try {
if (is_array($node->handler) && is_object($node->handler[0])) { // if (is_array($node->handler) && is_object($node->handler[0])) {
$this->set_attributes($node); // $this->set_attributes($node);
} // }
return $node->callback = Reduce::reduce(function () use ($node) { return $node->callback = Reduce::reduce(function () use ($node) {
return Dispatch::create($node->handler, func_get_args())->dispatch(); return Dispatch::create($node->handler, func_get_args())->dispatch();
}, $this->annotation($node)); }, $this->annotation($node));
@@ -82,7 +82,6 @@ class Middleware
[$controller, $action] = $node->handler; [$controller, $action] = $node->handler;
$attributes = Snowflake::app()->getAttributes(); $attributes = Snowflake::app()->getAttributes();
$annotation = $attributes->getByClass(get_class($controller), $action); $annotation = $attributes->getByClass(get_class($controller), $action);
var_dump($annotation);
foreach ($annotation as $item) { foreach ($annotation as $item) {
if ($item instanceof Interceptor) { if ($item instanceof Interceptor) {
$node->addInterceptor($item->interceptor); $node->addInterceptor($item->interceptor);