From f0cb6b251ccea50e30c8d64480288989a87aa58a Mon Sep 17 00:00:00 2001 From: wolfcode <37436228+wolf-leo@users.noreply.github.com> Date: Thu, 7 Sep 2023 01:58:44 +0800 Subject: [PATCH] Update Config.php --- app/admin/controller/system/Config.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/admin/controller/system/Config.php b/app/admin/controller/system/Config.php index 396bbd0..d42103e 100644 --- a/app/admin/controller/system/Config.php +++ b/app/admin/controller/system/Config.php @@ -38,7 +38,8 @@ class Config extends AdminController public function save() { $this->checkPostRequest(); - $post = $this->request->post(); + $post = $this->request->post(); + $notAddFields = ['_token', 'file', 'group']; try { $group = $post['group'] ?? ''; if (empty($group)) $this->error('保存失败'); @@ -48,10 +49,11 @@ class Config extends AdminController $this->model->where('name', 'upload_allow_type')->update(['value' => implode(',', array_keys($upload_types))]); } foreach ($post as $key => $val) { + if (in_array($key, $notAddFields)) continue; if ($this->model->where('name', $key)->count()) { $this->model->where('name', $key)->update(['value' => $val,]); } else { - $this->model->save( + $this->model->create( [ 'name' => $key, 'value' => $val,