From ea032fe4a73b4b420b259743aa331cdd221a1f66 Mon Sep 17 00:00:00 2001 From: TL Date: Mon, 5 Sep 2022 16:05:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=20https://?= =?UTF-8?q?guangdagit.com/beike/beikeshop/issues/224?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beike/Shop/Http/Resources/RmaDetail.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/beike/Shop/Http/Resources/RmaDetail.php b/beike/Shop/Http/Resources/RmaDetail.php index 04599e9e..22fda829 100644 --- a/beike/Shop/Http/Resources/RmaDetail.php +++ b/beike/Shop/Http/Resources/RmaDetail.php @@ -21,6 +21,11 @@ class RmaDetail extends JsonResource $types = RmaRepo::getTypes(); $statuses = RmaRepo::getStatuses(); + if ($this->reason) { + $reason = json_decode($this->reason->name, true)[locale()] ?? ''; + } else { + $reason = ''; + } return [ 'id' => $this->id, 'order_product_id' => $this->order_product_id, @@ -35,7 +40,7 @@ class RmaDetail extends JsonResource 'product_name' => $this->product_name, 'name' => $this->name, 'sku' => $this->sku, - 'reason' => json_decode($this->reason->name, true)[locale()] ?? '', + 'reason' => $reason, 'type_text' => $this->type_text, ]; }