From eab07f2f046eeea27d0ee7f79b0e4e82b3f136e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Wed, 21 Oct 2026 11:49:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=8F=91=E7=A5=A8=E5=88=97=E8=A1=A8):=20?= =?UTF-8?q?=E8=81=94=E7=B3=BB=E4=BA=BA=E4=B8=BA=E7=A9=BA=E4=B8=B2=E6=97=B6?= =?UTF-8?q?=E5=9B=9E=E9=80=80=E4=B8=8B=E5=8D=95=E7=94=A8=E6=88=B7=E8=B5=84?= =?UTF-8?q?=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ?? 只拦 null 拦不住空串,改为 trim 后判空回退 --- backend/app/services/order/OrderInvoiceServices.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/app/services/order/OrderInvoiceServices.php b/backend/app/services/order/OrderInvoiceServices.php index e1b9a3877..4cadd68bc 100644 --- a/backend/app/services/order/OrderInvoiceServices.php +++ b/backend/app/services/order/OrderInvoiceServices.php @@ -95,9 +95,11 @@ class OrderInvoiceServices extends BaseService // 前端契约:列表展示的订单号对应中台 order_no $item['order_id'] = $order['order_no'] ?? ''; $item['pay_price'] = $order['pay_price'] ?? 0.00; - // 收货人姓名电话优先取订单快照,缺失时回退下单用户资料 - $item['real_name'] = $contact['name'] ?? ($user['real_name'] ?? ($user['nickname'] ?? '')); - $item['user_phone'] = $contact['phone'] ?? ($user['phone'] ?? ''); + // 收货人姓名电话优先取订单快照,空串需回退下单用户资料(?? 只拦 null,拦不住空串) + $contactName = trim((string)($contact['name'] ?? '')); + $contactPhone = trim((string)($contact['phone'] ?? '')); + $item['real_name'] = $contactName !== '' ? $contactName : trim((string)($user['real_name'] ?? ($user['nickname'] ?? ''))); + $item['user_phone'] = $contactPhone !== '' ? $contactPhone : trim((string)($user['phone'] ?? '')); $item['status'] = $this->statusToLegacy($order['status_code'] ?? ''); $item['refund_status'] = $order['refund_status'] ?? 0; $item['add_time'] = date('Y-m-d H:i:s', $order['add_time'] ?? $item['invoice_add_time'] ?? time());