From a961389631c68aa550cd2cb277f89707d5d18c3c Mon Sep 17 00:00:00 2001 From: augushong Date: Tue, 19 May 2020 21:25:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=B3=BB=E7=BB=9F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/System.php | 7 +++++++ app/common.php | 13 +++++++++---- view/admin/common/_header.html | 2 +- view/admin/common/left_system.html | 6 ++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/admin/controller/System.php b/app/admin/controller/System.php index 55e17dc..30e54a5 100644 --- a/app/admin/controller/System.php +++ b/app/admin/controller/System.php @@ -89,4 +89,11 @@ class System extends Common return $this->success(); } + + public function clearCache() + { + Cache::clear(); + + return $this->success('清楚成功'); + } } diff --git a/app/common.php b/app/common.php index 5e1f1fc..df73c8f 100644 --- a/app/common.php +++ b/app/common.php @@ -42,7 +42,12 @@ function get_system_config($name = '', $default = '') $list = Cache::get('system_config'); if (empty($list)) { - $list = SystemConfig::column('value', 'name'); + try { + + $list = SystemConfig::column('value', 'name'); + } catch (\Throwable $th) { + return $default; + } } if ($name === '') { @@ -71,15 +76,15 @@ function get_source_link($url) $resource_domain = get_system_config('resource_domain'); if (empty($resource_domain)) { - $resource_domain = request()->host(); + $resource_domain = request()->domain(); } - return 'http://' . $resource_domain . '/' . $url; + return $resource_domain . '/' . $url; } } function de_source_link($url) { - $domain = 'http://' . get_system_config('resource_domain') . '/'; + $domain = get_system_config('resource_domain') . '/'; if (strpos($url, $domain) === 0) { return str_replace($domain, '', $url); } diff --git a/view/admin/common/_header.html b/view/admin/common/_header.html index 6b61e43..cd4a316 100644 --- a/view/admin/common/_header.html +++ b/view/admin/common/_header.html @@ -1,5 +1,5 @@
- + +
\ No newline at end of file