From f616bc595983ba2d80a2b44a321ab8f3142052ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sun, 9 Oct 2022 22:33:37 +0800 Subject: [PATCH] 1 --- business/partner/purchase/tiktok_store/store_sku2.go | 2 +- .../partner/purchase/tiktok_store/store_sku2_utils.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/tiktok_store/store_sku2.go b/business/partner/purchase/tiktok_store/store_sku2.go index d10134b0d..29977122f 100644 --- a/business/partner/purchase/tiktok_store/store_sku2.go +++ b/business/partner/purchase/tiktok_store/store_sku2.go @@ -334,7 +334,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI // spec_prices param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, 0, storeSku) - // ProductFormatNew + // ProductFormatNew 获取商品属性 productFormatNew, err := GetProductFormatNew(param.CategoryLeafId, storeDetail.VendorOrgCode) globals.SugarLogger.Debug("创建=============productFormatNew", productFormatNew) globals.SugarLogger.Debug("创建=============productFormatNew err", err) diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index 9b15220b9..110a6f6aa 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -12,6 +12,10 @@ import ( "strings" ) +type PropertyObj struct { + PropertyId []*tiktokShop.ProductFormatNewList `json:"property_id"` +} + // GetProductFormatNew 获取物品属性 func GetProductFormatNew(categoryLeftId int64, vendorOrgCode string) (string, error) { category, err := getAPI(vendorOrgCode, 0, "").GetCatePropertyV2(categoryLeftId) @@ -19,7 +23,7 @@ func GetProductFormatNew(categoryLeftId int64, vendorOrgCode string) (string, er if err != nil { return "", err } - format := make(map[string][]*tiktokShop.ProductFormatNewList, 0) + var format PropertyObj for _, v := range category.Data.Data { for _, d := range v.Options { formateNew := &tiktokShop.ProductFormatNewList{ @@ -27,7 +31,7 @@ func GetProductFormatNew(categoryLeftId int64, vendorOrgCode string) (string, er Name: d.Name, DiyType: v.DiyType, } - format[utils.Int64ToStr(v.CategoryId)] = append(format[utils.Int64ToStr(v.CategoryId)], formateNew) + format.PropertyId = append(format.PropertyId, formateNew) } } productFormatNew, err := json.Marshal(format)