This commit is contained in:
2020-09-01 00:32:48 +08:00
parent 34cd277c25
commit e979332f01
3 changed files with 54 additions and 15 deletions
+21 -5
View File
@@ -62,6 +62,24 @@ class Node extends Application
return $this->newExec();
}
/**
* @return bool
*/
public function hasInterceptor()
{
return count($this->_interceptors) > 0;
}
/**
* @return array
*/
public function getInterceptor()
{
return $this->_interceptors;
}
/**
* @param $request
* @return bool
@@ -133,10 +151,7 @@ class Node extends Application
/** @var Annotation $annotation */
$annotation = Snowflake::createObject(Annotation::class);
if (!empty($methods)) {
$annotations = $annotation->instance($reflect);
if (isset($annotations['Interceptor'])) {
}
$this->_interceptors = $annotation->instance($reflect, $action);
}
return [$reflect->newInstance(), $action];
} catch (Exception $exception) {
@@ -146,6 +161,7 @@ class Node extends Application
}
}
/**
* @return string
* 错误信息
@@ -297,7 +313,7 @@ class Node extends Application
if (!empty($this->handler)) {
$made = new Middleware();
$made->setMiddleWares($this->middleware);
$this->callback = $made->getGenerate($this->handler);
$this->callback = $made->getGenerate($this);
}
return $this;
}