This commit is contained in:
邹宗楠
2024-01-30 09:21:10 +08:00
parent 0f4eef4179
commit 594028c189

View File

@@ -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:])