Merge branch 'dev' of ssh://git.bgbg.live:18150/root/SEONexus into dev

This commit is contained in:
make
2025-04-03 16:47:42 +08:00
4 changed files with 54 additions and 110 deletions

View File

@@ -28,6 +28,33 @@ class CategoryModel extends MongoModel
9 => '其他小说',
];
static $arrCategoryAll = [
'man' => [
'xuanhuan-xiuzhen' => '玄幻修真',
'junshi-xiaoshuo' => '军史小说',
'wangyou-xiaoshuo' => '网游小说',
'kehuan-xiaoshuo' => '科幻小说',
],
'women' => [
'zhongsheng-chuanyue' => '重生穿越',
'dushi-xiaoshuo' => '都市小说',
'lingyi-xiaoshuo' => '灵异小说',
'yanqing-xiaoshuo' => '言情小说',
'qita-xiaoshuo' => '其他小说',
]
];
/**
* Undocumented function
*
* @param string $strName
* @return string
*/
static public function checkSex(string $strName): string
{
return in_array($strName, self::$arrMan) ? 'man' : 'women';
}
static $arrCategoryPinYin = [
1 => 'xuanhuan-xiuzhen', // 玄幻-修真
2 => 'junshi-xiaoshuo', // 军史-小说

View File

@@ -121,6 +121,11 @@ class NovelModel extends MongoModel
$arrOptions = self::$arrNovelOptions;
$arrNovel = $this->getOne($arrFilter, $arrOptions);
applyToKeys($arrNovel, ['created_at', 'updated_at'], 'formatMongoDate');
if (!empty($arrNovel['og_novel_category'])) {
$arrNovel['category_pinyin'] = CategoryModel::getPinYinByZh($arrNovel['og_novel_category']);
$arrNovel['category_sex'] = CategoryModel::checkSex($arrNovel['og_novel_category']);
}
return $arrNovel;
}