This commit is contained in:
2020-09-03 17:32:17 +08:00
parent d40b258aa4
commit 158973c6be
2 changed files with 3 additions and 16 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ class Middleware
$middleWares = $this->annotation($node);
$data = array_reduce(array_reverse($middleWares), $this->core(), $last);
$this->middleWares = [];
return $data;
return $node->callback = $data;
}
+2 -15
View File
@@ -287,20 +287,7 @@ class Node extends Application
if (empty($middles)) {
return;
}
foreach ($middles as $middle) {
if (empty($middle)) {
continue;
}
try {
if (is_array($middle)) {
$_tmp = $this->each($middle, $_tmp);
} else {
$_tmp[] = Snowflake::createObject($middle);
}
} catch (Exception $exception) {
}
}
$this->middleware = $_tmp;
$this->middleware = $this->each($middles, $_tmp);
$this->newExec();
}
@@ -313,7 +300,7 @@ class Node extends Application
if (!empty($this->handler)) {
$made = new Middleware();
$made->setMiddleWares($this->middleware);
$this->callback = $made->getGenerate($this);
$made->getGenerate($this);
}
return $this;
}