Procházet zdrojové kódy

fix(product): 修复商品价格和SKU属性处理逻辑

- 添加了SKU属性为空时的else分支处理
- 修复了商品价格为0时使用代销价格作为默认值
- 确保最小价格、最大价格和当前价格在为0时进行正确的赋值处理
shichen před 3 měsíci
rodič
revize
69374dd121

+ 5 - 0
app/services/ThirdParty/AlibabaAgent/ProductService.php

@@ -311,6 +311,8 @@ class ProductService extends AlibabaAgentBaseService
311 311
                     'image'        => !empty($skuAttrs[0]['skuImageUrl'] ?? '') ? $this->buildImageUrl($skuAttrs[0]['skuImageUrl']) : '',
312 312
                 ];
313 313
             }
314
+        }else{
315
+
314 316
         }
315 317
 
316 318
         // --- 描述处理 ---
@@ -686,6 +688,9 @@ class ProductService extends AlibabaAgentBaseService
686 688
                 $detail['skuList'] = $skuList;
687 689
 
688 690
                 // 2. 商品级别价格加价
691
+                if ($detail['minPrice'] == 0) $detail['minPrice'] = $detail['sale']['consignPrice'];
692
+                if ($detail['maxPrice'] == 0) $detail['maxPrice'] = $detail['sale']['consignPrice'];
693
+                if ($detail['price'] == 0) $detail['price'] = $detail['sale']['consignPrice'];
689 694
                 $detail['originalMinPrice'] = $detail['minPrice'] ?? 0;
690 695
                 $detail['originalMaxPrice'] = $detail['maxPrice'] ?? 0;
691 696
                 $detail['originalPrice'] = $detail['price'] ?? 0;