Ver código fonte

feat(product): 添加商品SKU规格ID存储功能

- 新增specId字段用于存储SKU规格信息
- 优化gong_sku_id字段的数据类型处理
- 增加sku_id和spec_id字段到数据库插入操作
- 完善商品属性值表的数据映射关系
shichen 3 meses atrás
pai
commit
fc672cf256

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

@@ -591,6 +591,7 @@ class ProductService extends AlibabaAgentBaseService
591
             }
591
             }
592
 
592
 
593
             $skuId = $sku['skuId'] ?? '';
593
             $skuId = $sku['skuId'] ?? '';
594
+            $specId = $sku['specId'] ?? '';
594
             $unique = $this->generateUnique($productId, $skuId ?: $skuKey);
595
             $unique = $this->generateUnique($productId, $skuId ?: $skuKey);
595
 
596
 
596
             Db::name('store_product_attr_value')->insert([
597
             Db::name('store_product_attr_value')->insert([
@@ -605,14 +606,16 @@ class ProductService extends AlibabaAgentBaseService
605
                 'stock'       => $sku['stock'] ?? 9999,
606
                 'stock'       => $sku['stock'] ?? 9999,
606
                 'cost_price'  => $sku['costPrice'] ?? 0,
607
                 'cost_price'  => $sku['costPrice'] ?? 0,
607
                 'extension_one' => 5,
608
                 'extension_one' => 5,
608
-                'gong_sku_id' => (string)$skuId,
609
+                'gong_sku_id' => $skuId,
609
                 'gong_mer_profit' => 0,
610
                 'gong_mer_profit' => 0,
610
                 'gong_pension'    => 0,
611
                 'gong_pension'    => 0,
611
                 'gong_market_price' => $sku['consignPrice'] ?? 0,
612
                 'gong_market_price' => $sku['consignPrice'] ?? 0,
612
                 'plate_mer_profit' => 0,
613
                 'plate_mer_profit' => 0,
613
                 'volume' => 0,
614
                 'volume' => 0,
614
                 'weight' => 0,
615
                 'weight' => 0,
615
-                'dacang_price' => 0
616
+                'dacang_price' => 0,
617
+                'sku_id' => $skuId,
618
+                'spec_id' => $specId
616
             ]);
619
             ]);
617
         }
620
         }
618
     }
621
     }