|
|
@ -135,6 +135,52 @@ Class ListController extends Controller { |
|
|
|
$pageTitle = $readmeFile['title']; |
|
|
|
$pageTitle = $readmeFile['title']; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dataType支持:[image, video] |
|
|
|
|
|
|
|
$dataType = $this->get('dataType', 'html'); |
|
|
|
|
|
|
|
if ($dataType == 'image') { |
|
|
|
|
|
|
|
$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 ($subcate['files'] as $id => $item) { |
|
|
|
|
|
|
|
//翻页支持 |
|
|
|
|
|
|
|
if ($index < $pageStartIndex) { |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
}else if ($index >= $pageStartIndex + $pageSize) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (in_array($item['extension'], $imgExts)) { |
|
|
|
|
|
|
|
array_push($imgs, $item); |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $this->renderJson(compact('page', 'pageSize', 'imgs')); |
|
|
|
|
|
|
|
}else if ($dataType == 'video') { |
|
|
|
|
|
|
|
$videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8'); |
|
|
|
|
|
|
|
$videos = array(); |
|
|
|
|
|
|
|
$pageStartIndex = ($page-1) * $pageSize; |
|
|
|
|
|
|
|
$index = 0; |
|
|
|
|
|
|
|
foreach ($subcate['files'] as $id => $item) { |
|
|
|
|
|
|
|
//翻页支持 |
|
|
|
|
|
|
|
if ($index < $pageStartIndex) { |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
}else if ($index >= $pageStartIndex + $pageSize) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (in_array($item['extension'], $videoExts)) { |
|
|
|
|
|
|
|
array_push($videos, $item); |
|
|
|
|
|
|
|
$index ++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $this->renderJson(compact('page', 'pageSize', 'videos')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$viewName = '//site/index'; //共享视图 |
|
|
|
$viewName = '//site/index'; //共享视图 |
|
|
|
$params = compact( |
|
|
|
$params = compact( |
|
|
|
'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'breadcrumbs', 'htmlCateReadme', |
|
|
|
'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'breadcrumbs', 'htmlCateReadme', |
|
|
|