diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index 110a6f6aa..fecb863de 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -12,10 +12,6 @@ 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) @@ -23,7 +19,7 @@ func GetProductFormatNew(categoryLeftId int64, vendorOrgCode string) (string, er if err != nil { return "", err } - var format PropertyObj + format := make(map[string][]*tiktokShop.ProductFormatNewList, 0) for _, v := range category.Data.Data { for _, d := range v.Options { formateNew := &tiktokShop.ProductFormatNewList{ @@ -31,7 +27,7 @@ func GetProductFormatNew(categoryLeftId int64, vendorOrgCode string) (string, er Name: d.Name, DiyType: v.DiyType, } - format.PropertyId = append(format.PropertyId, formateNew) + format[utils.Int64ToStr(v.PropertyId)] = append(format[utils.Int64ToStr(v.CategoryId)], formateNew) } } productFormatNew, err := json.Marshal(format)