修改美团商品复制skus box_num和box_price没有值的时候删除字段
This commit is contained in:
@@ -170,13 +170,18 @@ func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mt
|
|||||||
foodData[mtwmapi.KeyAppFoodCode] = time.Now().UnixNano() + int64(i*3)
|
foodData[mtwmapi.KeyAppFoodCode] = time.Now().UnixNano() + int64(i*3)
|
||||||
}
|
}
|
||||||
|
|
||||||
//skus := []map[string]interface{}{
|
skus := make([]interface{}, 0)
|
||||||
// map[string]interface{}{
|
for _, v := range storeSku.SkuList {
|
||||||
// "sku_id": foodData[mtwmapi.KeyAppFoodCode],
|
mapSkuList := utils.Struct2MapByJson(v)
|
||||||
// },
|
if v.BoxNum == "" {
|
||||||
//}
|
delete(mapSkuList, "box_num")
|
||||||
|
}
|
||||||
foodData["skus"] = storeSku.SkuList
|
if v.BoxPrice == "" {
|
||||||
|
delete(mapSkuList, "box_price")
|
||||||
|
}
|
||||||
|
skus = append(skus, mapSkuList)
|
||||||
|
}
|
||||||
|
foodData["skus"] = skus
|
||||||
foodData["name"] = utils.LimitUTF8StringLen(storeSku.Name, mtwmapi.MaxSkuNameCharCount)
|
foodData["name"] = utils.LimitUTF8StringLen(storeSku.Name, mtwmapi.MaxSkuNameCharCount)
|
||||||
foodData["description"] = storeSku.Description
|
foodData["description"] = storeSku.Description
|
||||||
foodData["price"] = storeSku.Price
|
foodData["price"] = storeSku.Price
|
||||||
|
|||||||
Reference in New Issue
Block a user