From 2e2188d6e5e71f90e6d456591c125081c0bc9848 Mon Sep 17 00:00:00 2001 From: mzl Date: Wed, 26 Aug 2026 11:43:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=87=E8=B4=A7=E5=8D=95=20detail=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=BD=A6=E8=BE=86=E5=88=97=E8=A1=A8=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E8=BF=94=E5=9B=9E=20attachment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prepareVehicleListData 组装每辆车时带上 attachment(模型 array cast 取出即 [{url, original_name}]);同款车按 unique_id 合并的行, 各车附件按 url+文件名并集去重后拼接。show 接口本就带,不动。 Co-Authored-By: Claude --- app/common/service/StockOrdersService.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/common/service/StockOrdersService.php b/app/common/service/StockOrdersService.php index cab4fcb..c6ffed7 100644 --- a/app/common/service/StockOrdersService.php +++ b/app/common/service/StockOrdersService.php @@ -884,6 +884,18 @@ class StockOrdersService $vehList[$v->unique_id]['remark'] = $v->remark; } } + // 拼接附件(并集去重,按 url+文件名) + $currAttach = is_array($v->attachment) ? $v->attachment : []; + if (!empty($currAttach)) { + $union = []; + foreach (array_merge($vehList[$v->unique_id]['attachment'], $currAttach) as $a) { + $key = ($a['url'] ?? '') . '|' . ($a['original_name'] ?? ''); + if (!isset($union[$key])) { + $union[$key] = $a; + } + } + $vehList[$v->unique_id]['attachment'] = array_values($union); + } continue; } $index++; @@ -899,6 +911,7 @@ class StockOrdersService 'mileage' => $v->mileage, 'remark' => $v->remark, 'vin' => $v->vin, + 'attachment' => is_array($v->attachment) ? $v->attachment : [], ] + $moneyValues; } return ['list' => $vehList];