From 6f0cb24fff005ec657fb50f94aa6f6ed8603324f Mon Sep 17 00:00:00 2001 From: filesite Date: Sun, 24 Nov 2024 17:10:44 +0800 Subject: [PATCH] get cache data of date index --- themes/beauty/controller/CommandController.php | 3 +++ themes/beauty/controller/ListController.php | 8 +++++++- themes/beauty/controller/SiteController.php | 2 +- themes/beauty/views/site/index.php | 15 +++++++++++---- www/img/beauty/calendar.svg | 4 ++++ 5 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 www/img/beauty/calendar.svg diff --git a/themes/beauty/controller/CommandController.php b/themes/beauty/controller/CommandController.php index 35c8174..c19fde4 100644 --- a/themes/beauty/controller/CommandController.php +++ b/themes/beauty/controller/CommandController.php @@ -156,6 +156,9 @@ eof; $scanner->setWebRoot(FSC::$app['config']['content_directory']); $scanner->setRootDir($dirpath); + //尝试使用exiftool来获取视频的拍摄时间 + $scanner->exiftoolSupported = true; + $maxScanDeep = 0; //最大扫描目录级数 $dirTree = $scanner->scan($dirpath, $maxScanDeep); $scanResults = $scanner->getScanResults(); diff --git a/themes/beauty/controller/ListController.php b/themes/beauty/controller/ListController.php index 79f2de9..35e9c07 100644 --- a/themes/beauty/controller/ListController.php +++ b/themes/beauty/controller/ListController.php @@ -8,6 +8,8 @@ require_once __DIR__ . '/../../../plugins/Common.php'; require_once __DIR__ . '/../../../plugins/Html.php'; Class ListController extends Controller { + protected $dateIndexCacheKey = 'MainBotDateIndex'; + protected $noOriginalCtimeFilesCacheKey = 'MainBotNoOriginalCtimeFiles'; public function actionIndex() { $cateId = $this->get('id', ''); @@ -300,10 +302,14 @@ Class ListController extends Controller { $isAdminIp = Common::isAdminIp($this->getUserIp()); //判断是否拥有管理权限 + //从缓存文件获取按年份、月份归类的索引数据 + $cacheDataByDate = Common::getCacheFromFile($this->dateIndexCacheKey, 86400*365); + $viewName = '//site/index'; //共享视图 $params = compact( 'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'breadcrumbs', 'htmlCateReadme', - 'mp3File', 'page', 'pageSize', 'cacheDataId', 'copyright', 'showType', 'isAdminIp', 'allFiles' + 'mp3File', 'page', 'pageSize', 'cacheDataId', 'copyright', 'showType', 'isAdminIp', 'allFiles', + 'cacheDataByDate' ); return $this->render($viewName, $params, $pageTitle); } diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php index a44e461..62f9088 100644 --- a/themes/beauty/controller/SiteController.php +++ b/themes/beauty/controller/SiteController.php @@ -261,7 +261,7 @@ Class SiteController extends Controller { //从缓存文件获取按年份、月份归类的索引数据 - $cacheDataByDate = Common::getCache($this->dateIndexCacheKey); + $cacheDataByDate = Common::getCacheFromFile($this->dateIndexCacheKey, 86400*365); $viewName = 'index'; $params = compact( diff --git a/themes/beauty/views/site/index.php b/themes/beauty/views/site/index.php index 95cf964..904fa25 100644 --- a/themes/beauty/views/site/index.php +++ b/themes/beauty/views/site/index.php @@ -61,15 +61,22 @@ $main_view_cls = $menu_ext_status == 'opened' ? '' : 'full'; $ids) { + $intYear = str_replace('y', '', $year); + echo <<calendar {$intYear}年 +eof; + } }else { echo <<还没有按年月归类的索引数据,点击马上生成 +
  • + 还没有索引数据! + +
  • eof; } ?> - + + + +