From 7497620aebd1781e609ffe96786aa2e30ccc5211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Sun, 1 Sep 2024 22:18:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BA=94=E7=94=A8=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=8F=8A=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/think-library/src/Library.php | 2 +- plugin/think-library/src/extend/PhinxExtend.php | 2 +- .../src/support/middleware/MultAccess.php | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/plugin/think-library/src/Library.php b/plugin/think-library/src/Library.php index b11eb0b9e..f958003c6 100644 --- a/plugin/think-library/src/Library.php +++ b/plugin/think-library/src/Library.php @@ -108,7 +108,7 @@ class Library extends Service { // 动态加载全局配置 [$dir, $ext] = [$this->app->getBasePath(), $this->app->getConfigExt()]; - ToolsExtend::findFilesYield($dir, static function (SplFileInfo $info) use ($ext) { + ToolsExtend::findFilesYield($dir, function (SplFileInfo $info) use ($ext) { $info->getBasename() === "sys{$ext}" && include_once $info->getPathname(); }); if (is_file($file = "{$dir}common{$ext}")) include_once $file; diff --git a/plugin/think-library/src/extend/PhinxExtend.php b/plugin/think-library/src/extend/PhinxExtend.php index 2e15c014e..344740f31 100644 --- a/plugin/think-library/src/extend/PhinxExtend.php +++ b/plugin/think-library/src/extend/PhinxExtend.php @@ -292,7 +292,7 @@ CODE; private static function nextFile(string $class): string { [$filename, $versions, $startVersion] = [Str::snake($class), [], 20009999999999]; - ToolsExtend::findFilesYield(syspath('database/migrations'), static function (SplFileInfo $info) use ($class, $filename, &$versions) { + ToolsExtend::findFilesYield(syspath('database/migrations'), function (SplFileInfo $info) use ($class, $filename, &$versions) { $bname = pathinfo($info->getBasename(), PATHINFO_FILENAME); $versions[] = $version = intval(substr($bname, 0, 14)); if ($filename === substr($bname, 15) && unlink($info->getRealPath())) { diff --git a/plugin/think-library/src/support/middleware/MultAccess.php b/plugin/think-library/src/support/middleware/MultAccess.php index b82db5972..2dd6a355e 100644 --- a/plugin/think-library/src/support/middleware/MultAccess.php +++ b/plugin/think-library/src/support/middleware/MultAccess.php @@ -166,21 +166,27 @@ class MultAccess private function loadMultiApp(string $appPath): bool { [$ext, $fmaps] = [$this->app->getConfigExt(), []]; + // 加载应用函数文件 if (is_file($file = "{$appPath}common{$ext}")) include_once $file; - ToolsExtend::findFilesYield($appPath . 'config', static function (SplFileInfo $info) use ($ext) { - if (strtolower(".{$info->getExtension()}") === "{$ext}") { + // 加载应用配置文件 + ToolsExtend::findFilesYield($appPath . 'config', function (SplFileInfo $info) use ($ext) { + if (strtolower(".{$info->getExtension()}") === $ext) { $this->app->config->load($info->getPathname(), $info->getBasename($ext)); } }); + // 加载应用路由配置 if (in_array('route', $fmaps) && method_exists($this->app->route, 'reload')) { $this->app->route->reload(); } + // 加载应用映射配置 if (is_file($file = "{$appPath}provider{$ext}")) { $this->app->bind(include $file); } + // 加载应用事件配置 if (is_file($file = "{$appPath}event{$ext}")) { $this->app->loadEvent(include $file); } + // 加载应用中间键配置 if (is_file($file = "{$appPath}middleware{$ext}")) { $this->app->middleware->import(include $file, 'app'); }