From dd1e4d9c2337565545a7712e57cc1b8e507993e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 2 Mar 2021 09:24:40 +0800 Subject: [PATCH] aa --- business/partner/purchase/jd/sku2.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/jd/sku2.go b/business/partner/purchase/jd/sku2.go index 29ec7b706..8cd8043cb 100644 --- a/business/partner/purchase/jd/sku2.go +++ b/business/partner/purchase/jd/sku2.go @@ -156,7 +156,7 @@ func skuInfo2Param(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (param *jd param = &jdapi.OpSkuParam{ TraceID: ctx.GetTrackInfo(), OutSkuID: utils.Int2Str(sku.SkuID), - ShopCategories: []int64{utils.Str2Int64(sku.VendorCatID)}, + ShopCategories: []int64{}, CategoryID: sku.VendorVendorCatID, BrandID: DefBrandID, SkuName: utils.LimitUTF8StringLen(sku.SkuName, jdapi.MaxSkuNameCharCount), @@ -168,6 +168,9 @@ func skuInfo2Param(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (param *jd Upc: sku.Upc, // Images: jxutils.BatchString2Slice(sku.Img, sku.Img2), } + if sku.VendorCatID != "" { + param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(sku.VendorCatID)) + } if sku.ImgMix != "" { param.Images = jxutils.BatchString2Slice(sku.ImgMix, sku.Img2, sku.Img3) } else { @@ -201,7 +204,7 @@ func (p *PurchaseHandler) CreateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSy OutSkuId: utils.Int2Str(sku.SkuID), Upc: sku.Upc, JdPrice: utils.Int64ToStr(sku.Price), - ShopCategoryID: utils.Str2Int64(sku.VendorCatID), + ShopCategoryID: utils.Str2Int64WithDefault((sku.VendorCatID), 0), }, }) if err2 == nil {