|
|
@ -114,6 +114,10 @@ class SearchController extends BaseController |
|
|
if (isset($sets['product'][$contentId])) { |
|
|
if (isset($sets['product'][$contentId])) { |
|
|
return ['product', '产品']; |
|
|
return ['product', '产品']; |
|
|
} |
|
|
} |
|
|
|
|
|
// 企业视频优先于新闻:交互同视频教程,类型仍显示新闻
|
|
|
|
|
|
if (isset($sets['news_video'][$contentId])) { |
|
|
|
|
|
return ['video', '新闻']; |
|
|
|
|
|
} |
|
|
if (isset($sets['news'][$contentId])) { |
|
|
if (isset($sets['news'][$contentId])) { |
|
|
return ['news', '新闻']; |
|
|
return ['news', '新闻']; |
|
|
} |
|
|
} |
|
|
@ -184,6 +188,10 @@ class SearchController extends BaseController |
|
|
$productContentIds = $this->getContentIdsByCategoryIds($this->getCategoryTreeIds(self::PRODUCT_CATE_ID)); |
|
|
$productContentIds = $this->getContentIdsByCategoryIds($this->getCategoryTreeIds(self::PRODUCT_CATE_ID)); |
|
|
$newsContentIds = $this->getContentIdsByCategoryIds($this->getCategoryTreeIds(self::NEWS_CATE_ID)); |
|
|
$newsContentIds = $this->getContentIdsByCategoryIds($this->getCategoryTreeIds(self::NEWS_CATE_ID)); |
|
|
$faqContentIds = $this->getContentIdsByCategoryIds($this->getCategoryTreeIds(self::FAQ_CATE_ID)); |
|
|
$faqContentIds = $this->getContentIdsByCategoryIds($this->getCategoryTreeIds(self::FAQ_CATE_ID)); |
|
|
|
|
|
$newsVideoCateId = uiId('news_video'); |
|
|
|
|
|
$newsVideoContentIds = $newsVideoCateId > 0 |
|
|
|
|
|
? $this->getContentIdsByCategoryIds($this->getCategoryTreeIds($newsVideoCateId)) |
|
|
|
|
|
: []; |
|
|
|
|
|
|
|
|
// 其他 = 下载中心 + 视频 + 公告
|
|
|
// 其他 = 下载中心 + 视频 + 公告
|
|
|
$downloadContentIds = $this->getContentIdsByCategoryIds($this->getCategoryTreeIds(self::DOWNLOAD_CATE_ID)); |
|
|
$downloadContentIds = $this->getContentIdsByCategoryIds($this->getCategoryTreeIds(self::DOWNLOAD_CATE_ID)); |
|
|
@ -236,8 +244,10 @@ class SearchController extends BaseController |
|
|
$downloadIdSet = array_flip($downloadContentIds); |
|
|
$downloadIdSet = array_flip($downloadContentIds); |
|
|
$videoIdSet = array_flip($videoContentIds); |
|
|
$videoIdSet = array_flip($videoContentIds); |
|
|
$announceIdSet = array_flip($announceContentIds); |
|
|
$announceIdSet = array_flip($announceContentIds); |
|
|
|
|
|
$newsVideoIdSet = array_flip($newsVideoContentIds); |
|
|
$kindSets = [ |
|
|
$kindSets = [ |
|
|
'product' => $productIdSet, |
|
|
'product' => $productIdSet, |
|
|
|
|
|
'news_video' => $newsVideoIdSet, |
|
|
'news' => $newsIdSet, |
|
|
'news' => $newsIdSet, |
|
|
'faq' => $faqIdSet, |
|
|
'faq' => $faqIdSet, |
|
|
'download' => $downloadIdSet, |
|
|
'download' => $downloadIdSet, |
|
|
@ -255,7 +265,7 @@ class SearchController extends BaseController |
|
|
->paginate([ |
|
|
->paginate([ |
|
|
'page' => $param['page'] ?? 1, |
|
|
'page' => $param['page'] ?? 1, |
|
|
'list_rows' => $param['limit'] ?? 10, |
|
|
'list_rows' => $param['limit'] ?? 10, |
|
|
])->each(function (&$item) use ($type, $tabKindMap, $kindSets) { |
|
|
|
|
|
|
|
|
])->each(function (&$item) use ($type, $tabKindMap, $kindSets, $newsVideoIdSet) { |
|
|
$row = $item->toArray(); |
|
|
$row = $item->toArray(); |
|
|
if (!empty($row['category'])) { |
|
|
if (!empty($row['category'])) { |
|
|
$item['category'] = $row['category']; |
|
|
$item['category'] = $row['category']; |
|
|
@ -269,14 +279,20 @@ class SearchController extends BaseController |
|
|
$item['content'] = $rawContent !== '' ? htmlspecialchars_decode((string)$rawContent) : ''; |
|
|
$item['content'] = $rawContent !== '' ? htmlspecialchars_decode((string)$rawContent) : ''; |
|
|
$item['sr_date'] = $this->formatSearchDate($row['publish_time'] ?? ($row['create_time'] ?? '')); |
|
|
$item['sr_date'] = $this->formatSearchDate($row['publish_time'] ?? ($row['create_time'] ?? '')); |
|
|
|
|
|
|
|
|
|
|
|
$contentId = (int)($row['id'] ?? 0); |
|
|
if (isset($tabKindMap[$type])) { |
|
|
if (isset($tabKindMap[$type])) { |
|
|
[$kind, $name] = $tabKindMap[$type]; |
|
|
[$kind, $name] = $tabKindMap[$type]; |
|
|
} else { |
|
|
} else { |
|
|
[$kind, $name] = $this->resolveSearchKind((int)($row['id'] ?? 0), $kindSets); |
|
|
|
|
|
|
|
|
[$kind, $name] = $this->resolveSearchKind($contentId, $kindSets); |
|
|
if ($kind === 'content' && !empty($row['category'][0]['title'])) { |
|
|
if ($kind === 'content' && !empty($row['category'][0]['title'])) { |
|
|
$name = $row['category'][0]['title']; |
|
|
$name = $row['category'][0]['title']; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// 企业视频:交互同视频教程,类型名仍为新闻
|
|
|
|
|
|
if (isset($newsVideoIdSet[$contentId])) { |
|
|
|
|
|
$kind = 'video'; |
|
|
|
|
|
$name = '新闻'; |
|
|
|
|
|
} |
|
|
$item['sr_kind'] = $kind; |
|
|
$item['sr_kind'] = $kind; |
|
|
$item['sr_tab_name'] = $name; |
|
|
$item['sr_tab_name'] = $name; |
|
|
}); |
|
|
}); |
|
|
|