From 3722bed21016a1c6dea0867f6f9bb5b51683162f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Mon, 13 Sep 2021 16:37:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/api/Runtime.php | 5 +++-- app/admin/model/SystemConfig.php | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 app/admin/model/SystemConfig.php diff --git a/app/admin/controller/api/Runtime.php b/app/admin/controller/api/Runtime.php index ff39839fb..1f1252018 100644 --- a/app/admin/controller/api/Runtime.php +++ b/app/admin/controller/api/Runtime.php @@ -16,6 +16,7 @@ namespace app\admin\controller\api; +use app\admin\model\SystemConfig; use think\admin\Controller; use think\admin\service\AdminService; use think\admin\service\SystemService; @@ -97,13 +98,13 @@ class Runtime extends Controller if (AdminService::instance()->isSuper()) try { $this->app->db->transaction(function () { [$tmpdata, $newdata] = [[], []]; - foreach ($this->app->db->name('SystemConfig')->order('type,name asc')->cursor() as $item) { + foreach (SystemConfig::mk()->order('type,name asc')->cursor() as $item) { $tmpdata[$item['type']][$item['name']] = $item['value']; } foreach ($tmpdata as $type => $items) foreach ($items as $name => $value) { $newdata[] = ['type' => $type, 'name' => $name, 'value' => $value]; } - $this->_query('SystemConfig')->empty()->insertAll($newdata); + SystemConfig::mQuery()->empty()->insertAll($newdata); }); $this->app->cache->delete('SystemConfig'); sysoplog('系统运维管理', '清理系统参数配置成功'); diff --git a/app/admin/model/SystemConfig.php b/app/admin/model/SystemConfig.php new file mode 100644 index 000000000..62356347b --- /dev/null +++ b/app/admin/model/SystemConfig.php @@ -0,0 +1,15 @@ +