This commit is contained in:
make
2025-04-01 11:04:08 +08:00
7 changed files with 97 additions and 225 deletions

View File

@@ -111,10 +111,11 @@ class NovelModel extends MongoModel
'og_description' => 1,
'og_novel_latest_chapter_name' => 1,
'og_novel_update_time' => 1,
'og_novel_status' => 1,
],
];
$Cursor = $this->getCol()->find($arrFilter, $arrOptions);
$intTotal = $this->getCol()->countDocuments($arrFilter);
@@ -269,6 +270,7 @@ class NovelModel extends MongoModel
'n_novel_author' => 1,
'og_novel_category' => 1,
'og_description' => 1,
'og_novel_status' => 1,
],
];
@@ -325,6 +327,7 @@ class NovelModel extends MongoModel
'og_novel_author' => 1,
'og_novel_category' => 1,
'og_description' => 1,
'og_novel_status' => 1,
],
];
@@ -393,6 +396,7 @@ class NovelModel extends MongoModel
'og_description' => 1,
'og_novel_update_time' => 1,
'og_novel_latest_chapter_name' => 1,
'og_novel_status' => 1,
],
];
@@ -429,7 +433,7 @@ class NovelModel extends MongoModel
* * total 总
* @return array
*/
public function getRankNovelOnCache(string $strSign, int $intCount = 10, int $intType = 0, $strDateType = 'daily'): array
public function getRankNovelOnCache(string $strSign, int $intCount = 10, int $intType = 0, $strDateType = 'daily', $strStatus = NULL): array
{
try {
$strKey = sprintf('%s:PC:HOME:SIX:%s:TYPE:%s', $strSign, $intType, $strDateType);
@@ -443,6 +447,11 @@ class NovelModel extends MongoModel
$arrFilter = [
'nc_type' => $strDateType,
];
if ($strStatus !== NULL) {
$arrFilter['og_novel_status'] = $strStatus;
}
if ($intType == 1) {
$arrCategory = array_values(CategoryModel::getManCategory());
$arrFilter['n_category'] = ['$in' => $arrCategory];
@@ -450,6 +459,8 @@ class NovelModel extends MongoModel
$arrCategory = array_values(CategoryModel::getWomenCategory());
$arrFilter['n_category'] = ['$in' => $arrCategory];
}
$arrOptions = [
'sort' => ['nc_clicks' => -1],
'limit' => $intCount * 3,
@@ -478,6 +489,7 @@ class NovelModel extends MongoModel
'n_novel_author' => 1,
'og_novel_category' => 1,
'og_description' => 1,
'og_novel_status' => 1,
],
]
);