fix(seo-copy): restore default detail and play copy
This commit is contained in:
@@ -1195,9 +1195,7 @@ class VideoService
|
||||
|
||||
$arrPageKeys = $this->buildSeoCopyPageKeys($strScene, $arrOptions);
|
||||
|
||||
$boolSuppressDefaultOnlySeoCopy = $this->shouldSuppressDefaultOnlySeoCopy($strScene, $strHost, $arrPageKeys);
|
||||
|
||||
$arrData = (!$boolSuppressDefaultOnlySeoCopy && !empty($arrPageKeys))
|
||||
$arrData = !empty($arrPageKeys)
|
||||
? SeoCopyStore::getPreferredPageData($strHost, $strScene, $arrPageKeys)
|
||||
: [];
|
||||
|
||||
@@ -1212,43 +1210,6 @@ class VideoService
|
||||
return $this->normalizeSeoCopyBlock($strScene, $arrData);
|
||||
}
|
||||
|
||||
private function shouldSuppressDefaultOnlySeoCopy(string $strScene, string $strHost, array $arrPageKeys): bool
|
||||
{
|
||||
if (!in_array($strScene, ['detail', 'play'], true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$arrSpecificKeys = array_values(array_filter($arrPageKeys, static function ($strPageKey): bool {
|
||||
$strPageKey = trim((string)$strPageKey);
|
||||
return $strPageKey !== '' && $strPageKey !== 'default';
|
||||
}));
|
||||
|
||||
if (empty($arrSpecificKeys)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (SeoCopyStore::preferredRoots() as $strRoot) {
|
||||
$strRoot = rtrim(trim((string)$strRoot), '/');
|
||||
if ($strRoot === '' || !is_dir($strRoot)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($arrSpecificKeys as $strPageKey) {
|
||||
$strPath = SeoCopyStore::resolvePagePathFromRoot($strRoot, $strHost, $strScene, $strPageKey);
|
||||
if ($strPath !== '' && is_file($strPath)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$strDefaultPath = SeoCopyStore::resolvePagePathFromRoot($strRoot, $strHost, $strScene, 'default');
|
||||
if ($strDefaultPath !== '' && is_file($strDefaultPath)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* BSONDocument / 对象 / array 统一转数组(递归)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user