This commit is contained in:
邹宗楠
2024-01-30 10:33:23 +08:00
parent bf9f3844f5
commit 4f1933c991

View File

@@ -212,6 +212,7 @@ func CopyMtToMT(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail, isA
//} //}
case 2: case 2:
i := offSet i := offSet
errList := make([]string, 0, 0)
for { for {
// 同步商品 // 同步商品
fromFoodList, err1 := fromApi.RetailListAll(fromStore.VendorStoreID, i) fromFoodList, err1 := fromApi.RetailListAll(fromStore.VendorStoreID, i)
@@ -220,10 +221,12 @@ func CopyMtToMT(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail, isA
} }
if err = BatchInitSkuMT2MT(ctx, fromFoodList, toApi, toStore.VendorStoreID, i); err != nil { if err = BatchInitSkuMT2MT(ctx, fromFoodList, toApi, toStore.VendorStoreID, i); err != nil {
globals.SugarLogger.Debugf("BatchInitData : %s", utils.Format4Output(err, false)) errs := utils.Format4Output(err, false)
errList = append(errList, errs)
} }
globals.SugarLogger.Debugf("==============i: %d len: %d", i, len(fromFoodList)) globals.SugarLogger.Debugf("==============i: %d len: %d", i, len(fromFoodList))
if len(fromFoodList) < 100 { if len(fromFoodList) < 100 {
globals.SugarLogger.Debugf("BatchInitData : %s", utils.Format4Output(errList, false))
return nil, nil return nil, nil
} }
i++ i++
@@ -309,6 +312,7 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi
if len(foodDataList)%10 != 0 { if len(foodDataList)%10 != 0 {
count += 1 count += 1
} }
globals.SugarLogger.Debugf("=====data := %s", utils.Format4Output(foodDataList, false))
for i := 0; i < count; i++ { for i := 0; i < count; i++ {
if i == count-1 { if i == count-1 {
failedFoodList, _ := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:]) failedFoodList, _ := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:])