1
This commit is contained in:
@@ -220,51 +220,16 @@ func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mt
|
||||
break
|
||||
}
|
||||
foodDataList[i] = foodData
|
||||
|
||||
////foodData["skus"] = storeSku.Skus
|
||||
//skusString, err := json.Marshal(skus2)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//foodData["skus"] = string(skusString)
|
||||
//
|
||||
//foodData["name"] = utils.LimitUTF8StringLen(storeSku.Name, mtwmapi.MaxSkuNameCharCount)
|
||||
//foodData["description"] = storeSku.Description
|
||||
//foodData["price"] = storeSku.Price
|
||||
//if storeSku.MinOrderCount != 0 {
|
||||
// foodData["min_order_count"] = storeSku.MinOrderCount
|
||||
//} else {
|
||||
// foodData["min_order_count"] = 1
|
||||
//}
|
||||
//foodData["unit"] = storeSku.Unit
|
||||
//attr := mtwm.SwitchAttr(toApi, vendorStoreID, int64(storeSku.TagID), 0, storeSku.Name)
|
||||
//if attr != "" {
|
||||
// foodData["common_attr_value"] = attr
|
||||
//}
|
||||
//if storeSku.CategoryCode != "" {
|
||||
// foodData["category_code"] = storeSku.CategoryCode
|
||||
//} else {
|
||||
// foodData["category_name"] = storeSku.CategoryName
|
||||
//}
|
||||
//
|
||||
//foodData["is_sold_out"] = storeSku.IsSoldOut
|
||||
//foodData["picture"] = storeSku.Picture
|
||||
//foodData["picture_contents"] = storeSku.PictureContents
|
||||
//foodData["sequence"] = storeSku.Sequence
|
||||
//foodData["tag_id"] = storeSku.TagID
|
||||
//foodData["tag_id"] = storeSku.TagID
|
||||
//foodDataList[i] = foodData
|
||||
}
|
||||
|
||||
count := len(foodDataList) / 5
|
||||
if len(foodDataList)%5 != 0 {
|
||||
count := len(foodDataList) / 10
|
||||
if len(foodDataList)%10 != 0 {
|
||||
count += 1
|
||||
}
|
||||
globals.SugarLogger.Debugf("===========[count] %d", count)
|
||||
for i := 0; i < count; i++ {
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
if i == count-1 {
|
||||
failedFoodList, err2 := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*5:])
|
||||
failedFoodList, err2 := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:])
|
||||
if err2 != nil {
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err3 :%s", utils.Format4Output(err2, false))
|
||||
}
|
||||
@@ -272,7 +237,7 @@ func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mt
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err4 :%s", utils.Format4Output(failedFoodList, false))
|
||||
}
|
||||
} else {
|
||||
failedFoodList, err2 := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*5:(i+1)*5])
|
||||
failedFoodList, err2 := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:(i+1)*10])
|
||||
if err2 != nil {
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err3 :%s", utils.Format4Output(err2, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user