同步错误返回
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)] != "" {
|
||||
|
||||
Reference in New Issue
Block a user