This commit is contained in:
邹宗楠
2024-04-03 17:46:23 +08:00
parent 81a15c6f0e
commit 967459e2ce

View File

@@ -934,12 +934,13 @@ func UpdateBoxPrice(ctx *jxcontext.Context, db *dao.DaoDB, list []int) error {
}, },
}) })
} }
count := utils.Float64TwoInt(math.Ceil(float64(len(foodDataList)) / float64(200)))
count := utils.Float64TwoInt(math.Ceil(float64(len(foodDataList)) / float64(100)))
api := getAPI(storeDetail.VendorOrgCode, v, storeDetail.VendorStoreID) api := getAPI(storeDetail.VendorOrgCode, v, storeDetail.VendorStoreID)
for i := 1; i <= count; i++ { for i := 1; i <= count; i++ {
api.SetToken(storeDetail.MtwmToken) api.SetToken(storeDetail.MtwmToken)
if i == count { if i == count {
result, err := api.RetailBatchInitData(ctx.GetTrackInfo(), storeDetail.VendorStoreID, foodDataList[(i-1)*200:]) result, err := api.RetailBatchInitData(ctx.GetTrackInfo(), storeDetail.VendorStoreID, foodDataList[(i-1)*100:])
if err != nil { if err != nil {
globals.SugarLogger.Debugf("RetailBatchInitData1 err := %v", err) globals.SugarLogger.Debugf("RetailBatchInitData1 err := %v", err)
} }
@@ -947,7 +948,7 @@ func UpdateBoxPrice(ctx *jxcontext.Context, db *dao.DaoDB, list []int) error {
globals.SugarLogger.Debugf("RetailBatchInitData1 result := %s", utils.Format4Output(result, false)) globals.SugarLogger.Debugf("RetailBatchInitData1 result := %s", utils.Format4Output(result, false))
} }
} else { } else {
result, err := api.RetailBatchInitData(ctx.GetTrackInfo(), storeDetail.VendorStoreID, foodDataList[(i-1)*200:i*200]) result, err := api.RetailBatchInitData(ctx.GetTrackInfo(), storeDetail.VendorStoreID, foodDataList[(i-1)*100:i*100])
if err != nil { if err != nil {
globals.SugarLogger.Debugf("RetailBatchInitData2 err := %v", err) globals.SugarLogger.Debugf("RetailBatchInitData2 err := %v", err)
} }