feature: video rank list add vc_clicks
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
章节名称: {$video.v_name}
|
||||
章节序号: {$video.v_category}
|
||||
点击数: {$video.vc_clicks}
|
||||
</li>
|
||||
{/video:ranklist}
|
||||
|
||||
|
||||
@@ -447,6 +447,7 @@ class VideoModel extends MongoModel
|
||||
'limit' => $intCount * 3,
|
||||
'projection' => [
|
||||
'v_id' => 1,
|
||||
'vc_clicks' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -455,11 +456,15 @@ class VideoModel extends MongoModel
|
||||
$Cursor = $VideoClicksModel->getCol()->find($arrFilter, $arrOptions);
|
||||
|
||||
$arrVId = [];
|
||||
|
||||
$arrVideoClicks = [];
|
||||
foreach ($Cursor as $Doc) {
|
||||
$arrVId[] = $Doc['v_id'];
|
||||
|
||||
$arrVideoClicks[$Doc['v_id']] = $Doc['vc_clicks'];
|
||||
}
|
||||
|
||||
$arrFilter = ['v_id' => ['$in' => $arrVId]];
|
||||
$arrFilter = ['v_id' => ['$in' => $arrVId]];
|
||||
$arrOptions = self::$arrOptions;
|
||||
unset($arrOptions['typeMap']);
|
||||
|
||||
@@ -473,10 +478,13 @@ class VideoModel extends MongoModel
|
||||
shuffle($arrResult);
|
||||
|
||||
$arrResult = array_slice($arrResult, 0, $intCount);
|
||||
foreach ($arrResult as &$arrVideo) {
|
||||
$arrVideo['vc_clicks'] = $arrVideoClicks[$arrVideo['v_id']];
|
||||
}
|
||||
|
||||
$this->setCacheByKey($strKey, $arrResult, $intLifeTime);
|
||||
|
||||
return $arrResult;
|
||||
return $arrResult;
|
||||
} catch (\Exception $e) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ class VideoService
|
||||
$arrParams = [
|
||||
'page' => max((int)($arrParams['page'] ?? 1), 1),
|
||||
'limit' => (int)($arrParams['limit'] ?? 10),
|
||||
'buttov_num' => (int)($arrParams['buttov_num'] ?? 0),
|
||||
'button_num' => (int)($arrParams['button_num'] ?? 0),
|
||||
'v_class' => (string)($arrParams['v_class'] ?? ''),
|
||||
'v_lang_en' => (string)($arrParams['v_lang_en'] ?? ''),
|
||||
'v_area_en' => (string)($arrParams['v_area_en'] ?? ''),
|
||||
@@ -632,7 +632,7 @@ class VideoService
|
||||
$strKey = $arrParams['key'];
|
||||
$intPage = $arrVideo['page'];
|
||||
$intLimit = $arrVideo['limit'];
|
||||
$intButtomNum = $arrParams['buttov_num'];
|
||||
$intButtomNum = $arrParams['button_num'];
|
||||
$strBaseUrl = app(VideoService::class)->getVideoSearchUrl($strKey, '{page}');
|
||||
$arrPaginator = CusteomPage02::generate($intPage, $arrVideo['total'], $intLimit, $strBaseUrl, $intButtomNum);
|
||||
|
||||
@@ -660,7 +660,7 @@ class VideoService
|
||||
|
||||
$intPage = $arrVideo['page'];
|
||||
$intLimit = $arrVideo['limit'];
|
||||
$intButtomNum = $arrParams['buttov_num'];
|
||||
$intButtomNum = $arrParams['button_num'];
|
||||
$strBaseUrl = app(VideoService::class)->getVideoCategoryUrl($strCategory, $strParentCategory, $strArea, $strLang, $strYear, $strOrder, '{page}');
|
||||
$arrPaginator = CusteomPage02::generate($intPage, $arrVideo['total'], $intLimit, $strBaseUrl, $intButtomNum);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user