同步返回错误格式修改

This commit is contained in:
苏尹岚
2020-01-16 15:55:03 +08:00
parent e091afd746
commit 7e1e9d9ffa

View File

@@ -5,8 +5,6 @@ import (
"sort" "sort"
"time" "time"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model"
@@ -245,11 +243,16 @@ func UnselectStoreSkuListByVendorSkuIDs(storeSkuList []*partner.StoreSkuInfo, ve
func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error, storeID, vendorID int, syncType string) (failedList []*partner.StoreSkuInfoWithErr) { func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error, storeID, vendorID int, syncType string) (failedList []*partner.StoreSkuInfoWithErr) {
if err != nil { if err != nil {
var errMsg string
if errExt, ok := err.(*utils.ErrorWithCode); ok { if errExt, ok := err.(*utils.ErrorWithCode); ok {
errMsg = errExt.ErrMsg()
} else {
errMsg = err.Error()
}
if storeSkuLists, ok := storeSkuList.([]*partner.StoreSkuInfo); ok { if storeSkuLists, ok := storeSkuList.([]*partner.StoreSkuInfo); ok {
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{ storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
StoreSkuInfo: storeSkuLists[0], StoreSkuInfo: storeSkuLists[0],
ErrMsg: errExt.ErrMsg(), ErrMsg: errMsg,
StoreID: storeID, StoreID: storeID,
VendoreID: vendorID, VendoreID: vendorID,
SyncType: syncType, SyncType: syncType,
@@ -266,7 +269,7 @@ func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error, storeID, ve
} }
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{ storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
StoreSkuInfo: storeSkuInfo, StoreSkuInfo: storeSkuInfo,
ErrMsg: errExt.ErrMsg(), ErrMsg: errMsg,
StoreID: storeID, StoreID: storeID,
VendoreID: vendorID, VendoreID: vendorID,
SyncType: syncType, SyncType: syncType,
@@ -283,7 +286,7 @@ func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error, storeID, ve
} }
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{ storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
StoreSkuInfo: storeSkuInfo, StoreSkuInfo: storeSkuInfo,
ErrMsg: errExt.ErrMsg(), ErrMsg: errMsg,
StoreID: storeID, StoreID: storeID,
VendoreID: vendorID, VendoreID: vendorID,
SyncType: syncType, SyncType: syncType,
@@ -291,17 +294,13 @@ func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error, storeID, ve
failedList = append(failedList, storeSkuInfoWithErr) failedList = append(failedList, storeSkuInfoWithErr)
} else { } else {
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{ storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
ErrMsg: errExt.ErrMsg(), ErrMsg: errMsg,
StoreID: storeID, StoreID: storeID,
VendoreID: vendorID, VendoreID: vendorID,
SyncType: syncType, SyncType: syncType,
} }
failedList = append(failedList, storeSkuInfoWithErr) failedList = append(failedList, storeSkuInfoWithErr)
} }
} else {
globals.SugarLogger.Errorf("GetErrMsg2FailedSingleList:%v", err)
// globals.SugarLogger.Debugf("GetErrMsg2FailedSingleList:%v", err)
}
} }
return failedList return failedList
} }