From 594028c189e395dd705e779f9bfe742c7ed42618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 30 Jan 2024 09:21:10 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/system_store_sku.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/system_store_sku.go b/business/jxstore/cms/system_store_sku.go index b6f8c91d4..9afe0674a 100644 --- a/business/jxstore/cms/system_store_sku.go +++ b/business/jxstore/cms/system_store_sku.go @@ -245,7 +245,7 @@ func CopyMtToMT(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail, isA // BatchInitSkuMT2MT 批量创建商品 func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mtwmapi.API, vendorStoreID string, i int) error { foodDataList := make([]map[string]interface{}, len(fromSku)) - for i, storeSku := range fromSku { + for _, storeSku := range fromSku { foodData := make(map[string]interface{}) if storeSku.AppFoodCode != "" { foodData[mtwmapi.KeyAppFoodCode] = storeSku.AppFoodCode @@ -294,7 +294,10 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi foodData["picture_contents"] = storeSku.PictureContents foodData["sequence"] = storeSku.Sequence foodData["tag_id"] = storeSku.TagID - foodData["upc"] = "no_upc" + foodData["upc"] = storeSku.UpcCode + if storeSku.UpcCode == "" { + foodData["upc"] = "no_upc" + } foodDataList[i] = foodData } @@ -303,6 +306,7 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi if len(foodDataList)%10 != 0 { count += 1 } + globals.SugarLogger.Debugf("===============data := %s", utils.Format4Output(foodDataList, false)) for i := 0; i < count; i++ { if i == count-1 { failedFoodList, _ := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:])