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;