perf: 关键词高亮
This commit is contained in:
@@ -299,9 +299,10 @@ class Product extends Common
|
||||
'query' => request()->param()
|
||||
])
|
||||
->each(function ($item) use($keywords) {
|
||||
$item['spu'] = highlight_keywords($item['spu'], $keywords, ['redpoint']);
|
||||
$item['name'] = highlight_keywords($item['name'], $keywords, ['redpoint']);
|
||||
$item['short_name'] = highlight_keywords($item['short_name'], $keywords, ['redpoint']);
|
||||
$replace = fn($txt) => '<strong class="redpoint">' . $txt . '</strong>';
|
||||
$item['spu'] = highlight_keywords($item['spu'], $keywords, $replace);
|
||||
$item['name'] = highlight_keywords($item['name'], $keywords, $replace);
|
||||
$item['short_name'] = highlight_keywords($item['short_name'], $keywords, $replace);
|
||||
return $item;
|
||||
});
|
||||
View::assign('products', $products);
|
||||
|
||||
Reference in New Issue
Block a user