feature: video rank list add vc_clicks
This commit is contained in:
@@ -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 [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user