修改美团商品复制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)
|
||||
}
|
||||
|
||||
//skus := []map[string]interface{}{
|
||||
// map[string]interface{}{
|
||||
// "sku_id": foodData[mtwmapi.KeyAppFoodCode],
|
||||
// },
|
||||
//}
|
||||
|
||||
foodData["skus"] = storeSku.SkuList
|
||||
skus := make([]interface{}, 0)
|
||||
for _, v := range storeSku.SkuList {
|
||||
mapSkuList := utils.Struct2MapByJson(v)
|
||||
if v.BoxNum == "" {
|
||||
delete(mapSkuList, "box_num")
|
||||
}
|
||||
if v.BoxPrice == "" {
|
||||
delete(mapSkuList, "box_price")
|
||||
}
|
||||
skus = append(skus, mapSkuList)
|
||||
}
|
||||
foodData["skus"] = skus
|
||||
foodData["name"] = utils.LimitUTF8StringLen(storeSku.Name, mtwmapi.MaxSkuNameCharCount)
|
||||
foodData["description"] = storeSku.Description
|
||||
foodData["price"] = storeSku.Price
|
||||
|
||||
Reference in New Issue
Block a user