From 4400cd293a6f5c453c81f84fb08a614d3e9d1ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 18 Oct 2023 15:24:13 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/system_store_sku.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/system_store_sku.go b/business/jxstore/cms/system_store_sku.go index aee3dfe08..674c1af18 100644 --- a/business/jxstore/cms/system_store_sku.go +++ b/business/jxstore/cms/system_store_sku.go @@ -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)) } }