From 4b5c6d3316a86ca90af9936230556cf1b4c82fde Mon Sep 17 00:00:00 2001 From: Anyon Date: Thu, 28 Nov 2019 17:41:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BD=91=E7=AB=99=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Index.php | 34 +++++++++++++++++++++++++++++++++ app/admin/view/index/index.html | 6 ++++++ public/static/admin.js | 2 -- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 754d8b42d..5b04b4703 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -18,6 +18,7 @@ namespace app\admin\controller; use think\admin\Controller; use think\admin\service\AdminService; use think\admin\service\MenuService; +use think\exception\HttpResponseException; /** * 后台界面入口 @@ -110,4 +111,37 @@ class Index extends Controller } } + /** + * 网站压缩发布 + * @login true + */ + public function optimize() + { + try { + $this->app->console->call('optimize:route'); + $this->app->console->call('optimize:schema'); + $this->success('网站压缩加速成功!'); + } catch (HttpResponseException $exception) { + throw $exception; + } catch (\Exception $e) { + $this->error($e->getMessage()); + } + } + + /** + * 清理运行缓存 + * @login true + */ + public function clear() + { + try { + $this->app->console->call('clear'); + $this->success('清理网站缓存成功!'); + } catch (HttpResponseException $exception) { + throw $exception; + } catch (\Exception $e) { + $this->error($e->getMessage()); + } + } + } \ No newline at end of file diff --git a/app/admin/view/index/index.html b/app/admin/view/index/index.html index 6709b2b73..5603059e9 100644 --- a/app/admin/view/index/index.html +++ b/app/admin/view/index/index.html @@ -58,6 +58,12 @@ 安全设置 +
+ 缓存加速 +
+
+ 清理缓存 +
退出登录 diff --git a/public/static/admin.js b/public/static/admin.js index a5fdec211..83aa7212f 100644 --- a/public/static/admin.js +++ b/public/static/admin.js @@ -746,8 +746,6 @@ $(function () { this.value = (parseFloat(this.value) || 0).toFixed(fiexd); }); - - /*! 图片加载异常处理 */ document.addEventListener('error', function (e, elem) { elem = e.target;