同步返回错误格式修改

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"
"time"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/model"
@@ -245,62 +243,63 @@ func UnselectStoreSkuListByVendorSkuIDs(storeSkuList []*partner.StoreSkuInfo, ve
func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error, storeID, vendorID int, syncType string) (failedList []*partner.StoreSkuInfoWithErr) {
if err != nil {
var errMsg string
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)
} else if storeSkuLists, ok := storeSkuList.([]*dao.StoreSkuSyncInfo); ok {
storeSkuInfo := &partner.StoreSkuInfo{
SkuID: storeSkuLists[0].SkuID,
VendorSkuID: storeSkuLists[0].VendorSkuID,
NameID: storeSkuLists[0].NameID,
VendorNameID: storeSkuLists[0].VendorNameID,
VendorPrice: storeSkuLists[0].VendorPrice,
Status: storeSkuLists[0].Status,
}
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
StoreSkuInfo: storeSkuInfo,
ErrMsg: errExt.ErrMsg(),
StoreID: storeID,
VendoreID: vendorID,
SyncType: syncType,
}
failedList = append(failedList, storeSkuInfoWithErr)
} else if storeSku, ok := storeSkuList.(*dao.StoreSkuSyncInfo); ok {
storeSkuInfo := &partner.StoreSkuInfo{
SkuID: storeSku.SkuID,
VendorSkuID: storeSku.VendorSkuID,
NameID: storeSku.NameID,
VendorNameID: storeSku.VendorNameID,
VendorPrice: storeSku.VendorPrice,
Status: storeSku.Status,
}
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
StoreSkuInfo: storeSkuInfo,
ErrMsg: errExt.ErrMsg(),
StoreID: storeID,
VendoreID: vendorID,
SyncType: syncType,
}
failedList = append(failedList, storeSkuInfoWithErr)
} else {
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
ErrMsg: errExt.ErrMsg(),
StoreID: storeID,
VendoreID: vendorID,
SyncType: syncType,
}
failedList = append(failedList, storeSkuInfoWithErr)
}
errMsg = errExt.ErrMsg()
} else {
globals.SugarLogger.Errorf("GetErrMsg2FailedSingleList:%v", err)
// globals.SugarLogger.Debugf("GetErrMsg2FailedSingleList:%v", err)
errMsg = err.Error()
}
if storeSkuLists, ok := storeSkuList.([]*partner.StoreSkuInfo); ok {
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
StoreSkuInfo: storeSkuLists[0],
ErrMsg: errMsg,
StoreID: storeID,
VendoreID: vendorID,
SyncType: syncType,
}
failedList = append(failedList, storeSkuInfoWithErr)
} else if storeSkuLists, ok := storeSkuList.([]*dao.StoreSkuSyncInfo); ok {
storeSkuInfo := &partner.StoreSkuInfo{
SkuID: storeSkuLists[0].SkuID,
VendorSkuID: storeSkuLists[0].VendorSkuID,
NameID: storeSkuLists[0].NameID,
VendorNameID: storeSkuLists[0].VendorNameID,
VendorPrice: storeSkuLists[0].VendorPrice,
Status: storeSkuLists[0].Status,
}
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
StoreSkuInfo: storeSkuInfo,
ErrMsg: errMsg,
StoreID: storeID,
VendoreID: vendorID,
SyncType: syncType,
}
failedList = append(failedList, storeSkuInfoWithErr)
} else if storeSku, ok := storeSkuList.(*dao.StoreSkuSyncInfo); ok {
storeSkuInfo := &partner.StoreSkuInfo{
SkuID: storeSku.SkuID,
VendorSkuID: storeSku.VendorSkuID,
NameID: storeSku.NameID,
VendorNameID: storeSku.VendorNameID,
VendorPrice: storeSku.VendorPrice,
Status: storeSku.Status,
}
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
StoreSkuInfo: storeSkuInfo,
ErrMsg: errMsg,
StoreID: storeID,
VendoreID: vendorID,
SyncType: syncType,
}
failedList = append(failedList, storeSkuInfoWithErr)
} else {
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
ErrMsg: errMsg,
StoreID: storeID,
VendoreID: vendorID,
SyncType: syncType,
}
failedList = append(failedList, storeSkuInfoWithErr)
}
}
return failedList