diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php index 5030cba..b03a983 100644 --- a/themes/beauty/controller/SiteController.php +++ b/themes/beauty/controller/SiteController.php @@ -745,33 +745,40 @@ Class SiteController extends Controller { $cateId = $this->get('pid', ''); $cacheParentDataId = $this->get('cid', ''); - $page = $this->get('page', 1); + $page = $this->get('page', 0); $pageSize = $this->get('limit', 100); - if (empty($videoUrl) || empty($videoId) || empty($cateId) || empty($cacheParentDataId)) { + //增加按年、月查看视频自动播放更多视频支持 + $para_year = $this->get('year', ''); + $para_month = $this->get('month', ''); + + if (empty($videoUrl) || empty($videoId) || empty($cateId)) { throw new Exception("缺少参数!", 403); } $arr = parse_url($videoUrl); $videoFilename = basename($arr['path']); - //增加文件后缀格式检查,区分:mp4, mov, m3u8 + //增加文件后缀格式检查,区分:mp4, mov, m3u8, mp3 $videoExtension = pathinfo($arr['path'], PATHINFO_EXTENSION); $videoSourceType = Html::getMediaSourceType($videoExtension); //从缓存数据获取封面图 $poster = '/img/beauty/audio_bg.jpg'; $cacheSeconds = 86400; - $cachedParentData = Common::getCacheFromFile($cacheParentDataId, $cacheSeconds); - if (!empty($cachedParentData)) { - $mp3 = $cachedParentData[$videoId]; - if (!empty($mp3['snapshot'])) { - $poster = $mp3['snapshot']; - }else { - $imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); - $matchedImage = Html::searchImageByFilename($mp3['filename'], $cachedParentData, $imgExts); - if (!empty($matchedImage)) { - $poster = $matchedImage['path']; + + if (!empty($cacheParentDataId)) { + $cachedParentData = Common::getCacheFromFile($cacheParentDataId, $cacheSeconds); + if (!empty($cachedParentData)) { + $mp3 = $cachedParentData[$videoId]; + if (!empty($mp3['snapshot'])) { + $poster = $mp3['snapshot']; + }else { + $imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); + $matchedImage = Html::searchImageByFilename($mp3['filename'], $cachedParentData, $imgExts); + if (!empty($matchedImage)) { + $poster = $matchedImage['path']; + } } } } @@ -797,7 +804,8 @@ Class SiteController extends Controller { $params = compact( 'videoUrl', 'videoId', 'videoFilename', 'cateId', 'cacheParentDataId', 'page', 'pageSize', - 'copyright', 'isAdminIp', 'videoExtension', 'videoSourceType', 'poster' + 'copyright', 'isAdminIp', 'videoExtension', 'videoSourceType', 'poster', + 'para_year', 'para_month' ); return $this->render($viewName, $params, $pageTitle); } diff --git a/themes/beauty/views/list/bydate.php b/themes/beauty/views/list/bydate.php index 04e834b..2f22c5d 100644 --- a/themes/beauty/views/list/bydate.php +++ b/themes/beauty/views/list/bydate.php @@ -59,7 +59,7 @@ if (!empty($viewData['para_month'])) { 年月 - 清空缓存数据 + 清空缓存数据 - +
自动播放: @@ -43,8 +43,12 @@ data-cid="" data-page="" data-page-size="" + data-api="" + data-year="" + data-month="" class="row othervideos">
...
+