|
|
@ -152,6 +152,9 @@ Class SiteController extends Controller { |
|
|
|
$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'); |
|
|
|
$videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8'); |
|
|
|
$videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//mp3支持 |
|
|
|
|
|
|
|
$audioExts = !empty(FSC::$app['config']['supportedAudioExts']) ? FSC::$app['config']['supportedAudioExts'] : array('mp3'); |
|
|
|
|
|
|
|
|
|
|
|
$showType = $this->get('show', 'all'); |
|
|
|
$showType = $this->get('show', 'all'); |
|
|
|
if ($showType == 'image') { |
|
|
|
if ($showType == 'image') { |
|
|
|
$scanResults = array_filter($scanResults, function($item) { |
|
|
|
$scanResults = array_filter($scanResults, function($item) { |
|
|
@ -163,6 +166,11 @@ Class SiteController extends Controller { |
|
|
|
$videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8'); |
|
|
|
$videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8'); |
|
|
|
return !empty($item['extension']) && in_array($item['extension'], $videoExts); |
|
|
|
return !empty($item['extension']) && in_array($item['extension'], $videoExts); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}else if ($showType == 'audio') { |
|
|
|
|
|
|
|
$scanResults = array_filter($scanResults, function($item) { |
|
|
|
|
|
|
|
$audioExts = !empty(FSC::$app['config']['supportedAudioExts']) ? FSC::$app['config']['supportedAudioExts'] : array('mp3'); |
|
|
|
|
|
|
|
return !empty($item['extension']) && in_array($item['extension'], $audioExts); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -213,8 +221,28 @@ Class SiteController extends Controller { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return $this->renderJson(compact('page', 'pageSize', 'videos')); |
|
|
|
return $this->renderJson(compact('page', 'pageSize', 'videos')); |
|
|
|
|
|
|
|
}else if ($dataType == 'audio') { |
|
|
|
|
|
|
|
$audios = array(); |
|
|
|
|
|
|
|
$pageStartIndex = ($page-1) * $pageSize; |
|
|
|
|
|
|
|
$index = 0; |
|
|
|
|
|
|
|
foreach ($scanResults as $id => $item) { |
|
|
|
|
|
|
|
//翻页支持 |
|
|
|
|
|
|
|
if ($index < $pageStartIndex) { |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
}else if ($index >= $pageStartIndex + $pageSize) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($item['extension']) && in_array($item['extension'], $audioExts)) { |
|
|
|
|
|
|
|
array_push($audios, $item); |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $this->renderJson(compact('page', 'pageSize', 'audios')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$isAdminIp = Common::isAdminIp($this->getUserIp()); //判断是否拥有管理权限 |
|
|
|
$isAdminIp = Common::isAdminIp($this->getUserIp()); //判断是否拥有管理权限 |
|
|
|
|
|
|
|
|
|
|
|
$viewName = 'index'; |
|
|
|
$viewName = 'index'; |
|
|
|