商品图片

This commit is contained in:
TL 2022-07-26 17:23:09 +08:00
parent 18945b8843
commit 6fcd8141b3
2 changed files with 8 additions and 2 deletions

View File

@ -26,7 +26,10 @@ class ProductDetail extends JsonResource
'name' => $this->description->name ?? '',
'description' => $this->description->description ?? '',
'images' => array_map(function ($image) {
return image_resize($image);
return [
'image' => image_resize($image, 600, 600),
'thumb' => image_resize($image, 150, 150)
];
}, $this->images ?? []),
'category_id' => $this->category_id ?? null,
'variables' => $this->decodeVariables($this->variables),

View File

@ -22,7 +22,10 @@ class SkuDetail extends JsonResource
'variants' => $this->variants,
'position' => $this->position,
'images' => array_map(function ($image) {
return image_resize($image, 600, 600);
return [
'image' => image_resize($image, 600, 600),
'thumb' => image_resize($image, 150, 150)
];
}, $this->images ?? []),
'model' => $this->model,
'sku' => $this->sku,