From ddf90f2b6df2f1dbe3eb5f0a07d2bc89c7b6eafa Mon Sep 17 00:00:00 2001 From: Anyon Date: Thu, 16 Apr 2020 14:47:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=8E=E5=8F=B0=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E8=AE=BE=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Config.php | 14 ++++++-- app/admin/view/auth/apply.html | 4 +-- app/admin/view/config/system.html | 10 ++++++ composer.lock | 8 ++--- vendor/composer/installed.json | 8 ++--- vendor/services.php | 2 +- .../src/service/SystemService.php | 33 +++++++------------ 7 files changed, 44 insertions(+), 35 deletions(-) diff --git a/app/admin/controller/Config.php b/app/admin/controller/Config.php index 022203ce3..c247b869d 100644 --- a/app/admin/controller/Config.php +++ b/app/admin/controller/Config.php @@ -16,6 +16,7 @@ namespace app\admin\controller; use think\admin\Controller; +use think\admin\service\SystemService; /** * 系统参数配置 @@ -83,10 +84,17 @@ class Config extends Controller $this->title = '修改系统参数'; $this->fetch(); } else { - foreach ($this->request->post() as $name => $value) { - sysconf($name, $value); + if ($xpath = $this->request->post('xpath')) { + if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]+$/', $xpath)) { + $this->error('后台入口名称需要是由英文字母开头!'); + } + if ($xpath !== 'admin' && file_exists($this->app->getBasePath() . $xpath)) { + $this->error("后台入口名称{$xpath}已经存在应用!"); + } + SystemService::instance()->setRuntime([$xpath => 'admin']); } - $this->success('修改系统参数成功!'); + 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/auth/apply.html b/app/admin/view/auth/apply.html index 9fbbe2a8b..e73a3fc7e 100644 --- a/app/admin/view/auth/apply.html +++ b/app/admin/view/auth/apply.html @@ -36,7 +36,7 @@ }; this.getData = function (that, index) { index = $.msg.loading(); - $.form.load('{:url()}', {id: '{$vo.id}', action: 'get'}, 'post', function (ret) { + $.form.load('{:url("apply")}', {id: '{$vo.id}', action: 'get'}, 'post', function (ret) { that.data = that.renderChildren(ret.data, 1); return $.msg.close(index), that.showTree(), false; }); @@ -54,7 +54,7 @@ this.submit = function () { var nodes = [], data = this.ztree.getCheckedNodes(true); for (var i in data) if (data[i].node) nodes.push(data[i].node); - $.form.load('{:url()}', {id: '{$vo.id}', action: 'save', nodes: nodes}, 'post'); + $.form.load('{:url("apply")}', {id: '{$vo.id}', action: 'save', nodes: nodes}, 'post'); }; // 刷新数据 this.getData(this); diff --git a/app/admin/view/config/system.html b/app/admin/view/config/system.html index b0e63bd0a..868bdb90c 100644 --- a/app/admin/view/config/system.html +++ b/app/admin/view/config/system.html @@ -3,6 +3,16 @@
网站参数
+
+ +