1
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user