From 4c4ed40c244f44cd2efba2d07c2292be0c94039b 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 10:32:43 +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_store_sku.go | 8 +++++--- business/partner/purchase/ebai/store_sku2.go | 8 ++++---- business/partner/purchase/mtwm/store_sku2.go | 1 + business/partner/putils/store_sku.go | 4 +++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index 10da225c4..887d5de19 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -472,9 +472,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo _, err = putils.FreeBatchStoreSkuSyncInfo("创建门店商品", func(task tasksch.ITask, batchedStoreSkuList []*dao.StoreSkuSyncInfo) (result interface{}, successCount int, err error) { var failedList []*partner.StoreSkuInfoWithErr failedList, err = singleStoreHandler.CreateStoreSkus(ctx, storeID, vendorStoreID, batchedStoreSkuList) - if len(failedList) > 0 { - task.AddErrMsg(failedList) - } singleStoreHandler.IsErrSkuExist(err) if skuNameList, err2 := singleStoreHandler.GetStoreSkusFullInfo(ctx, task, storeID, vendorStoreID, []*partner.StoreSkuInfo{ &partner.StoreSkuInfo{ @@ -487,6 +484,11 @@ 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.GetErrMsg2FailedSyncSingleList(batchedStoreSkuList, err2)) + } + if len(failedList) > 0 { + task.AddErrMsg(failedList) } if err != nil { //handle error for sensitive words, if find, then insert to table sensitive_words diff --git a/business/partner/purchase/ebai/store_sku2.go b/business/partner/purchase/ebai/store_sku2.go index 9c76089b9..878b0bc9b 100644 --- a/business/partner/purchase/ebai/store_sku2.go +++ b/business/partner/purchase/ebai/store_sku2.go @@ -163,10 +163,10 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v if globals.EnableEbaiStoreWrite { 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) - // successList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getFailedVendorSkuIDsFromOpResult(opResult)) - } + // if len(storeSkuList) > len(opResult.FailedList) { + failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult) + // successList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getFailedVendorSkuIDsFromOpResult(opResult)) + // } } } return failedList, err diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 7a275f917..8015cc255 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -294,6 +294,7 @@ 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.GetErrMsg2FailedSyncSingleList(storeSkuList, err) } else if len(foodDataList) > 0 { failedFoodList, err2 := api.MtwmAPI.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList) if err = err2; err == nil { diff --git a/business/partner/putils/store_sku.go b/business/partner/putils/store_sku.go index 735f3bf89..daef26e6f 100644 --- a/business/partner/putils/store_sku.go +++ b/business/partner/putils/store_sku.go @@ -309,7 +309,9 @@ func SelectStoreSkuListByResponseList(storeSkuList []*partner.StoreSkuInfo, resp responseMap := make(map[string]string) if len(responseList) > 0 { for _, v := range responseList { - responseMap[v.OutSkuID] = v.Msg + if v.Code != "0" { + responseMap[v.OutSkuID] = v.Msg + } } for _, v := range storeSkuList { if responseMap[utils.Int2Str(v.SkuID)] != "" {