From 81e7f5332167806456d05921f1d09566daf67b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=99=E7=A0=81=E7=94=9F=E8=8A=B1?= <18523774412@qq.com> Date: Thu, 16 Jun 2022 20:06:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95=E6=B2=A1=E6=9C=89=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/buildadmin.sql | 1 + app/admin/controller/Ajax.php | 3 ++ app/admin/controller/routine/Config.php | 4 +-- app/admin/lang/en/ajax.php | 2 ++ app/admin/lang/zh-cn/ajax.php | 2 ++ app/admin/lang/zh-cn/routine/config.php | 1 + app/admin/validate/Config.php | 41 +++++++++++++++++++++++++ config/upload.php | 2 +- 8 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 app/admin/validate/Config.php diff --git a/app/admin/buildadmin.sql b/app/admin/buildadmin.sql index 0769a049..33935716 100644 --- a/app/admin/buildadmin.sql +++ b/app/admin/buildadmin.sql @@ -303,6 +303,7 @@ INSERT INTO `__PREFIX__menu_rule` VALUES ('73', '71', 'button', '添加', 'secur INSERT INTO `__PREFIX__menu_rule` VALUES ('74', '71', 'button', '编辑', 'security/sensitiveData/edit', '', '', null, '', '', '0', 'none', '', '81', '1', '1648065864', '1647806129'); INSERT INTO `__PREFIX__menu_rule` VALUES ('75', '71', 'button', '删除', 'security/sensitiveData/del', '', '', null, '', '', '0', 'none', '', '81', '1', '1648065864', '1647806112'); INSERT INTO `__PREFIX__menu_rule` VALUES ('76', '0', 'menu', 'BuildAdmin', 'buildadmin/buildadmin', 'buildadmin', 'local-logo', 'link', 'https://doc.buildadmin.com', '', '0', 'none', '', '0', '0', '1651926977', '1648947396'); +INSERT INTO `__PREFIX__menu_rule` VALUES ('77', '45', 'button', '添加', 'routine/config/add', '', '', null, '', '', '0', 'none', '', '88', '1', '1655375826', '1655375812'); COMMIT; -- ---------------------------- diff --git a/app/admin/controller/Ajax.php b/app/admin/controller/Ajax.php index 500957a2..811a60f8 100644 --- a/app/admin/controller/Ajax.php +++ b/app/admin/controller/Ajax.php @@ -8,6 +8,7 @@ use think\exception\FileException; use app\common\library\Upload; use app\common\controller\Backend; use think\facade\Db; +use app\admin\model\AdminLog; class Ajax extends Backend { @@ -20,6 +21,7 @@ class Ajax extends Backend public function upload() { + AdminLog::setTitle(__('upload')); $file = $this->request->file('file'); try { $upload = new Upload($file); @@ -58,6 +60,7 @@ class Ajax extends Backend public function changeTerminalConfig() { + AdminLog::setTitle(__('changeTerminalConfig')); if (CommandExec::instance(false)->changeTerminalConfig()) { $this->success(''); } else { diff --git a/app/admin/controller/routine/Config.php b/app/admin/controller/routine/Config.php index 7e38989e..decbebb4 100644 --- a/app/admin/controller/routine/Config.php +++ b/app/admin/controller/routine/Config.php @@ -34,13 +34,13 @@ class Config extends Backend $list[$item['key']]['name'] = $item['key']; $list[$item['key']]['title'] = __($item['value']); - $newConfigGroup[$item['key']] = $item['value']; + $newConfigGroup[$item['key']] = $list[$item['key']]['title']; } $this->success('', [ 'list' => $list, 'remark' => get_route_remark(), - 'configGroup' => $newConfigGroup, + 'configGroup' => $newConfigGroup ?? [], 'quickEntrance' => get_sys_config('config_quick_entrance'), ]); } diff --git a/app/admin/lang/en/ajax.php b/app/admin/lang/en/ajax.php index 1352847f..b266aed5 100644 --- a/app/admin/lang/en/ajax.php +++ b/app/admin/lang/en/ajax.php @@ -2,4 +2,6 @@ return [ 'Failed to switch package manager. Please modify the configuration file manually:%s' => 'Failed to switch package manager. Please modify the configuration file manually:%s', 'Failed to modify the terminal configuration. Please modify the configuration file manually:%s' => 'Failed to modify the terminal configuration. Please modify the configuration file manually:%s', + 'upload' => 'Upload', + 'changeTerminalConfig' => 'change Terminal Config', ]; \ No newline at end of file diff --git a/app/admin/lang/zh-cn/ajax.php b/app/admin/lang/zh-cn/ajax.php index 98e5e9b9..50f5aad7 100644 --- a/app/admin/lang/zh-cn/ajax.php +++ b/app/admin/lang/zh-cn/ajax.php @@ -2,4 +2,6 @@ return [ 'Failed to switch package manager. Please modify the configuration file manually:%s' => '包管理器切换失败,请手动修改配置文件:%s', 'Failed to modify the terminal configuration. Please modify the configuration file manually:%s' => '修改终端配置失败,请手动修改配置文件:%s', + 'upload' => '上传文件', + 'changeTerminalConfig' => '修改终端配置', ]; \ No newline at end of file diff --git a/app/admin/lang/zh-cn/routine/config.php b/app/admin/lang/zh-cn/routine/config.php index 2d586ce3..3fe336f0 100644 --- a/app/admin/lang/zh-cn/routine/config.php +++ b/app/admin/lang/zh-cn/routine/config.php @@ -15,4 +15,5 @@ return [ 'smtp pass' => 'SMTP 密码', 'smtp verification' => 'SMTP 验证方式', 'smtp sender mail' => 'SMTP 发件人邮箱', + 'Variable name' => '变量名', ]; \ No newline at end of file diff --git a/app/admin/validate/Config.php b/app/admin/validate/Config.php new file mode 100644 index 00000000..63bb00c3 --- /dev/null +++ b/app/admin/validate/Config.php @@ -0,0 +1,41 @@ + 'require|unique:config', + ]; + + /** + * 验证提示信息 + * @var array + */ + protected $message = []; + + /** + * 字段描述 + */ + protected $field = [ + ]; + + /** + * 验证场景 + */ + protected $scene = [ + 'add' => ['name'], + ]; + + public function __construct() + { + $this->field = [ + 'name' => __('Variable name'), + ]; + parent::__construct(); + } +} \ No newline at end of file diff --git a/config/upload.php b/config/upload.php index c1b56d2f..60754040 100644 --- a/config/upload.php +++ b/config/upload.php @@ -5,7 +5,7 @@ return [ // 上传Url - 'url' => 'api/common/upload', + 'url' => 'api/ajax/upload', // cdn地址 'cdn' => '', // 文件保存格式化方法