代码优化

https://guangdagit.com/beike/beikeshop/issues/224
This commit is contained in:
TL 2022-09-05 16:05:57 +08:00 committed by Edward Yang
parent 9cd6934a02
commit ea032fe4a7
1 changed files with 6 additions and 1 deletions

View File

@ -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,
];
}