diff --git a/HttpServer/Route/Dispatch/Dispatch.php b/HttpServer/Route/Dispatch/Dispatch.php deleted file mode 100644 index 37337e87..00000000 --- a/HttpServer/Route/Dispatch/Dispatch.php +++ /dev/null @@ -1,63 +0,0 @@ -handler = $handler; - if ($handler instanceof Closure) { - $class->bind(); - } - return $class; - } - - - /** - * @return mixed - * 执行函数 - * @throws \Exception - */ - public function dispatch(): mixed - { - $dispatchParam = Context::getContext('dispatch-param'); - if (empty($dispatchParam)) { - $dispatchParam = [\request()]; - } - return \aop($this->handler, $dispatchParam); - } - - - /** - * - */ - protected function bind() - { - $this->handler = Closure::bind($this->handler, new Controller()); - } - -} diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 0d60ef6a..ea56ec33 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -17,7 +17,6 @@ use HttpServer\Controller; use HttpServer\Http\Context; use HttpServer\Http\Request; use HttpServer\HttpFilter; -use HttpServer\Route\Dispatch\Dispatch; use JetBrains\PhpStorm\Pure; use Snowflake\Core\Json; use Snowflake\Snowflake; @@ -127,7 +126,11 @@ class Node extends HttpService public function createDispatch(): Closure { return function () { - return Dispatch::create($this->handler)->dispatch(); + $dispatchParam = Context::getContext('dispatch-param'); + if (empty($dispatchParam)) { + $dispatchParam = [\request()]; + } + return \aop($this->handler, $dispatchParam); }; }