From 6d677bab43055cd0ac318866b88d6d72bc7377ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 4 Dec 2019 17:34:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=94=99=E8=AF=AF=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 11 ++++++++- business/jxstore/cms/sync_store_sku.go | 2 +- business/partner/purchase/ebai/store_sku2.go | 20 +++++++-------- business/partner/purchase/jd/store_sku2.go | 10 ++++---- business/partner/purchase/mtwm/store_sku2.go | 20 +++++++++------ business/partner/putils/store_sku.go | 26 +++++++++++++++++--- 6 files changed, 61 insertions(+), 28 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 569f77b57..d15797789 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -23,9 +23,12 @@ import ( type SyncErrResult struct { SkuID int `json:"商品ID"` + StoreID int `json:"门店ID"` + VendorID int `json:"平台ID"` VendorSkuID string `json:"平台商品ID"` NameID int `json:"商品nameID"` VendorPrice int64 `json:"平台价"` + SyncType string `json:"同步类型"` ErrMsg string `json:"错误信息"` } @@ -71,9 +74,12 @@ var ( ErrEntityNotExist = errors.New("找不到相应实体") SyncErrResultTitle = []string{ "商品ID", + "门店ID", + "平台ID", "平台商品ID", "商品nameID", "平台价", + "同步类型", "错误信息", } syncErrResultLock SyncErrResultLock @@ -760,9 +766,12 @@ func WirteToExcelBySyncFailed(task tasksch.ITask, ctx *jxcontext.Context) (err e for _, vv := range v.([]*partner.StoreSkuInfoWithErr) { result := SyncErrResult{ SkuID: vv.StoreSkuInfo.SkuID, + StoreID: vv.StoreID, + VendorID: vv.VendoreID, VendorSkuID: vv.StoreSkuInfo.VendorSkuID, NameID: vv.StoreSkuInfo.NameID, VendorPrice: vv.StoreSkuInfo.VendorPrice, + SyncType: vv.SyncType, ErrMsg: vv.ErrMsg, } syncErrResultLock.AppendData(result) @@ -775,7 +784,7 @@ func WirteToExcelBySyncFailed(task tasksch.ITask, ctx *jxcontext.Context) (err e } sheetList1 = append(sheetList1, excelConf1) if excelConf1 != nil { - downloadURL1, fileName1, err = jxutils.UploadExeclAndPushMsg(sheetList1, time.Now().Format("2006-01-02")+"同步错误返回") + downloadURL1, fileName1, err = jxutils.UploadExeclAndPushMsg(sheetList1, time.Now().Format("200601021504")+"同步错误返回") baseapi.SugarLogger.Debug("WriteToExcel: download is [%v]", downloadURL1) } else { baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess is nil!") diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 4325933bb..66b986641 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -485,7 +485,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo updateList = append(updateList, calVendorPrice4StoreSku(batchedStoreSkuList[0], storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage))) err = nil } else { - failedList = append(failedList, putils.GetErrMsg2FailedSingleList(batchedStoreSkuList, err2)...) + failedList = append(failedList, putils.GetErrMsg2FailedSingleList(batchedStoreSkuList, err2, storeID, vendorID, "查询是否有该商品")...) } if len(failedList) > 0 { task.AddErrMsg(failedList) diff --git a/business/partner/purchase/ebai/store_sku2.go b/business/partner/purchase/ebai/store_sku2.go index 22cfc8386..f6e60ee80 100644 --- a/business/partner/purchase/ebai/store_sku2.go +++ b/business/partner/purchase/ebai/store_sku2.go @@ -120,7 +120,7 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v if globals.EnableEbaiStoreWrite { _, err = api.EbaiAPI.SkuUpdate(ctx.GetTrackInfo(), strStoreID, utils.Str2Int64(storeSku.VendorSkuID), params) if err != nil { - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err) + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorIDEBAI, "更新商品基础信息") } utils.CallFuncAsync(func() { api.EbaiAPI.SkuShopCategoryMap(strStoreID, utils.Str2Int64(storeSku.VendorSkuID), "", utils.Str2Int64(storeSku.VendorCatID), genSkuCatRank(storeSku)) @@ -141,7 +141,7 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v api.EbaiAPI.SkuShopCategoryMap(strStoreID, vendorSkuID, "", utils.Str2Int64(storeSku.VendorCatID), genSkuCatRank(storeSku)) }) } else { - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err) + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorIDEBAI, "创建商品") } } else { vendorSkuID = jxutils.GenFakeID() @@ -164,7 +164,7 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v opResult, err2 := api.EbaiAPI.SkuDelete(ctx.GetTrackInfo(), utils.Int2Str(storeID), partner.BareStoreSkuInfoList(storeSkuList).GetVendorSkuIDIntList(), nil) if err = err2; err2 != nil && opResult != nil { // if len(storeSkuList) > len(opResult.FailedList) { - failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult) + failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult, storeID, model.VendorIDEBAI, "删除商品") // successList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getFailedVendorSkuIDsFromOpResult(opResult)) // } } @@ -181,7 +181,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID opResult, err = api.EbaiAPI.SkuOnline(ctx.GetTrackInfo(), utils.Int2Str(storeID), vendorSkuIDs, nil, nil) } else if len(vendorSkuIDs) == 1 { err = api.EbaiAPI.SkuOnlineOne(ctx.GetTrackInfo(), utils.Int2Str(storeID), vendorSkuIDs[0], "", "") - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err) + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorIDEBAI, "更新商品状态") return failedList, err } } else { @@ -189,12 +189,12 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID opResult, err = api.EbaiAPI.SkuOffline(ctx.GetTrackInfo(), utils.Int2Str(storeID), vendorSkuIDs, nil, nil) } else if len(vendorSkuIDs) == 1 { err = api.EbaiAPI.SkuOfflineOne(ctx.GetTrackInfo(), utils.Int2Str(storeID), vendorSkuIDs[0], "", "") - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err) + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorIDEBAI, "更新商品状态") return failedList, err } } if err != nil && opResult != nil { - failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult) + failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult, storeID, model.VendorIDEBAI, "更新商品状态") // failedList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getFailedVendorSkuIDsFromOpResult(opResult)) } } @@ -219,12 +219,12 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID i if len(storeSkuList) > 1 { opResult, err2 := api.EbaiAPI.SkuPriceUpdateBatch(ctx.GetTrackInfo(), utils.Int2Str(storeID), StoreSkuInfoList2Ebai(storeSkuList), ebaiapi.SkuIDTypeSkuID) if err = err2; err != nil && opResult != nil { - failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult) + failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult, storeID, model.VendorIDEBAI, "更新商品价格") } } else if len(storeSkuList) == 1 { opResult2, err := api.EbaiAPI.SkuPriceUpdateOne(ctx.GetTrackInfo(), utils.Int2Str(storeID), StoreSkuInfoList2Ebai(storeSkuList)[0]) if err != nil && opResult2 != nil { - failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult2) + failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult2, storeID, model.VendorIDEBAI, "更新商品价格") } } } @@ -236,12 +236,12 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, storeID i if len(storeSkuList) > 1 { opResult, err2 := api.EbaiAPI.SkuStockUpdateBatch(ctx.GetTrackInfo(), utils.Int2Str(storeID), StoreSkuInfoList2Ebai(storeSkuList), ebaiapi.SkuIDTypeSkuID) if err = err2; err != nil && opResult != nil { - failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult) + failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult, storeID, model.VendorIDEBAI, "更新商品库存") // successList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getFailedVendorSkuIDsFromOpResult(opResult)) } } else if len(storeSkuList) == 1 { err = api.EbaiAPI.SkuStockUpdateOne(ctx.GetTrackInfo(), utils.Int2Str(storeID), StoreSkuInfoList2Ebai(storeSkuList)[0]) - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err) + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorIDEBAI, "更新商品库存") } } return failedList, err diff --git a/business/partner/purchase/jd/store_sku2.go b/business/partner/purchase/jd/store_sku2.go index 2c092b000..ef9fd0c32 100644 --- a/business/partner/purchase/jd/store_sku2.go +++ b/business/partner/purchase/jd/store_sku2.go @@ -122,7 +122,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID if globals.EnableJdStoreWrite { responseList, err2 := getAPI("").BatchUpdateVendibility(ctx.GetTrackInfo(), "", vendorStoreID, skuVendibilityList, ctx.GetUserName()) if err = err2; isErrPartialFailed(err) { - failedList = putils.SelectStoreSkuListByResponseList(storeSkuList, responseList) + failedList = putils.SelectStoreSkuListByResponseList(storeSkuList, responseList, storeID, model.VendorIDJD, "更新商品状态") // successList = putils.UnselectStoreSkuListBySkuIDs(storeSkuList, utils.StringSlice2Int(getStrOutSkuIDs(responseList, false))) } } @@ -133,7 +133,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID i if len(storeSkuList) == 1 { if globals.EnableJdStoreWrite { _, err = getAPI("").UpdateStationPrice(ctx.GetTrackInfo(), utils.Str2Int64WithDefault(storeSkuList[0].VendorSkuID, 0), vendorStoreID, int(storeSkuList[0].VendorPrice)) - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err) + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorIDJD, "更新商品价格") } } else { var skuPriceInfoList []*jdapi.SkuPriceInfo @@ -146,7 +146,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID i if globals.EnableJdStoreWrite { responseList, err2 := getAPI("").UpdateVendorStationPrice(ctx.GetTrackInfo(), "", vendorStoreID, skuPriceInfoList) if err = err2; isErrPartialFailed(err) { - failedList = putils.SelectStoreSkuListByResponseList(storeSkuList, responseList) + failedList = putils.SelectStoreSkuListByResponseList(storeSkuList, responseList, storeID, model.VendorIDJD, "更新商品价格") } } } @@ -157,7 +157,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, storeID i if len(storeSkuList) == 1 { if globals.EnableJdStoreWrite { err = getAPI("").UpdateCurrentQty(ctx.GetTrackInfo(), vendorStoreID, utils.Str2Int64WithDefault(storeSkuList[0].VendorSkuID, 0), storeSkuList[0].Stock) - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err) + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorIDJD, "更新商品库存") } } else { var skuStockList []*jdapi.SkuStock @@ -170,7 +170,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, storeID i if globals.EnableJdStoreWrite { responseList, err2 := getAPI("").BatchUpdateCurrentQtys(ctx.GetTrackInfo(), "", vendorStoreID, skuStockList, ctx.GetUserName()) if err = err2; isErrPartialFailed(err) { - failedList = putils.SelectStoreSkuListByResponseList(storeSkuList, responseList) + failedList = putils.SelectStoreSkuListByResponseList(storeSkuList, responseList, storeID, model.VendorIDJD, "更新商品库存") // successList = putils.UnselectStoreSkuListBySkuIDs(storeSkuList, utils.StringSlice2Int(getStrOutSkuIDs(responseList, false))) } } diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 479b187a9..97d5e98ea 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -234,7 +234,13 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v // 对于多门店平台来说,storeSkuList中只有SkuID与VendorSkuID有意义 func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo, isCreate bool) (failedList []*partner.StoreSkuInfoWithErr, err error) { + var syncType string foodDataList := make([]map[string]interface{}, len(storeSkuList)) + if isCreate { + syncType = "创建商品" + } else { + syncType = "更新商品" + } for i, storeSku := range storeSkuList { isNeedUpdatePrice := isCreate //storeSku.StoreSkuSyncStatus&( model.SyncFlagPriceMask| model.SyncFlagNewMask) != 0 foodData := make(map[string]interface{}) @@ -294,12 +300,12 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI if len(foodDataList) == 1 { foodDataList[0]["skus"] = string(utils.MustMarshal(foodDataList[0]["skus"])) err = api.MtwmAPI.RetailInitData(ctx.GetTrackInfo(), vendorStoreID, utils.Int2Str(storeSkuList[0].SkuID), foodDataList[0]) - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err) + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorIDMTWM, syncType) } else if len(foodDataList) > 0 { failedFoodList, err2 := api.MtwmAPI.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList) if err = err2; err == nil { if err = putils.GenPartialFailedErr(failedFoodList, len(failedFoodList)); err != nil { - failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, failedFoodList) + failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, failedFoodList, storeID, model.VendorIDMTWM, syncType) // successList = putils.UnselectStoreSkuSyncListByVendorSkuIDs(storeSkuList, getAppFoodCodeList(failedFoodList)) } } @@ -325,7 +331,7 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v if globals.EnableMtwmStoreWrite { if len(storeSkuList) == 1 { err = api.MtwmAPI.RetailDelete(ctx.GetTrackInfo(), vendorStoreID, storeSkuList[0].VendorSkuID) - failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err) + failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorIDMTWM, "删除商品") } else { // todo 部分失败 err = api.MtwmAPI.RetailCatSkuBatchDelete2(ctx.GetTrackInfo(), vendorStoreID, nil, nil, nil, nil, partner.BareStoreSkuInfoList(storeSkuList).GetVendorSkuIDList()) @@ -333,7 +339,7 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v if errExt, ok := err.(*utils.ErrorWithCode); ok { myMap := make(map[string][]*mtwmapi.AppFoodResult) json.Unmarshal([]byte(errExt.ErrMsg()), &myMap) - failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, myMap["retail_error_list"]) + failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, myMap["retail_error_list"], storeID, model.VendorIDMTWM, "批量删除商品") } } } @@ -374,7 +380,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID failedFoodList, err2 := api.MtwmAPI.RetailSellStatus(ctx.GetTrackInfo(), vendorStoreID, skuList, mtwmStatus) if err = err2; err == nil { if len(failedFoodList) > 0 { - failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, failedFoodList) + failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, failedFoodList, storeID, model.VendorIDMTWM, "更新商品状态") // successList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getAppFoodCodeList(failedFoodList)) } } @@ -388,7 +394,7 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID i failedFoodList, err2 := api.MtwmAPI.RetailSkuPrice(ctx.GetTrackInfo(), vendorStoreID, priceList) if err = err2; err == nil { if len(failedFoodList) > 0 { - failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, failedFoodList) + failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, failedFoodList, storeID, model.VendorIDMTWM, "更新商品价格") } } } @@ -401,7 +407,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, storeID i failedFoodList, err2 := api.MtwmAPI.RetailSkuStock(ctx.GetTrackInfo(), vendorStoreID, stockList) if err = err2; err == nil { if len(failedFoodList) > 0 { - failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, failedFoodList) + failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, failedFoodList, storeID, model.VendorIDMTWM, "更新商品库存") } // if err = putils.GenPartialFailedErr(failedFoodList, len(failedFoodList)); err != nil { // successList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getAppFoodCodeList(failedFoodList)) diff --git a/business/partner/putils/store_sku.go b/business/partner/putils/store_sku.go index c974c32d8..ec57c16c3 100644 --- a/business/partner/putils/store_sku.go +++ b/business/partner/putils/store_sku.go @@ -237,7 +237,7 @@ func UnselectStoreSkuListByVendorSkuIDs(storeSkuList []*partner.StoreSkuInfo, ve } //美团api返回 -func SelectStoreSkuListByFoodList(storeSkuList interface{}, foodList []*mtwmapi.AppFoodResult) (selectedStoreSkuList []*partner.StoreSkuInfoWithErr) { +func SelectStoreSkuListByFoodList(storeSkuList interface{}, foodList []*mtwmapi.AppFoodResult, storeID, vendorID int, syncType string) (selectedStoreSkuList []*partner.StoreSkuInfoWithErr) { foodMap := make(map[string]string) if len(foodList) > 0 { for _, v := range foodList { @@ -249,6 +249,9 @@ func SelectStoreSkuListByFoodList(storeSkuList interface{}, foodList []*mtwmapi. foodFailed := &partner.StoreSkuInfoWithErr{ StoreSkuInfo: v, ErrMsg: foodMap[v.VendorSkuID], + StoreID: storeID, + VendoreID: vendorID, + SyncType: syncType, } selectedStoreSkuList = append(selectedStoreSkuList, foodFailed) } @@ -268,6 +271,9 @@ func SelectStoreSkuListByFoodList(storeSkuList interface{}, foodList []*mtwmapi. foodFailed := &partner.StoreSkuInfoWithErr{ StoreSkuInfo: storeSkuInfo, ErrMsg: foodMap[v.VendorSkuID], + StoreID: storeID, + VendoreID: vendorID, + SyncType: syncType, } selectedStoreSkuList = append(selectedStoreSkuList, foodFailed) } @@ -278,7 +284,7 @@ func SelectStoreSkuListByFoodList(storeSkuList interface{}, foodList []*mtwmapi. } //饿百api返回 -func SelectStoreSkuListByOpResult(storeSkuList []*partner.StoreSkuInfo, opResult *ebaiapi.BatchOpResult) (selectedStoreSkuList []*partner.StoreSkuInfoWithErr) { +func SelectStoreSkuListByOpResult(storeSkuList []*partner.StoreSkuInfo, opResult *ebaiapi.BatchOpResult, storeID, vendorID int, syncType string) (selectedStoreSkuList []*partner.StoreSkuInfoWithErr) { opResultMap := make(map[int64]string) if len(opResult.FailedList) > 0 { for _, v := range opResult.FailedList { @@ -289,6 +295,9 @@ func SelectStoreSkuListByOpResult(storeSkuList []*partner.StoreSkuInfo, opResult opFailed := &partner.StoreSkuInfoWithErr{ StoreSkuInfo: v, ErrMsg: opResultMap[utils.Str2Int64(v.VendorSkuID)], + StoreID: storeID, + VendoreID: vendorID, + SyncType: syncType, } selectedStoreSkuList = append(selectedStoreSkuList, opFailed) } @@ -298,7 +307,7 @@ func SelectStoreSkuListByOpResult(storeSkuList []*partner.StoreSkuInfo, opResult } //京东api返回 -func SelectStoreSkuListByResponseList(storeSkuList []*partner.StoreSkuInfo, responseList []*jdapi.StoreSkuBatchUpdateResponse) (selectedStoreSkuList []*partner.StoreSkuInfoWithErr) { +func SelectStoreSkuListByResponseList(storeSkuList []*partner.StoreSkuInfo, responseList []*jdapi.StoreSkuBatchUpdateResponse, storeID, vendorID int, syncType string) (selectedStoreSkuList []*partner.StoreSkuInfoWithErr) { responseMap := make(map[string]string) if len(responseList) > 0 { for _, v := range responseList { @@ -311,6 +320,9 @@ func SelectStoreSkuListByResponseList(storeSkuList []*partner.StoreSkuInfo, resp respFailed := &partner.StoreSkuInfoWithErr{ StoreSkuInfo: v, ErrMsg: responseMap[utils.Int2Str(v.SkuID)], + StoreID: storeID, + VendoreID: vendorID, + SyncType: syncType, } selectedStoreSkuList = append(selectedStoreSkuList, respFailed) } @@ -319,13 +331,16 @@ func SelectStoreSkuListByResponseList(storeSkuList []*partner.StoreSkuInfo, resp return selectedStoreSkuList } -func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error) (failedList []*partner.StoreSkuInfoWithErr) { +func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error, storeID, vendorID int, syncType string) (failedList []*partner.StoreSkuInfoWithErr) { if err != nil { if errExt, ok := err.(*utils.ErrorWithCode); ok { if storeSkuLists, ok := storeSkuList.([]*partner.StoreSkuInfo); ok { storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{ StoreSkuInfo: storeSkuLists[0], ErrMsg: errExt.ErrMsg(), + StoreID: storeID, + VendoreID: vendorID, + SyncType: syncType, } failedList = append(failedList, storeSkuInfoWithErr) } @@ -341,6 +356,9 @@ func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error) (failedList storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{ StoreSkuInfo: storeSkuInfo, ErrMsg: errExt.ErrMsg(), + StoreID: storeID, + VendoreID: vendorID, + SyncType: syncType, } failedList = append(failedList, storeSkuInfoWithErr) }