From 1e17661767ceed1945d3e06b6c018bd6bfb015ea Mon Sep 17 00:00:00 2001 From: filesite Date: Wed, 24 Jul 2024 08:22:16 +0800 Subject: [PATCH] bug fix for no data --- themes/beauty/controller/ListController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/beauty/controller/ListController.php b/themes/beauty/controller/ListController.php index 0ec8a43..7c41feb 100644 --- a/themes/beauty/controller/ListController.php +++ b/themes/beauty/controller/ListController.php @@ -100,7 +100,7 @@ Class ListController extends Controller { //获取目录面包屑 - $subcate = $scanResults[$cateId]; + $subcate = !empty($scanResults[$cateId]) ? $scanResults[$cateId] : array(); $breadcrumbs = $this->getBreadcrumbs($currentDir, $cachedParentData, $scanner); //图片、视频类型筛选支持 @@ -152,7 +152,7 @@ Class ListController extends Controller { //dataType支持:[image, video] $dataType = $this->get('dataType', 'html'); - if ($dataType == 'image') { + if ($dataType == 'image' && !empty($subcate['files'])) { $imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); $imgs = array(); $pageStartIndex = ($page-1) * $pageSize; @@ -172,7 +172,7 @@ Class ListController extends Controller { } } return $this->renderJson(compact('page', 'pageSize', 'imgs')); - }else if ($dataType == 'video') { + }else if ($dataType == 'video' && !empty($subcate['files'])) { $videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8'); $videos = array(); $pageStartIndex = ($page-1) * $pageSize;