refactor: 产品分类推荐列表图片改为缩略图
All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 2s
All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 2s
This commit is contained in:
@@ -16,8 +16,6 @@ class ProductCategoryRecommend
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$server = request()->server();
|
|
||||||
$image_host = $server['REQUEST_SCHEME'] . "://" . $server['SERVER_NAME'] . '/';
|
|
||||||
$param = request()->get([
|
$param = request()->get([
|
||||||
'keywords',
|
'keywords',
|
||||||
'category_name',
|
'category_name',
|
||||||
@@ -40,10 +38,10 @@ class ProductCategoryRecommend
|
|||||||
])
|
])
|
||||||
->bindAttr('category', ['category_name' => 'name'])
|
->bindAttr('category', ['category_name' => 'name'])
|
||||||
->hidden(['category', 'language_id', 'updated_at', 'deleted_at'])
|
->hidden(['category', 'language_id', 'updated_at', 'deleted_at'])
|
||||||
?->each(function($item) use($image_host) {
|
?->each(function($item) {
|
||||||
// 拼接完整图片URL
|
// 列表页面图片输出缩略图
|
||||||
if (!empty($item['image'])) {
|
if (!empty($item['image'])) {
|
||||||
$item['image'] = url_join($image_host, $item['image']);
|
$item['image'] = thumb($item['image']);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user