From 04f85b02a40c82f70aad064b7df54641ae43702d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 26 Oct 2023 09:29:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BE=8E=E5=9B=A2=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=A4=8D=E5=88=B6skus=20box=5Fnum=E5=92=8Cbox=5Fprice?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=80=BC=E7=9A=84=E6=97=B6=E5=80=99=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/system_store_sku.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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