From 1eff51022e9c627dc01e4fe8025955abf2837d31 Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 23 Nov 2020 11:22:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/api/Plugs.php | 75 +++++++++++++++--------------- app/admin/view/index/index.html | 4 +- 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/app/admin/controller/api/Plugs.php b/app/admin/controller/api/Plugs.php index e4d1e7ccb..852845e05 100644 --- a/app/admin/controller/api/Plugs.php +++ b/app/admin/controller/api/Plugs.php @@ -38,43 +38,6 @@ class Plugs extends Controller $this->fetch(realpath(__DIR__ . '/../../view/api/icon.html')); } - /** - * 网站压缩发布 - * @login true - */ - public function push() - { - if (AdminService::instance()->isSuper()) try { - AdminService::instance()->clearCache(); - SystemService::instance()->pushRuntime(); - $this->success('网站缓存加速成功!'); - } catch (HttpResponseException $exception) { - throw $exception; - } catch (\Exception $exception) { - $this->error($exception->getMessage()); - } else { - $this->error('只有超级管理员才能操作!'); - } - } - - /** - * 清理运行缓存 - * @login true - */ - public function clear() - { - if (AdminService::instance()->isSuper()) try { - AdminService::instance()->clearCache(); - SystemService::instance()->clearRuntime(); - $this->success('清理网站缓存成功!'); - } catch (HttpResponseException $exception) { - throw $exception; - } catch (\Exception $exception) { - $this->error($exception->getMessage()); - } else { - $this->error('只有超级管理员才能操作!'); - } - } /** * 当前运行模式 @@ -157,4 +120,42 @@ class Plugs extends Controller $this->error('只有超级管理员才能操作!'); } } + + /** + * 网站压缩发布 + * @login true + */ + public function pushRuntime() + { + if (AdminService::instance()->isSuper()) try { + AdminService::instance()->clearCache(); + SystemService::instance()->pushRuntime(); + $this->success('网站缓存加速成功!'); + } catch (HttpResponseException $exception) { + throw $exception; + } catch (\Exception $exception) { + $this->error($exception->getMessage()); + } else { + $this->error('只有超级管理员才能操作!'); + } + } + + /** + * 清理运行缓存 + * @login true + */ + public function clearRuntime() + { + if (AdminService::instance()->isSuper()) try { + AdminService::instance()->clearCache(); + SystemService::instance()->clearRuntime(); + $this->success('清理网站缓存成功!'); + } catch (HttpResponseException $exception) { + throw $exception; + } catch (\Exception $exception) { + $this->error($exception->getMessage()); + } else { + $this->error('只有超级管理员才能操作!'); + } + } } \ No newline at end of file diff --git a/app/admin/view/index/index.html b/app/admin/view/index/index.html index 1c97b5704..a3fdc4d69 100644 --- a/app/admin/view/index/index.html +++ b/app/admin/view/index/index.html @@ -48,8 +48,8 @@
基本资料
安全设置
{if session('user.username') eq 'admin'} -
缓存加速
-
清理缓存
+
缓存加速
+
清理缓存
{/if}
退出登录