fix(videoGpt1): normalize seo pages and fallback services
This commit is contained in:
@@ -369,6 +369,41 @@ class VideoCategoryModel extends MongoModel
|
||||
return self::$arrCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve category display name by slug.
|
||||
*/
|
||||
static public function getNameBySlug(string $strSlug): string
|
||||
{
|
||||
$strSlug = trim($strSlug);
|
||||
if ($strSlug === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (isset(self::$arrCategory[$strSlug])) {
|
||||
return (string)self::$arrCategory[$strSlug];
|
||||
}
|
||||
|
||||
foreach (self::getCustomCategory() as $arrParentCategory) {
|
||||
if (!is_array($arrParentCategory)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((string)($arrParentCategory['v_category_en'] ?? '') === $strSlug) {
|
||||
return trim((string)($arrParentCategory['v_category'] ?? ''));
|
||||
}
|
||||
|
||||
foreach ((array)($arrParentCategory['children'] ?? []) as $arrChildCategory) {
|
||||
if ((string)($arrChildCategory['v_category_en'] ?? '') !== $strSlug) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return trim((string)($arrChildCategory['v_category'] ?? ''));
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* get pinyin based on chinese characters
|
||||
*
|
||||
|
||||
@@ -145,6 +145,20 @@ class VideoModel extends MongoModel
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compatibility wrapper for callers that expect a sorted cached query helper.
|
||||
*/
|
||||
public function findManySortedWithCache(
|
||||
array $arrFilter,
|
||||
int $intCount = 0,
|
||||
array $arrSort = [],
|
||||
string $strKey = '',
|
||||
int $intLifeTime = 24 * 3600,
|
||||
array $arrOptions = []
|
||||
): null|array {
|
||||
return $this->findManyWithCache($arrFilter, $intCount, $arrSort, $arrOptions, $strKey, $intLifeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* find one Video
|
||||
*
|
||||
@@ -179,6 +193,16 @@ class VideoModel extends MongoModel
|
||||
return $this->findOne($arrFilter);
|
||||
}
|
||||
|
||||
public function getVideoByNameEn(string $strNameEn): null|array
|
||||
{
|
||||
$strNameEn = trim($strNameEn);
|
||||
if ($strNameEn === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->findOne(['v_name_en' => $strNameEn]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询符合条件的随机多条小说
|
||||
|
||||
Reference in New Issue
Block a user