ComposerUpdate

This commit is contained in:
Anyon 2020-04-16 15:17:03 +08:00
parent 9a39ef254a
commit a9b96826e1
6 changed files with 23 additions and 17 deletions

View File

@ -92,6 +92,7 @@ class Config extends Controller
$this->error("后台入口名称{$xpath}已经存在应用!"); $this->error("后台入口名称{$xpath}已经存在应用!");
} }
SystemService::instance()->setRuntime([$xpath => 'admin']); SystemService::instance()->setRuntime([$xpath => 'admin']);
SystemService::instance()->bindRuntime();
} }
foreach ($this->request->post() as $name => $value) sysconf($name, $value); foreach ($this->request->post() as $name => $value) sysconf($name, $value);
$this->success('修改系统参数成功!', sysuri("{$xpath}/index/index") . '#' . url("{$xpath}/config/index")); $this->success('修改系统参数成功!', sysuri("{$xpath}/index/index") . '#' . url("{$xpath}/config/index"));

View File

@ -7,11 +7,11 @@
<label class="relative block"> <label class="relative block">
<span class="color-green font-w7">后台入口地址</span> <span class="color-green font-w7">后台入口地址</span>
<span class="color-blue margin-left-5">{:sysuri('admin/index/index',[],false,true)}</span> <span class="color-blue margin-left-5">{:sysuri('admin/index/index',[],false,true)}</span>
<span class="layui-input inline-block layui-clear"> <span class="layui-input inline-block">
<b class="pull-left">{:sysuri('@',[],false,true)}</b> <span>{:sysuri('@',[],false,true)}</span>
<input required pattern="[a-zA-Z_][a-zA-Z0-9_]+" placeholder="请完善后台入口地址" class="layui-input inline-block pull-left border-0" style="width:auto;background:none" value="{:trim(sysuri('admin/index/index'),'/')}" name="xpath"> <input autofocus required pattern="[a-zA-Z_][a-zA-Z0-9_]+" placeholder="请输入后台入口名称" class="layui-input inline-block padding-0 border-0" style="width:auto;background:none" value="{:trim(sysuri('admin/index/index'),'/')}" name="xpath">
</span> </span>
<span class="help-block">后台入口名称由英文字母开头且不能存在相同名称的应用,设置之后原地址不能继续访问!</span> <span class="help-block">名称由英文字母开头且不能存在相同名称的应用,设置之后原地址不能继续访问!</span>
</label> </label>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">

8
composer.lock generated
View File

@ -909,12 +909,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "047910e4b4c0d9af6759f823bc3e35364b3ecc54" "reference": "b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/047910e4b4c0d9af6759f823bc3e35364b3ecc54", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e",
"reference": "047910e4b4c0d9af6759f823bc3e35364b3ecc54", "reference": "b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -958,7 +958,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top", "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", "name": "zoujingli/wechat-developer",

View File

@ -935,12 +935,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "047910e4b4c0d9af6759f823bc3e35364b3ecc54" "reference": "b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/047910e4b4c0d9af6759f823bc3e35364b3ecc54", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e",
"reference": "047910e4b4c0d9af6759f823bc3e35364b3ecc54", "reference": "b8c0f8bbb01cecaf6ac42c1be10a9cf54e16a50e",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -956,7 +956,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2020-04-16T06:29:58+00:00", "time": "2020-04-16T07:13:37+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-04-16 14:32:59 // This file is automatically generated at:2020-04-16 15:15:34
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -220,8 +220,8 @@ class SystemService extends Service
public function setRuntime($map = [], $run = null) public function setRuntime($map = [], $run = null)
{ {
$data = $this->getRuntime(); $data = $this->getRuntime();
if (is_array($map)) foreach ($data['app_map'] as $kk => $vv) foreach ($map as $oo) { if (is_array($map) && count($map) > 0 && count($data['app_map']) > 0) {
if ($oo === $vv) unset($data['app_map'][$kk]); foreach ($data['app_map'] as $kk => $vv) if (in_array($vv, $map)) unset($data['app_map'][$kk]);
} }
$file = "{$this->app->getRootPath()}runtime/config.json"; $file = "{$this->app->getRootPath()}runtime/config.json";
$data['app_run'] = is_null($run) ? $data['app_run'] : $run; $data['app_run'] = is_null($run) ? $data['app_run'] : $run;
@ -253,6 +253,9 @@ class SystemService extends Service
$data = $this->getRuntime(); $data = $this->getRuntime();
if (!empty($data['app_map'])) { if (!empty($data['app_map'])) {
$maps = $this->app->config->get('app.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'); $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) 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(); $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", '|/\.html$|'], ['$1', '$1', '$1', ''], $location);
return preg_replace(["|^/{$d1}/{$d2}/{$d3}(\.html)?$|i", "|/{$d2}/{$d3}(\.html)?$|i", "|/{$d3}(\.html)?$|i"], '', $location);
} }
} }