This commit is contained in:
make
2026-01-11 23:20:30 +08:00
parent 222454acef
commit 7823de7ddd
16 changed files with 565 additions and 200 deletions

View File

@@ -215,6 +215,14 @@ class SiteStyle
// 页面规则
$homePage = self::buildHomePageCfg($seed);
$categoryIndexPage = self::buildCategoryIndexPageCfg($seed);
$categoryHomePage = [
// 3 套母型A / B / C
'family' => ['A', 'B', 'C'][$seed % 3],
// 每套母型 10 个子变体09
'variant' => ($seed >> 4) % 10,
];
$categoryPage = self::buildCategoryPageCfg($seed);
$categoryListPage = self::buildCategoryListPageCfg($seed);
$searchPage = self::buildSearchPageCfg($seed);
@@ -297,6 +305,7 @@ class SiteStyle
'pages' => [
'home' => $homePage,
'category_home' => $categoryHomePage,
'category_index' => $categoryIndexPage,
'category' => $categoryPage,
'category_list' => $categoryListPage,
@@ -484,6 +493,8 @@ class SiteStyle
"seowords/layout/layout_" . $cfg['pages']['detail']['seowords']['layout'] . ".css",
"pinlun/_pinlun_layout_" . $cfg['pages']['detail']['pinlun']['layout'] . ".css",
"category/category_home/family_" . $cfg['pages']['category_home']['family'] . ".css",
"banner/banner_" . sprintf('%02d', $tpl['banner_tpl']) . ".css",
"list/list_" . sprintf('%02d', $tpl['list_tpl']) . ".css",
"detail/detail_" . sprintf('%02d', $tpl['detail_tpl']) . ".css",

View File

@@ -20,83 +20,6 @@ class SeoRenderer
// $this->pool = SiteStyle::SEO_POOL[$poolId]['seo_phrase'] ?? [];
}
/**
* 只负责:选一条模板
*/
// public function getTemplate(string $field, string $strPage): string
// {
// // 1⃣ 取当前字段 + 页面类型的文案池
// $phrases = loadSeoFile(
// $this->cfg['pool_id'],
// $strPage,
// $field
// );
// if (!$phrases) {
// return '';
// }
// // 2⃣ 冻结的 slot
// $slot = $this->cfg['phrase_pick'][$strPage][$field] ?? 0;
// // slot 是二维
// if (isset($phrases[$slot]) && is_array($phrases[$slot])) {
// $list = $phrases[$slot];
// } else {
// $list = $phrases;
// }
// // 3⃣ 稳定消费 index不受扩容影响
// $len = $this->cfg['slot_len'][$strPage][$field] ?? count($list);
// $len = max(1, min($len, count($list)));
// // $idx = abs(crc32(
// // Request::pathinfo() ?: Request::host()
// // )) % $len;
// $idx = $this->cfg['phrase_idx'][$strPage][$field] ?? 0;
// return $list[$idx] ?? '';
// return $list[$idx] ?? '';
// }
// public function getTemplate(string $field, string $strPage): string
// {
// if (empty($this->cfg['pool_id'])) {
// return '';
// }
// // 1⃣ 加载运行期文案池(不冻结)
// $phrases = loadSeoFile(
// $this->cfg['pool_id'],
// $strPage,
// $field
// );
// if (!$phrases || !is_array($phrases)) {
// return '';
// }
// // 2⃣ 冻结 slot
// $slot = $this->cfg['phrase_pick'][$strPage][$field] ?? 0;
// if (isset($phrases[$slot]) && is_array($phrases[$slot])) {
// $list = $phrases[$slot];
// } else {
// // 兜底:当成单 slot
// $list = $phrases;
// }
// if (!$list) {
// return '';
// }
// // 3⃣ 冻结 idx核心
// $idx = $this->cfg['phrase_idx'][$strPage][$field] ?? 0;
// return $list[$idx] ?? '';
// }
public function getTemplate(string $field, string $strPage): string
{