feature: video rank list add vc_clicks

This commit is contained in:
Default
2025-05-05 14:15:21 +08:00
parent 4400055b06
commit 017572b170
4 changed files with 22 additions and 13 deletions

View File

@@ -6,6 +6,7 @@
章节名称: {$video.v_name} 章节名称: {$video.v_name}
章节序号: {$video.v_category} 章节序号: {$video.v_category}
点击数: {$video.vc_clicks}
</li> </li>
{/video:ranklist} {/video:ranklist}

View File

@@ -447,6 +447,7 @@ class VideoModel extends MongoModel
'limit' => $intCount * 3, 'limit' => $intCount * 3,
'projection' => [ 'projection' => [
'v_id' => 1, 'v_id' => 1,
'vc_clicks' => 1,
], ],
]; ];
@@ -455,8 +456,12 @@ class VideoModel extends MongoModel
$Cursor = $VideoClicksModel->getCol()->find($arrFilter, $arrOptions); $Cursor = $VideoClicksModel->getCol()->find($arrFilter, $arrOptions);
$arrVId = []; $arrVId = [];
$arrVideoClicks = [];
foreach ($Cursor as $Doc) { foreach ($Cursor as $Doc) {
$arrVId[] = $Doc['v_id']; $arrVId[] = $Doc['v_id'];
$arrVideoClicks[$Doc['v_id']] = $Doc['vc_clicks'];
} }
$arrFilter = ['v_id' => ['$in' => $arrVId]]; $arrFilter = ['v_id' => ['$in' => $arrVId]];
@@ -473,6 +478,9 @@ class VideoModel extends MongoModel
shuffle($arrResult); shuffle($arrResult);
$arrResult = array_slice($arrResult, 0, $intCount); $arrResult = array_slice($arrResult, 0, $intCount);
foreach ($arrResult as &$arrVideo) {
$arrVideo['vc_clicks'] = $arrVideoClicks[$arrVideo['v_id']];
}
$this->setCacheByKey($strKey, $arrResult, $intLifeTime); $this->setCacheByKey($strKey, $arrResult, $intLifeTime);

View File

@@ -430,7 +430,7 @@ class VideoService
$arrParams = [ $arrParams = [
'page' => max((int)($arrParams['page'] ?? 1), 1), 'page' => max((int)($arrParams['page'] ?? 1), 1),
'limit' => (int)($arrParams['limit'] ?? 10), '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_class' => (string)($arrParams['v_class'] ?? ''),
'v_lang_en' => (string)($arrParams['v_lang_en'] ?? ''), 'v_lang_en' => (string)($arrParams['v_lang_en'] ?? ''),
'v_area_en' => (string)($arrParams['v_area_en'] ?? ''), 'v_area_en' => (string)($arrParams['v_area_en'] ?? ''),
@@ -632,7 +632,7 @@ class VideoService
$strKey = $arrParams['key']; $strKey = $arrParams['key'];
$intPage = $arrVideo['page']; $intPage = $arrVideo['page'];
$intLimit = $arrVideo['limit']; $intLimit = $arrVideo['limit'];
$intButtomNum = $arrParams['buttov_num']; $intButtomNum = $arrParams['button_num'];
$strBaseUrl = app(VideoService::class)->getVideoSearchUrl($strKey, '{page}'); $strBaseUrl = app(VideoService::class)->getVideoSearchUrl($strKey, '{page}');
$arrPaginator = CusteomPage02::generate($intPage, $arrVideo['total'], $intLimit, $strBaseUrl, $intButtomNum); $arrPaginator = CusteomPage02::generate($intPage, $arrVideo['total'], $intLimit, $strBaseUrl, $intButtomNum);
@@ -660,7 +660,7 @@ class VideoService
$intPage = $arrVideo['page']; $intPage = $arrVideo['page'];
$intLimit = $arrVideo['limit']; $intLimit = $arrVideo['limit'];
$intButtomNum = $arrParams['buttov_num']; $intButtomNum = $arrParams['button_num'];
$strBaseUrl = app(VideoService::class)->getVideoCategoryUrl($strCategory, $strParentCategory, $strArea, $strLang, $strYear, $strOrder, '{page}'); $strBaseUrl = app(VideoService::class)->getVideoCategoryUrl($strCategory, $strParentCategory, $strArea, $strLang, $strYear, $strOrder, '{page}');
$arrPaginator = CusteomPage02::generate($intPage, $arrVideo['total'], $intLimit, $strBaseUrl, $intButtomNum); $arrPaginator = CusteomPage02::generate($intPage, $arrVideo['total'], $intLimit, $strBaseUrl, $intButtomNum);

View File

@@ -155,9 +155,9 @@ EOT;
{ {
$page = $tag['page'] ?? '0'; $page = $tag['page'] ?? '0';
$limit = $tag['limit'] ?? '10'; $limit = $tag['limit'] ?? '10';
$buttov_num = $tag['buttov_num'] ?? '10'; $button_num = $tag['button_num'] ?? '10';
$v_class = $tag['v_class'] ?? 'all'; // $v_class = $tag['v_class'] ?? 'all';
$v_category = $tag['v_category'] ?? "all"; // $v_category = $tag['v_category'] ?? "all";
$sort_type = $tag['sort_type'] ?? ""; $sort_type = $tag['sort_type'] ?? "";
@@ -183,9 +183,9 @@ EOT;
$page = $this->customBuildVar($page); $page = $this->customBuildVar($page);
$limit = $this->customBuildVar($limit); $limit = $this->customBuildVar($limit);
$buttov_num = $this->customBuildVar($buttov_num); $button_num = $this->customBuildVar($button_num);
$v_category = $this->customBuildVar($v_category); // $v_category = $this->customBuildVar($v_category);
$sort_type = $this->customBuildVar($sort_type); $sort_type = $this->customBuildVar($sort_type);
$v_status = $this->customBuildVar($v_status); $v_status = $this->customBuildVar($v_status);
@@ -208,7 +208,7 @@ EOT;
\${$arrDataName} = app(\\app\\services\\VideoService::class)->getVideoPager([ \${$arrDataName} = app(\\app\\services\\VideoService::class)->getVideoPager([
'page' => {$page}, 'page' => {$page},
'limit' => {$limit}, 'limit' => {$limit},
'buttov_num' => {$buttov_num}, 'button_num' => {$button_num},
'v_category_en' => {$v_category_en}, 'v_category_en' => {$v_category_en},
'v_parent_category_en' => {$v_parent_category_en}, 'v_parent_category_en' => {$v_parent_category_en},
'v_lang_en' => {$v_lang_en}, 'v_lang_en' => {$v_lang_en},
@@ -254,7 +254,7 @@ EOT;
public function tagList($tag, $content) public function tagList($tag, $content)
{ {
$count = $tag['count'] ?? '10'; $count = $tag['count'] ?? '10';
$v_category = $tag['v_category'] ?? "all"; // $v_category = $tag['v_category'] ?? "all";
$sort_type = $tag['sort_type'] ?? ""; $sort_type = $tag['sort_type'] ?? "";
$v_status = $tag['v_status'] ?? "all"; $v_status = $tag['v_status'] ?? "all";
$diff_key = $tag['diff_key'] ?? ""; $diff_key = $tag['diff_key'] ?? "";
@@ -268,7 +268,7 @@ EOT;
$v_year = $tag['v_year'] ?? "all"; $v_year = $tag['v_year'] ?? "all";
$export_name = $tag['export_name'] ?? ''; $export_name = $tag['export_name'] ?? '';
$v_category = $this->customBuildVar($v_category); // $v_category = $this->customBuildVar($v_category);
$sort_type = $this->customBuildVar($sort_type); $sort_type = $this->customBuildVar($sort_type);
$v_status = $this->customBuildVar($v_status); $v_status = $this->customBuildVar($v_status);
$diff_key = $this->customBuildVar($diff_key); $diff_key = $this->customBuildVar($diff_key);