This commit is contained in:
Default
2025-04-15 21:16:14 +08:00
parent 694d5fd14c
commit d19ea97481
47 changed files with 907 additions and 769 deletions

View File

@@ -139,7 +139,7 @@ class CategoryModel extends MongoModel
* @param string $strZh
* @return string
*/
static public function getPinYinByZh(string $strZh)
static public function getPinYin(string $strZh)
{
$intKey = array_search($strZh, self::$arrCategory);
return self::$arrCategoryPinYin[$intKey];
@@ -151,7 +151,7 @@ class CategoryModel extends MongoModel
* @param string $strName
* @return string
*/
static public function checkSex(string $strName): string
static public function getSexEn(string $strName): string
{
return in_array($strName, self::$arrMan) ? 'man' : 'women';
}
@@ -162,7 +162,7 @@ class CategoryModel extends MongoModel
* @param string $strName
* @return string
*/
static public function checkSexZh(string $strName): string
static public function getSexZh(string $strName): string
{
return in_array($strName, self::$arrMan) ? '男生' : '女生';
}

View File

@@ -37,7 +37,7 @@ class ChapterModel extends MongoModel
'_id' => 0,
'c_source_id' => 0,
'c_site_code' => 0,
'c_site_uuid' => 0,
'c_source_uuid' => 0,
],
];
@@ -120,12 +120,18 @@ class ChapterModel extends MongoModel
$arrChapter = $this->getOne($arrFilter, $arrOptions);
if (!empty($arrChapter)) {
applyToKeys($arrChapter, ['created_at', 'updated_at'], 'formatMongoDate');
try {
applyToKeys($arrChapter, ['created_at', 'updated_at'], 'formatMongoDate');
} catch (\Exception $e) {
var_dump($arrChapter);
throw $e;
}
if ($boolReadContent) {
$arrChapter['content'] = StorageCore::getInstance()->read($arrChapter['c_content_path']);
$arrChapter['c_content'] = StorageCore::getInstance()->read($arrChapter['c_content_path']);
} else {
$arrChapter['content'] = '';
$arrChapter['c_content'] = '';
}
}
@@ -194,9 +200,9 @@ class ChapterModel extends MongoModel
foreach ($arrResult as &$arrItem) {
applyToKeys($arrItem, ['created_at', 'updated_at'], 'formatMongoDate');
$arrItem['content'] = '';
$arrItem['c_content'] = '';
if ($boolReadContent) {
$arrItem['content'] = StorageCore::getInstance()->read($arrItem['c_content_path']);
$arrItem['c_content'] = StorageCore::getInstance()->read($arrItem['c_content_path']);
}
}

View File

@@ -70,7 +70,7 @@ class NovelClicksModel extends MongoModel
],
[
'$inc' => ['nc_clicks' => 1],
'$set' => ['n_category' => $Novel->og_novel_category]
'$set' => ['n_category' => $Novel->n_category]
],
[
'upsert' => true

View File

@@ -44,7 +44,7 @@ class NovelModel extends MongoModel
'projection' => [
'_id' => 0,
'n_site_code' => 0,
'n_site_uuid' => 0,
'n_source_uuid' => 0,
'n_source_id' => 0,
],
];
@@ -63,7 +63,7 @@ class NovelModel extends MongoModel
try {
$arrConditions = array_map(function ($strKeyword) {
return ['og_novel_book_name' => ['$regex' => trim($strKeyword), '$options' => 'i']];
return ['n_name' => ['$regex' => trim($strKeyword), '$options' => 'i']];
}, $arrKeywords);
$UpdateResult = $this->getCol()->updateMany(
@@ -305,16 +305,16 @@ class NovelModel extends MongoModel
switch ($intType) {
case 1:
$arrCategory = array_values(CategoryModel::getManCategory());
$arrFilter['og_novel_category'] = ['$in' => $arrCategory];
$arrFilter['n_category'] = ['$in' => $arrCategory];
break;
case 2:
$arrCategory = array_values(CategoryModel::getWomenCategory());
$arrFilter['og_novel_category'] = ['$in' => $arrCategory];
$arrFilter['n_category'] = ['$in' => $arrCategory];
break;
}
if ($strStatus !== NULL) {
$arrFilter['og_novel_status'] = $strStatus;
$arrFilter['n_status'] = $strStatus;
}
return $this->findPaginatedWithCache($arrFilter, $intPage, $intLimit, $arrSort, $strKey, $intLifeTime,);
}
@@ -394,11 +394,11 @@ class NovelModel extends MongoModel
$arrFilter = [];
if (in_array($intType, [1, 2])) {
$arrFilter['og_novel_category'] = ['$in' => CategoryModel::getCategoryByType($intType)];
$arrFilter['n_category'] = ['$in' => CategoryModel::getCategoryByType($intType)];
}
if ($strStatus !== NULL) {
$arrFilter['og_novel_status'] = $strStatus;
$arrFilter['n_status'] = $strStatus;
}
return $this->findManyShuffledWithCache($arrFilter, $intCount, $arrSort, $strKey, $intLifeTime);
@@ -434,11 +434,11 @@ class NovelModel extends MongoModel
];
if ($strStatus !== NULL) {
$arrFilter['og_novel_status'] = $strStatus;
$arrFilter['n_status'] = $strStatus;
}
if (in_array($intType, [1, 2])) {
$arrFilter['og_novel_category'] = ['$in' => CategoryModel::getCategoryByType($intType)];
$arrFilter['n_category'] = ['$in' => CategoryModel::getCategoryByType($intType)];
}
$arrOptions = [