|
|
@ -113,6 +113,24 @@ class SearchController extends BaseController |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
* 搜索结果类型展示名(随语言) |
|
|
|
|
|
*/ |
|
|
|
|
|
private function searchKindLabel(string $kindKey): string |
|
|
|
|
|
{ |
|
|
|
|
|
$isEn = ($this->lang === 'en'); |
|
|
|
|
|
$map = [ |
|
|
|
|
|
'product' => $isEn ? 'Products' : '产品', |
|
|
|
|
|
'news' => $isEn ? 'News' : '新闻', |
|
|
|
|
|
'faq' => $isEn ? 'FAQ' : '常见问题', |
|
|
|
|
|
'download' => $isEn ? 'Download Center' : '下载中心', |
|
|
|
|
|
'video_tutorial' => $isEn ? 'Video Tutorials' : '视频教程', |
|
|
|
|
|
'announce' => $isEn ? 'Product Announcements' : '产品公告', |
|
|
|
|
|
'content' => $isEn ? 'Content' : '内容', |
|
|
|
|
|
]; |
|
|
|
|
|
return $map[$kindKey] ?? ($isEn ? 'Content' : '内容'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
* 解析搜索结果类型 |
|
|
* 解析搜索结果类型 |
|
|
* @param int $contentId 内容 ID |
|
|
* @param int $contentId 内容 ID |
|
|
* @param array $sets content / cate 集合(array_flip 后的 isset 表) |
|
|
* @param array $sets content / cate 集合(array_flip 后的 isset 表) |
|
|
@ -122,29 +140,29 @@ class SearchController extends BaseController |
|
|
{ |
|
|
{ |
|
|
// 产品:内容命中 或 关联栏目落在产品树
|
|
|
// 产品:内容命中 或 关联栏目落在产品树
|
|
|
if (isset($sets['product'][$contentId]) || $this->cateIdsHit($cateIds, $sets['product_cates'] ?? [])) { |
|
|
if (isset($sets['product'][$contentId]) || $this->cateIdsHit($cateIds, $sets['product_cates'] ?? [])) { |
|
|
return ['product', '产品']; |
|
|
|
|
|
|
|
|
return ['product', $this->searchKindLabel('product')]; |
|
|
} |
|
|
} |
|
|
// 企业视频:交互同视频,类型名显示新闻
|
|
|
// 企业视频:交互同视频,类型名显示新闻
|
|
|
if (isset($sets['news_video'][$contentId]) || $this->cateIdsHit($cateIds, $sets['news_video_cates'] ?? [])) { |
|
|
if (isset($sets['news_video'][$contentId]) || $this->cateIdsHit($cateIds, $sets['news_video_cates'] ?? [])) { |
|
|
return ['video', '新闻']; |
|
|
|
|
|
|
|
|
return ['video', $this->searchKindLabel('news')]; |
|
|
} |
|
|
} |
|
|
if (isset($sets['news'][$contentId]) || $this->cateIdsHit($cateIds, $sets['news_cates'] ?? [])) { |
|
|
if (isset($sets['news'][$contentId]) || $this->cateIdsHit($cateIds, $sets['news_cates'] ?? [])) { |
|
|
return ['news', '新闻']; |
|
|
|
|
|
|
|
|
return ['news', $this->searchKindLabel('news')]; |
|
|
} |
|
|
} |
|
|
if (isset($sets['faq'][$contentId]) || $this->cateIdsHit($cateIds, $sets['faq_cates'] ?? [])) { |
|
|
if (isset($sets['faq'][$contentId]) || $this->cateIdsHit($cateIds, $sets['faq_cates'] ?? [])) { |
|
|
return ['faq', '常见问题']; |
|
|
|
|
|
|
|
|
return ['faq', $this->searchKindLabel('faq')]; |
|
|
} |
|
|
} |
|
|
// 下载中心(含社会责任报告子栏目)
|
|
|
// 下载中心(含社会责任报告子栏目)
|
|
|
if (isset($sets['download'][$contentId]) || $this->cateIdsHit($cateIds, $sets['download_cates'] ?? [])) { |
|
|
if (isset($sets['download'][$contentId]) || $this->cateIdsHit($cateIds, $sets['download_cates'] ?? [])) { |
|
|
return ['download', '下载中心']; |
|
|
|
|
|
|
|
|
return ['download', $this->searchKindLabel('download')]; |
|
|
} |
|
|
} |
|
|
if (isset($sets['video'][$contentId]) || $this->cateIdsHit($cateIds, $sets['video_cates'] ?? [])) { |
|
|
if (isset($sets['video'][$contentId]) || $this->cateIdsHit($cateIds, $sets['video_cates'] ?? [])) { |
|
|
return ['video', '视频教程']; |
|
|
|
|
|
|
|
|
return ['video', $this->searchKindLabel('video_tutorial')]; |
|
|
} |
|
|
} |
|
|
if (isset($sets['announce'][$contentId]) || $this->cateIdsHit($cateIds, $sets['announce_cates'] ?? [])) { |
|
|
if (isset($sets['announce'][$contentId]) || $this->cateIdsHit($cateIds, $sets['announce_cates'] ?? [])) { |
|
|
return ['announce', '产品公告']; |
|
|
|
|
|
|
|
|
return ['announce', $this->searchKindLabel('announce')]; |
|
|
} |
|
|
} |
|
|
return ['content', '内容']; |
|
|
|
|
|
|
|
|
return ['content', $this->searchKindLabel('content')]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -298,9 +316,9 @@ class SearchController extends BaseController |
|
|
'announce_cates' => array_flip($announceCateIds), |
|
|
'announce_cates' => array_flip($announceCateIds), |
|
|
]; |
|
|
]; |
|
|
$tabKindMap = [ |
|
|
$tabKindMap = [ |
|
|
'product' => ['product', '产品'], |
|
|
|
|
|
'news' => ['news', '新闻'], |
|
|
|
|
|
'faq' => ['faq', '常见问题'], |
|
|
|
|
|
|
|
|
'product' => ['product', $this->searchKindLabel('product')], |
|
|
|
|
|
'news' => ['news', $this->searchKindLabel('news')], |
|
|
|
|
|
'faq' => ['faq', $this->searchKindLabel('faq')], |
|
|
]; |
|
|
]; |
|
|
$newsVideoIdSet = $kindSets['news_video']; |
|
|
$newsVideoIdSet = $kindSets['news_video']; |
|
|
$currentLang = $this->lang; |
|
|
$currentLang = $this->lang; |
|
|
|