diff --git a/business/jxstore/cms/system_store_sku.go b/business/jxstore/cms/system_store_sku.go index 19fa2cd30..9d32fe27d 100644 --- a/business/jxstore/cms/system_store_sku.go +++ b/business/jxstore/cms/system_store_sku.go @@ -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