From 8ac1b5460837d142603b3f3e7d350faa57edd06f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Sat, 10 Oct 2026 11:23:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85):=20?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E8=A7=84=E6=A0=BC=E5=9B=BE=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=8B=BC=E6=8E=A5=E7=AB=99=E7=82=B9=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/CenterProductServices.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/backend/app/services/product/CenterProductServices.php b/backend/app/services/product/CenterProductServices.php index 93f20a81b..4ba9f2f73 100644 --- a/backend/app/services/product/CenterProductServices.php +++ b/backend/app/services/product/CenterProductServices.php @@ -317,7 +317,7 @@ class CenterProductServices extends BaseService 'stock' => intval($attr['stock'] ?? 0), 'quota' => intval($attr['quota'] ?? $attr['stock'] ?? 0), 'quota_show' => intval($attr['quota_show'] ?? $attr['quota'] ?? $attr['stock'] ?? 0), - 'image' => $attr['pic'] ?? '', + 'image' => set_file_url($attr['pic'] ?? ''), 'unique' => $attr['unique'] ?? '', 'bar_code' => $attr['bar_code'] ?? '', 'weight' => floatval($attr['weight'] ?? 0), @@ -746,6 +746,23 @@ class CenterProductServices extends BaseService $specs = $handler->getDetailSpecs($id); $productAttr = $specs['productAttr'] ?? []; $productValue = $specs['productValue'] ?? []; + // 规格图拼站点域名(Handler 返回库内相对路径;仅展示侧拼接,编辑/存储链路保持相对路径) + foreach ($productValue as &$value) { + $value['image'] = set_file_url($value['image'] ?? '', $siteUrl); + } + unset($value); + foreach ($productAttr as &$attrItem) { + if (empty($attrItem['attr_value'])) { + continue; + } + foreach ($attrItem['attr_value'] as &$attrValue) { + if (is_array($attrValue) && !empty($attrValue['pic'])) { + $attrValue['pic'] = set_file_url($attrValue['pic'], $siteUrl); + } + } + unset($attrValue); + } + unset($attrItem); $specUnique = ''; if (count($productValue) === 1) { $firstValue = reset($productValue);