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];