diff --git a/app/common.php b/app/common.php index 6f788bd..99322f6 100644 --- a/app/common.php +++ b/app/common.php @@ -318,6 +318,24 @@ function getLang() return $firstPath; } +/** + * 按当前语言取前台语义 ID(config/ui_ids.php) + * @param string $key 如 nav_header / product + * @param string|null $lang 默认 getLang();zh-cn 会归一为 zh + */ +function uiId(string $key, ?string $lang = null): int +{ + $lang = $lang ?: getLang(); + if ($lang === 'zh-cn' || $lang === config('lang.simplified_chinese')) { + $lang = 'zh'; + } + $row = config('ui_ids.' . $key); + if (!is_array($row)) { + return (int)$row; + } + return (int)($row[$lang] ?? $row['zh'] ?? 0); +} + function optEventLog($id, $title, $operation) { diff --git a/config/ui_ids.php b/config/ui_ids.php new file mode 100644 index 0000000..9555ae0 --- /dev/null +++ b/config/ui_ids.php @@ -0,0 +1,25 @@ + ['zh' => 47, 'en' => 49], // 顶部导航_新 + 'nav_footer' => ['zh' => 48, 'en' => 50], // 睿能科技底部导航 + + // 栏目(header / footer 业务判断与标签查询) + 'home' => ['zh' => 36, 'en' => 706], // 首页 + 'product' => ['zh' => 333, 'en' => 704], // 产品 + 'solution' => ['zh' => 345, 'en' => 716], // 解决方案 + 'support' => ['zh' => 355, 'en' => 724], // 服务支持 + 'news' => ['zh' => 361, 'en' => 730], // 新闻动态 + 'exhibition' => ['zh' => 364, 'en' => 733], // 展会与活动 + 'invest' => ['zh' => 365, 'en' => 734], // 投资者关系 + 'about' => ['zh' => 371, 'en' => 740], // 关于睿能 + 'search_hot' => ['zh' => 679, 'en' => 748], // 搜索-热门搜索词 + 'social_channel' => ['zh' => 707, 'en' => 749], // 社交频道 +]; diff --git a/public/themes/website/1/en/demo/components/footer.html b/public/themes/website/1/en/demo/components/footer.html index 4d4ccf9..ef312e8 100644 --- a/public/themes/website/1/en/demo/components/footer.html +++ b/public/themes/website/1/en/demo/components/footer.html @@ -25,9 +25,13 @@