|
|
@ -281,7 +281,6 @@ Class ListController extends Controller { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($item['extension']) && in_array($item['extension'], $audioExts)) { |
|
|
|
if (!empty($item['extension']) && in_array($item['extension'], $audioExts)) { |
|
|
|
//print_r($subcate['files']);exit; |
|
|
|
|
|
|
|
//为音乐文件获取封面图 |
|
|
|
//为音乐文件获取封面图 |
|
|
|
if (empty($item['snapshot'])) { |
|
|
|
if (empty($item['snapshot'])) { |
|
|
|
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); |
|
|
|
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); |
|
|
@ -422,6 +421,12 @@ Class ListController extends Controller { |
|
|
|
throw new Exception("索引数据已失效,请重新扫描所有文件以生成索引数据!", 404); |
|
|
|
throw new Exception("索引数据已失效,请重新扫描所有文件以生成索引数据!", 404); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//把所有文件拼接到一个数组里 |
|
|
|
|
|
|
|
$allFiles = []; |
|
|
|
|
|
|
|
foreach($cacheData as $month => $files) { |
|
|
|
|
|
|
|
$allFiles = array_merge($allFiles, $files); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//其它数据获取 |
|
|
|
//其它数据获取 |
|
|
|
|
|
|
|
|
|
|
@ -498,6 +503,91 @@ Class ListController extends Controller { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dataType支持:[image, video, audio] |
|
|
|
|
|
|
|
$dataType = $this->get('dataType', 'html'); |
|
|
|
|
|
|
|
if ($dataType == 'image' && !empty($allFiles)) { |
|
|
|
|
|
|
|
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); |
|
|
|
|
|
|
|
$imgs = array(); |
|
|
|
|
|
|
|
$pageStartIndex = ($page-1) * $pageSize; |
|
|
|
|
|
|
|
$index = 0; |
|
|
|
|
|
|
|
foreach ($allFiles as $id => $item) { |
|
|
|
|
|
|
|
//翻页支持 |
|
|
|
|
|
|
|
if ($index < $pageStartIndex) { |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
}else if ($index >= $pageStartIndex + $pageSize) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//增加caption:图片、视频显示文件修改日期 |
|
|
|
|
|
|
|
$title = Common::getDateFromString($item['filename']); |
|
|
|
|
|
|
|
if (empty($title) && !empty($item['fstat']['mtime']) && !empty($item['fstat']['ctime'])) { |
|
|
|
|
|
|
|
$title = date('Y-m-d', min($item['fstat']['mtime'], $item['fstat']['ctime'])); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$item['caption'] = "{$title} - {$item['filename']}"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($item['extension']) && in_array($item['extension'], $imgExts)) { |
|
|
|
|
|
|
|
array_push($imgs, $item); |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $this->renderJson(compact('page', 'pageSize', 'imgs')); |
|
|
|
|
|
|
|
}else if ($dataType == 'video' && !empty($allFiles)) { |
|
|
|
|
|
|
|
$videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8'); |
|
|
|
|
|
|
|
$videos = array(); |
|
|
|
|
|
|
|
$pageStartIndex = ($page-1) * $pageSize; |
|
|
|
|
|
|
|
$index = 0; |
|
|
|
|
|
|
|
foreach ($allFiles as $id => $item) { |
|
|
|
|
|
|
|
//翻页支持 |
|
|
|
|
|
|
|
if ($index < $pageStartIndex) { |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
}else if ($index >= $pageStartIndex + $pageSize) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($item['extension']) && in_array($item['extension'], $videoExts)) { |
|
|
|
|
|
|
|
$item['videoType'] = Html::getMediaSourceType($item['extension']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
array_push($videos, $item); |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $this->renderJson(compact('page', 'pageSize', 'videos')); |
|
|
|
|
|
|
|
}else if ($dataType == 'audio' && !empty($allFiles)) { |
|
|
|
|
|
|
|
$audioExts = !empty(FSC::$app['config']['supportedAudioExts']) ? FSC::$app['config']['supportedAudioExts'] : array('mp3'); |
|
|
|
|
|
|
|
$audios = array(); |
|
|
|
|
|
|
|
$pageStartIndex = ($page-1) * $pageSize; |
|
|
|
|
|
|
|
$index = 0; |
|
|
|
|
|
|
|
foreach ($allFiles as $id => $item) { |
|
|
|
|
|
|
|
//翻页支持 |
|
|
|
|
|
|
|
if ($index < $pageStartIndex) { |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
}else if ($index >= $pageStartIndex + $pageSize) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($item['extension']) && in_array($item['extension'], $audioExts)) { |
|
|
|
|
|
|
|
//为音乐文件获取封面图 |
|
|
|
|
|
|
|
if (empty($item['snapshot'])) { |
|
|
|
|
|
|
|
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); |
|
|
|
|
|
|
|
$matchedImage = Html::searchImageByFilename($item['filename'], $allFiles, $imgExts); |
|
|
|
|
|
|
|
if (!empty($matchedImage)) { |
|
|
|
|
|
|
|
$item['snapshot'] = $matchedImage['path']; |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
$item['snapshot'] = '/img/beauty/audio_icon.jpeg?v1'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
array_push($audios, $item); |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $this->renderJson(compact('page', 'pageSize', 'audios')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$pageTitlePrefix = "{$intYear}年的"; |
|
|
|
$pageTitlePrefix = "{$intYear}年的"; |
|
|
|
if (!empty($para_month)) { |
|
|
|
if (!empty($para_month)) { |
|
|
|
$pageTitlePrefix = "{$intYear}年{$intMonth}月的"; |
|
|
|
$pageTitlePrefix = "{$intYear}年{$intMonth}月的"; |
|
|
@ -510,6 +600,7 @@ Class ListController extends Controller { |
|
|
|
'menus', 'breadcrumbs', |
|
|
|
'menus', 'breadcrumbs', |
|
|
|
'htmlReadme', 'htmlCateReadme', 'copyright', 'mp3File', 'isAdminIp', |
|
|
|
'htmlReadme', 'htmlCateReadme', 'copyright', 'mp3File', 'isAdminIp', |
|
|
|
'page', 'pageSize', 'showType', |
|
|
|
'page', 'pageSize', 'showType', |
|
|
|
|
|
|
|
'allFiles', |
|
|
|
'cacheData', |
|
|
|
'cacheData', |
|
|
|
'cacheData_keys', |
|
|
|
'cacheData_keys', |
|
|
|
'para_year', 'para_month' |
|
|
|
'para_year', 'para_month' |
|
|
|