From 6a21576f062456932ae462a30a87a01ff1c1d0de Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Mon, 5 Dec 2022 19:16:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=BB=E5=95=86=E5=93=81=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beike/Shop/Http/Resources/ProductSimple.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/beike/Shop/Http/Resources/ProductSimple.php b/beike/Shop/Http/Resources/ProductSimple.php index 4c05b0e7..841e6958 100644 --- a/beike/Shop/Http/Resources/ProductSimple.php +++ b/beike/Shop/Http/Resources/ProductSimple.php @@ -31,6 +31,11 @@ class ProductSimple extends JsonResource } $name = $this->description->name ?? ''; + if ($masterSku && $masterSku->images) { + $images = $masterSku->images; + } else { + $images = $this->images ?? []; + } return [ 'id' => $this->id, @@ -47,7 +52,7 @@ class ProductSimple extends JsonResource 'images' => array_map(function ($item) { return image_resize($item, 400, 400); - }, array_merge($this->images ?? [], $masterSku->images ?? [])), + }, $images), ]; } }