This commit is contained in:
2021-03-05 17:11:47 +08:00
parent 04ad150bba
commit bfebcce204
4 changed files with 49 additions and 37 deletions
+9
View File
@@ -4,6 +4,14 @@
namespace Annotation;
use Annotation\Route\After;
use Annotation\Route\Interceptor;
use Annotation\Route\Limits;
use Annotation\Route\Middleware as RMiddleware;
use HttpServer\Route\Node;
use ReflectionException;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
/**
@@ -23,4 +31,5 @@ abstract class Attribute implements IAnnotation
return $this;
}
}
+2 -1
View File
@@ -43,7 +43,8 @@ use Snowflake\Snowflake;
// TODO: Implement setHandler() method.
$router = Snowflake::app()->getRouter();
$router->addRoute($this->uri, $handler, $this->method);
$node = $router->addRoute($this->uri, $handler, $this->method);
$node::annotationInject($node, get_class($handler[0]), $handler[1]);
return $router;
}
+3 -1
View File
@@ -53,7 +53,9 @@ use Snowflake\Snowflake;
$method = $this->event . '::' . (is_null($this->uri) ? 'event' : $this->uri);
$router->addRoute($method, $handler, 'sw::socket');
$node = $router->addRoute($method, $handler, 'sw::socket');
$node::annotationInject($node, get_class($handler[0]), $handler[1]);
return $router;
}