diff --git a/code/app/home/view/videoDadi/test/test01/index.html b/code/app/home/view/videoDadi/test/test01/index.html index b53be1c..66e18d5 100644 --- a/code/app/home/view/videoDadi/test/test01/index.html +++ b/code/app/home/view/videoDadi/test/test01/index.html @@ -6,6 +6,7 @@ 章节名称: {$video.v_name} 章节序号: {$video.v_category} + 点击数: {$video.vc_clicks} {/video:ranklist} diff --git a/code/app/model/VideoModel.php b/code/app/model/VideoModel.php index 6c3a298..3dbd912 100644 --- a/code/app/model/VideoModel.php +++ b/code/app/model/VideoModel.php @@ -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 []; } diff --git a/code/app/services/VideoService.php b/code/app/services/VideoService.php index 03597f5..c22fe69 100644 --- a/code/app/services/VideoService.php +++ b/code/app/services/VideoService.php @@ -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); diff --git a/code/extend/template/taglib/Video.php b/code/extend/template/taglib/Video.php index 39942e8..7e4d8ba 100644 --- a/code/extend/template/taglib/Video.php +++ b/code/extend/template/taglib/Video.php @@ -155,9 +155,9 @@ EOT; { $page = $tag['page'] ?? '0'; $limit = $tag['limit'] ?? '10'; - $buttov_num = $tag['buttov_num'] ?? '10'; - $v_class = $tag['v_class'] ?? 'all'; - $v_category = $tag['v_category'] ?? "all"; + $button_num = $tag['button_num'] ?? '10'; + // $v_class = $tag['v_class'] ?? 'all'; + // $v_category = $tag['v_category'] ?? "all"; $sort_type = $tag['sort_type'] ?? ""; @@ -183,9 +183,9 @@ EOT; $page = $this->customBuildVar($page); $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); $v_status = $this->customBuildVar($v_status); @@ -208,7 +208,7 @@ EOT; \${$arrDataName} = app(\\app\\services\\VideoService::class)->getVideoPager([ 'page' => {$page}, 'limit' => {$limit}, - 'buttov_num' => {$buttov_num}, + 'button_num' => {$button_num}, 'v_category_en' => {$v_category_en}, 'v_parent_category_en' => {$v_parent_category_en}, 'v_lang_en' => {$v_lang_en}, @@ -254,7 +254,7 @@ EOT; public function tagList($tag, $content) { $count = $tag['count'] ?? '10'; - $v_category = $tag['v_category'] ?? "all"; + // $v_category = $tag['v_category'] ?? "all"; $sort_type = $tag['sort_type'] ?? ""; $v_status = $tag['v_status'] ?? "all"; $diff_key = $tag['diff_key'] ?? ""; @@ -268,7 +268,7 @@ EOT; $v_year = $tag['v_year'] ?? "all"; $export_name = $tag['export_name'] ?? ''; - $v_category = $this->customBuildVar($v_category); + // $v_category = $this->customBuildVar($v_category); $sort_type = $this->customBuildVar($sort_type); $v_status = $this->customBuildVar($v_status); $diff_key = $this->customBuildVar($diff_key);