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

@@ -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
{