From 7e1e9d9ffa33c3d5012fdc343c9d41e3af026237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 16 Jan 2020 15:55:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=BF=94=E5=9B=9E=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/putils/store_sku.go | 111 +++++++++++++-------------- 1 file changed, 55 insertions(+), 56 deletions(-) diff --git a/business/partner/putils/store_sku.go b/business/partner/putils/store_sku.go index 30d7231cf..7a085a977 100644 --- a/business/partner/putils/store_sku.go +++ b/business/partner/putils/store_sku.go @@ -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