1
This commit is contained in:
@@ -3,6 +3,8 @@ package cms
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
beego "github.com/astaxie/beego/server/web"
|
||||
"time"
|
||||
@@ -88,7 +90,7 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
|
||||
return nil, fmt.Errorf("fromFoodList 为空 %s ,i:= %d", utils.Format4Output(err1, false), i)
|
||||
}
|
||||
|
||||
if err := BatchInitData(ctx, fromFoodList, toApi, toStore.VendorStoreID); err != nil {
|
||||
if err := BatchInitData(ctx, fromFoodList, toApi, toStore.VendorStoreID, i); err != nil {
|
||||
globals.SugarLogger.Debugf("BatchInitData : %s", utils.Format4Output(err, false))
|
||||
}
|
||||
if len(fromFoodList) < 100 {
|
||||
@@ -162,7 +164,7 @@ type Skus struct {
|
||||
}
|
||||
|
||||
// BatchInitData 批量创建商品
|
||||
func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mtwmapi.API, vendorStoreID string) error {
|
||||
func BatchInitData(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 {
|
||||
foodData := make(map[string]interface{})
|
||||
@@ -242,17 +244,21 @@ func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mt
|
||||
if i == count-1 {
|
||||
failedFoodList, err2 := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:])
|
||||
if err2 != nil {
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err3 :%s", utils.Format4Output(err2, false))
|
||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "6D18CF27A09511ED8127525400E86DC0", "门店商品同步异常", fmt.Sprintf("%d : %v", i, err2))
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err3 :%v", err2)
|
||||
}
|
||||
if len(failedFoodList) != 0 {
|
||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "6D18CF27A09511ED8127525400E86DC0", "门店商品同步异常", fmt.Sprintf("%d : %s", i, utils.Format4Output(failedFoodList, false)))
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err4 :%s", utils.Format4Output(failedFoodList, false))
|
||||
}
|
||||
} else {
|
||||
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))
|
||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "6D18CF27A09511ED8127525400E86DC0", "门店商品同步异常", fmt.Sprintf("%d : %v", i, err2))
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err3 :%v", err2)
|
||||
}
|
||||
if len(failedFoodList) != 0 {
|
||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "6D18CF27A09511ED8127525400E86DC0", "门店商品同步异常", fmt.Sprintf("%d : %s", i, utils.Format4Output(failedFoodList, false)))
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err4 :%s", utils.Format4Output(failedFoodList, false))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user