From a9b96826e1a8362ab64f297f619cd310b87bd652 Mon Sep 17 00:00:00 2001 From: Anyon Date: Thu, 16 Apr 2020 15:17:03 +0800 Subject: [PATCH] ComposerUpdate --- app/admin/controller/Config.php | 1 + app/admin/view/config/system.html | 8 ++++---- composer.lock | 8 ++++---- vendor/composer/installed.json | 8 ++++---- vendor/services.php | 2 +- .../think-library/src/service/SystemService.php | 13 +++++++++---- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/app/admin/controller/Config.php b/app/admin/controller/Config.php index c247b869d..63b2610ae 100644 --- a/app/admin/controller/Config.php +++ b/app/admin/controller/Config.php @@ -92,6 +92,7 @@ class Config extends Controller $this->error("后台入口名称{$xpath}已经存在应用!"); } SystemService::instance()->setRuntime([$xpath => 'admin']); + SystemService::instance()->bindRuntime(); } foreach ($this->request->post() as $name => $value) sysconf($name, $value); $this->success('修改系统参数成功!', sysuri("{$xpath}/index/index") . '#' . url("{$xpath}/config/index")); diff --git a/app/admin/view/config/system.html b/app/admin/view/config/system.html index 84075f70e..cb44846c5 100644 --- a/app/admin/view/config/system.html +++ b/app/admin/view/config/system.html @@ -7,11 +7,11 @@
diff --git a/composer.lock b/composer.lock index b815f200a..198a6fa45 100644 --- a/composer.lock +++ b/composer.lock @@ -909,12 +909,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "047910e4b4c0d9af6759f823bc3e35364b3ecc54" + "reference": "b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/047910e4b4c0d9af6759f823bc3e35364b3ecc54", - "reference": "047910e4b4c0d9af6759f823bc3e35364b3ecc54", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e", + "reference": "b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e", "shasum": "", "mirrors": [ { @@ -958,7 +958,7 @@ ], "description": "ThinkPHP v6.0 Development Library", "homepage": "http://framework.thinkadmin.top", - "time": "2020-04-16T06:29:58+00:00" + "time": "2020-04-16T07:13:37+00:00" }, { "name": "zoujingli/wechat-developer", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index b405c75cb..a8becb218 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -935,12 +935,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "047910e4b4c0d9af6759f823bc3e35364b3ecc54" + "reference": "b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/047910e4b4c0d9af6759f823bc3e35364b3ecc54", - "reference": "047910e4b4c0d9af6759f823bc3e35364b3ecc54", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e", + "reference": "b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e", "shasum": "", "mirrors": [ { @@ -956,7 +956,7 @@ "ext-json": "*", "topthink/framework": "^6.0" }, - "time": "2020-04-16T06:29:58+00:00", + "time": "2020-04-16T07:13:37+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index 51cfd5faa..e466a6adc 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\app\\Service', diff --git a/vendor/zoujingli/think-library/src/service/SystemService.php b/vendor/zoujingli/think-library/src/service/SystemService.php index c081fc8f5..b4810819b 100644 --- a/vendor/zoujingli/think-library/src/service/SystemService.php +++ b/vendor/zoujingli/think-library/src/service/SystemService.php @@ -220,8 +220,8 @@ class SystemService extends Service public function setRuntime($map = [], $run = null) { $data = $this->getRuntime(); - if (is_array($map)) foreach ($data['app_map'] as $kk => $vv) foreach ($map as $oo) { - if ($oo === $vv) unset($data['app_map'][$kk]); + if (is_array($map) && count($map) > 0 && count($data['app_map']) > 0) { + foreach ($data['app_map'] as $kk => $vv) if (in_array($vv, $map)) unset($data['app_map'][$kk]); } $file = "{$this->app->getRootPath()}runtime/config.json"; $data['app_run'] = is_null($run) ? $data['app_run'] : $run; @@ -253,6 +253,9 @@ class SystemService extends Service $data = $this->getRuntime(); if (!empty($data['app_map'])) { $maps = $this->app->config->get('app.app_map', []); + if (is_array($maps) && count($maps) > 0 && count($data['app_map']) > 0) { + foreach ($maps as $kk => $vv) if (in_array($vv, $data['app_map'])) unset($maps[$kk]); + } $this->app->config->set(['app_map' => array_merge($maps, $data['app_map'])], 'app'); } // 动态设置当前运行模式 @@ -269,9 +272,11 @@ class SystemService extends Service */ public function sysuri($url = '', array $vars = [], $suffix = false, $domain = false) { + $d1 = $this->app->config->get('app.default_app'); + $d2 = $this->app->config->get('route.default_controller'); + $d3 = $this->app->config->get('route.default_action'); $location = $this->app->route->buildUrl($url, $vars)->suffix($suffix)->domain($domain)->build(); - [$d1, $d2, $d3] = [$this->app->config->get('app.default_app'), $this->app->config->get('route.default_controller'), $this->app->config->get('route.default_action'),]; - return preg_replace(["|^/{$d1}/{$d2}/{$d3}(\.html)?$|i", "|/{$d2}/{$d3}(\.html)?$|i", "|/{$d3}(\.html)?$|i"], '', $location); + return preg_replace(["|^/{$d1}/{$d2}/{$d3}(\.html)?$|i", "|/{$d2}/{$d3}(\.html)?$|i", "|/{$d3}(\.html)?$|i", '|/\.html$|'], ['$1', '$1', '$1', ''], $location); } } \ No newline at end of file