From 25b93d7ff16f91c7c968c9b72b5cb679d3f3b1b8 Mon Sep 17 00:00:00 2001 From: wentao <12077025931@qq.com> Date: Tue, 23 Apr 2024 15:59:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=AF=B9multi-app?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Http.php b/src/Http.php index 1bd9f7b..4464fcc 100644 --- a/src/Http.php +++ b/src/Http.php @@ -18,36 +18,36 @@ class Http extends \think\Http /** @var Middleware */ protected static $middleware; - /** @var Route */ + /** @var Route[] */ protected static $route; protected function loadMiddleware(): void { - if (!isset(self::$middleware)) { + if (!isset(self::$middleware[$this->app->http->name])) { parent::loadMiddleware(); - self::$middleware = clone $this->app->middleware; - $this->modifyProperty(self::$middleware, null); + self::$middleware[$this->app->http->name] = clone $this->app->middleware; + $this->modifyProperty(self::$middleware[$this->app->http->name], null); } - $middleware = clone self::$middleware; + $middleware = clone self::$middleware[$this->app->http->name]; $this->modifyProperty($middleware, $this->app); $this->app->instance("middleware", $middleware); } protected function loadRoutes(): void { - if (!isset(self::$route)) { + if (!isset(self::$route[$this->app->http->name])) { parent::loadRoutes(); - self::$route = clone $this->app->route; - $this->modifyProperty(self::$route, null); - $this->modifyProperty(self::$route, null, 'request'); + self::$route[$this->app->http->name] = clone $this->app->route; + $this->modifyProperty(self::$route[$this->app->http->name], null); + $this->modifyProperty(self::$route[$this->app->http->name], null, 'request'); } } protected function dispatchToRoute($request) { - if (isset(self::$route)) { - $newRoute = clone self::$route; + if (isset(self::$route[$this->app->http->name])) { + $newRoute = clone self::$route[$this->app->http->name]; $this->modifyProperty($newRoute, $this->app); $this->app->instance("route", $newRoute); } From 570aeaba077075ed26c8d83d981feaa11bd1f69e Mon Sep 17 00:00:00 2001 From: wentao <12077025931@qq.com> Date: Tue, 23 Apr 2024 16:12:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=AF=B9multi-app?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http.php b/src/Http.php index 4464fcc..6082d18 100644 --- a/src/Http.php +++ b/src/Http.php @@ -15,7 +15,7 @@ class Http extends \think\Http { use ModifyProperty; - /** @var Middleware */ + /** @var Middleware[] */ protected static $middleware; /** @var Route[] */