Browse Source

audio play support list by date

master
filesite 3 days ago
parent
commit
0be2f6e812
  1. 16
      themes/beauty/controller/SiteController.php
  2. 6
      themes/beauty/views/list/bydate.php
  3. 2
      themes/beauty/views/site/index.php
  4. 6
      themes/beauty/views/site/mp3player.php

16
themes/beauty/controller/SiteController.php

@ -745,23 +745,29 @@ Class SiteController extends Controller {
$cateId = $this->get('pid', ''); $cateId = $this->get('pid', '');
$cacheParentDataId = $this->get('cid', ''); $cacheParentDataId = $this->get('cid', '');
$page = $this->get('page', 1); $page = $this->get('page', 0);
$pageSize = $this->get('limit', 100); $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); throw new Exception("缺少参数!", 403);
} }
$arr = parse_url($videoUrl); $arr = parse_url($videoUrl);
$videoFilename = basename($arr['path']); $videoFilename = basename($arr['path']);
//增加文件后缀格式检查,区分:mp4, mov, m3u8 //增加文件后缀格式检查,区分:mp4, mov, m3u8, mp3
$videoExtension = pathinfo($arr['path'], PATHINFO_EXTENSION); $videoExtension = pathinfo($arr['path'], PATHINFO_EXTENSION);
$videoSourceType = Html::getMediaSourceType($videoExtension); $videoSourceType = Html::getMediaSourceType($videoExtension);
//从缓存数据获取封面图 //从缓存数据获取封面图
$poster = '/img/beauty/audio_bg.jpg'; $poster = '/img/beauty/audio_bg.jpg';
$cacheSeconds = 86400; $cacheSeconds = 86400;
if (!empty($cacheParentDataId)) {
$cachedParentData = Common::getCacheFromFile($cacheParentDataId, $cacheSeconds); $cachedParentData = Common::getCacheFromFile($cacheParentDataId, $cacheSeconds);
if (!empty($cachedParentData)) { if (!empty($cachedParentData)) {
$mp3 = $cachedParentData[$videoId]; $mp3 = $cachedParentData[$videoId];
@ -775,6 +781,7 @@ Class SiteController extends Controller {
} }
} }
} }
}
//获取联系方式 //获取联系方式
@ -797,7 +804,8 @@ Class SiteController extends Controller {
$params = compact( $params = compact(
'videoUrl', 'videoId', 'videoFilename', 'videoUrl', 'videoId', 'videoFilename',
'cateId', 'cacheParentDataId', 'page', 'pageSize', 'cateId', 'cacheParentDataId', 'page', 'pageSize',
'copyright', 'isAdminIp', 'videoExtension', 'videoSourceType', 'poster' 'copyright', 'isAdminIp', 'videoExtension', 'videoSourceType', 'poster',
'para_year', 'para_month'
); );
return $this->render($viewName, $params, $pageTitle); return $this->render($viewName, $params, $pageTitle);
} }

6
themes/beauty/views/list/bydate.php

@ -59,7 +59,7 @@ if (!empty($viewData['para_month'])) {
<li class="menu-title"> <li class="menu-title">
年月 年月
<?php if (!empty($viewData['isAdminIp'])) { ?> <?php if (!empty($viewData['isAdminIp'])) { ?>
<img class="svg icon1 svgimg verMiddle" src="/img/beauty/refresh.svg" alt="清空缓存数据" title="刷新缓存数据" style="margin-left:10px;width:16px"> <img class="svg icon1 svgimg verMiddle hide" src="/img/beauty/refresh.svg" alt="清空缓存数据" title="刷新缓存数据" style="margin-left:10px;width:16px">
<?php } ?> <?php } ?>
</li> </li>
<?php <?php
@ -276,9 +276,11 @@ eof;
}else if (in_array($file['extension'], $audioExts)) { //输出音乐 }else if (in_array($file['extension'], $audioExts)) { //输出音乐
$title = !empty($file['title']) ? $file['title'] : $file['filename']; $title = !empty($file['title']) ? $file['title'] : $file['filename'];
$videoUrl = urlencode($file['path']); $videoUrl = urlencode($file['path']);
$linkUrl = "/site/audioplayer?id={$file['id']}&pid={$file['pid']}&cid={$viewData['cacheDataId']}&url={$videoUrl}"; $linkUrl = "/site/audioplayer?id={$file['id']}&pid={$file['pid']}&url={$videoUrl}";
if ($viewData['showType'] == 'audio') { if ($viewData['showType'] == 'audio') {
$linkUrl .= "&page={$viewData['page']}&limit={$viewData['pageSize']}"; $linkUrl .= "&page={$viewData['page']}&limit={$viewData['pageSize']}";
//支持按年、月查看视频时,获取更多视频以便自动播放
$linkUrl .= "&year={$viewData['para_year']}&month={$viewData['para_month']}";
} }
$snapshot = '/img/beauty/audio_icon.jpeg'; $snapshot = '/img/beauty/audio_icon.jpeg';

2
themes/beauty/views/site/index.php

@ -68,7 +68,7 @@ $main_view_cls = $menu_ext_status == 'opened' ? '' : 'full';
<li class="menu-title"> <li class="menu-title">
年月 年月
<?php if (!empty($viewData['isAdminIp'])) { ?> <?php if (!empty($viewData['isAdminIp'])) { ?>
<img class="svg icon1 svgimg verMiddle" src="/img/beauty/refresh.svg" alt="清空缓存数据" title="刷新缓存数据" style="margin-left:10px;width:16px"> <img class="svg icon1 svgimg verMiddle hide" src="/img/beauty/refresh.svg" alt="清空缓存数据" title="刷新缓存数据" style="margin-left:10px;width:16px">
<?php } ?> <?php } ?>
</li> </li>
<?php <?php

6
themes/beauty/views/site/mp3player.php

@ -26,7 +26,7 @@
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</nav> </nav>
<?php if (!empty($viewData['cacheParentDataId']) || !empty($viewData['page'])) { ?>
<div class="morevideos audiolist"> <div class="morevideos audiolist">
<div class="btn_autoplay text_dark ml-1"> <div class="btn_autoplay text_dark ml-1">
自动播放: 自动播放:
@ -43,8 +43,12 @@
data-cid="<?php echo $viewData['cacheParentDataId']; ?>" data-cid="<?php echo $viewData['cacheParentDataId']; ?>"
data-page="<?php echo $viewData['page']; ?>" data-page="<?php echo $viewData['page']; ?>"
data-page-size="<?php echo $viewData['pageSize']; ?>" data-page-size="<?php echo $viewData['pageSize']; ?>"
data-api="<?php echo !empty($viewData['cacheParentDataId']) ? '/list/' : '/list/bydate/'; ?>"
data-year="<?php echo $viewData['para_year']; ?>"
data-month="<?php echo $viewData['para_month']; ?>"
class="row othervideos"><div class="ml-2">...</div></div> class="row othervideos"><div class="ml-2">...</div></div>
</div> </div>
<?php } ?>
<div class="audioplayer" style="background:url('/img/beauty/audio_bg.jpg') top center"> <div class="audioplayer" style="background:url('/img/beauty/audio_bg.jpg') top center">
<div class="row"> <div class="row">
<div class="col col-md-offset-3 col-md-6 col-xs-12"> <div class="col col-md-offset-3 col-md-6 col-xs-12">

Loading…
Cancel
Save