From 78aab734e1de5b18fc4a7063fd985412853e4cd8 Mon Sep 17 00:00:00 2001 From: Ying Date: Mon, 29 Aug 2022 19:29:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dsession=E3=80=81?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E9=A1=B5=E8=84=9A=E9=A1=B5=E5=A4=B4=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Index.php | 8 +++++ app/admin/controller/system/Admin.php | 4 ++- app/admin/view/index/index.html | 9 ++++++ app/common/library/ParseData.php | 7 +++-- app/functions.php | 31 +++++++------------ .../middleware/system/IndexInitialize.php | 9 ++++++ config/session.php | 4 +-- public/static/system/module/admin.js | 25 +++++++-------- 8 files changed, 59 insertions(+), 38 deletions(-) diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 096b4b8..f4e1d5c 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -17,6 +17,7 @@ use app\common\library\Email; use app\common\library\Ftp; use think\cache\driver\Memcached; use think\cache\driver\Redis; +use think\facade\Cache; use Webman\Event\Event; use app\common\model\system\Attachment; use app\common\model\system\Config; @@ -279,6 +280,7 @@ class Index extends AdminController $config[$key] = $option; } } + try { (new Config())->saveAll($config); $env = base_path() . '/.env'; @@ -293,6 +295,12 @@ class Index extends AdminController } catch (\Throwable $th) { return $this->error($th->getMessage()); } + + // 清理系统缓存 + $configList = Cache::get('config_list'); + foreach ($configList as $item) { + Cache::delete($item); + } } return $this->success('保存成功!'); diff --git a/app/admin/controller/system/Admin.php b/app/admin/controller/system/Admin.php index 99ba21d..3947f22 100644 --- a/app/admin/controller/system/Admin.php +++ b/app/admin/controller/system/Admin.php @@ -22,6 +22,7 @@ use app\common\model\system\AdminAccess as AdminAccessModel; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; +use think\facade\Cache; use Webman\Http\Request; /** @@ -541,7 +542,6 @@ class Admin extends AdminController /** * 清理系统缓存 * @return \support\Response - * @throws \think\Exception */ public function clear(): \support\Response { @@ -553,7 +553,9 @@ class Admin extends AdminController // 清理内容 if ($type == 'all' || $type == 'content') { + $session = session(AdminSession); \think\facade\Cache::clear(); + request()->session()->set(AdminSession, $session); } // 清理模板 diff --git a/app/admin/view/index/index.html b/app/admin/view/index/index.html index f2526d3..ed7585d 100644 --- a/app/admin/view/index/index.html +++ b/app/admin/view/index/index.html @@ -17,6 +17,15 @@ +