mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-18 05:04:51 +08:00
fix route not working bug
This commit is contained in:
parent
cd52bfbfa5
commit
e8c8bd0ba7
@ -33,14 +33,14 @@ class HttpEventListener
|
||||
// TODO: 这里有个bug,如果是用的Workerman+Fiber协程的话,有个前置协程挂起,这里获取到的Event是被挂起的Event对象,触发两次事件才能归正
|
||||
// 跑一遍 BindEvent 绑定了 HttpRequestEvent 的注解
|
||||
$handler = new AnnotationHandler(BindEvent::class);
|
||||
$handler->setRuleCallback(fn (BindEvent $anno) => $anno->event_class === HttpRequestEvent::class);
|
||||
$handler->setRuleCallback(fn (BindEvent $anno) => is_a($anno->event_class, HttpRequestEvent::class, true));
|
||||
$handler->handleAll($event);
|
||||
// dump($event->getResponse());
|
||||
$node = null;
|
||||
/** @var null|array $params */
|
||||
$params = null;
|
||||
// 如果状态是 Normal,那么说明跑了一遍没有阻塞或者其他的情况,我就直接跑一遍内部的路由分发和静态文件分发
|
||||
if ($handler->getStatus() === AnnotationHandler::STATUS_NORMAL && $event->getResponse() === null) {
|
||||
if (($handler->getStatus() === AnnotationHandler::STATUS_NORMAL || $handler->getStatus() === AnnotationHandler::STATUS_RULE_FAILED) && $event->getResponse() === null) {
|
||||
// 解析路由和路由状态
|
||||
$result = HttpUtil::parseUri($event->getRequest(), $node, $params);
|
||||
switch ($result) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user