From 90cacbbcd23c39c4eb7924bff8536d7eba22b533 Mon Sep 17 00:00:00 2001 From: filesite Date: Tue, 10 Sep 2024 00:10:26 +0800 Subject: [PATCH] add alert message --- themes/beauty/controller/ListController.php | 3 ++- themes/beauty/controller/SiteController.php | 7 ++++++- themes/beauty/views/site/index.php | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/themes/beauty/controller/ListController.php b/themes/beauty/controller/ListController.php index a04d1ce..8e0e1b2 100644 --- a/themes/beauty/controller/ListController.php +++ b/themes/beauty/controller/ListController.php @@ -27,7 +27,8 @@ Class ListController extends Controller { $cacheSeconds = 86400; $cachedParentData = Common::getCacheFromFile($cacheParentDataId, $cacheSeconds); if (empty($cachedParentData)) { - return $this->redirect('/'); + $err = '缓存数据已失效,如果重新点击目录依然打不开,请联系管理员。'; + return $this->redirect('/?err=' . urlencode($err)); } if (strpos($cacheParentDataId, $cateId) === false && empty($cachedParentData[$cateId])) { diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php index ad61b4d..09fe87e 100644 --- a/themes/beauty/controller/SiteController.php +++ b/themes/beauty/controller/SiteController.php @@ -123,6 +123,10 @@ Class SiteController extends Controller { } + //提示信息支持 + $alertWarning = $this->get('err', ''); + + //翻页支持 $page = $this->get('page', 1); $pageSize = $this->get('limit', 24); @@ -214,7 +218,8 @@ Class SiteController extends Controller { $viewName = 'index'; $params = compact( 'page', 'pageSize', 'cacheDataId', 'showType', - 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'htmlCateReadme', 'mp3File', 'copyright' + 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'htmlCateReadme', 'mp3File', 'copyright', + 'alertWarning' ); return $this->render($viewName, $params, $pageTitle); } diff --git a/themes/beauty/views/site/index.php b/themes/beauty/views/site/index.php index d102378..aa65895 100644 --- a/themes/beauty/views/site/index.php +++ b/themes/beauty/views/site/index.php @@ -99,6 +99,13 @@ if ($total > 0) { eof; } + +if (!empty($viewData['alertWarning'])) { + echo <<{$viewData['alertWarning']} +eof; +} + echo << {$totalNum}