错误返回
This commit is contained in:
@@ -166,7 +166,7 @@ func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, v
|
||||
return successList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo, status int) (successList []*partner.StoreSkuInfo, err error) {
|
||||
func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo, status int) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
vendorSkuIDs := partner.BareStoreSkuInfoList(storeSkuList).GetVendorSkuIDIntList()
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
var opResult *ebaiapi.BatchOpResult
|
||||
@@ -175,19 +175,24 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, storeID
|
||||
opResult, err = api.EbaiAPI.SkuOnline(ctx.GetTrackInfo(), utils.Int2Str(storeID), vendorSkuIDs, nil, nil)
|
||||
} else if len(vendorSkuIDs) == 1 {
|
||||
err = api.EbaiAPI.SkuOnlineOne(ctx.GetTrackInfo(), utils.Int2Str(storeID), vendorSkuIDs[0], "", "")
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err)
|
||||
return failedList, err
|
||||
}
|
||||
} else {
|
||||
if len(vendorSkuIDs) > 1 {
|
||||
opResult, err = api.EbaiAPI.SkuOffline(ctx.GetTrackInfo(), utils.Int2Str(storeID), vendorSkuIDs, nil, nil)
|
||||
} else if len(vendorSkuIDs) == 1 {
|
||||
err = api.EbaiAPI.SkuOfflineOne(ctx.GetTrackInfo(), utils.Int2Str(storeID), vendorSkuIDs[0], "", "")
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err)
|
||||
return failedList, err
|
||||
}
|
||||
}
|
||||
if err != nil && opResult != nil {
|
||||
successList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getFailedVendorSkuIDsFromOpResult(opResult))
|
||||
failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult)
|
||||
// failedList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getFailedVendorSkuIDsFromOpResult(opResult))
|
||||
}
|
||||
}
|
||||
return successList, err
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
func StoreSkuInfoList2Ebai(storeSkuList []*partner.StoreSkuInfo) (outList ebaiapi.ShopSkuInfoList) {
|
||||
@@ -203,7 +208,7 @@ func StoreSkuInfoList2Ebai(storeSkuList []*partner.StoreSkuInfo) (outList ebaiap
|
||||
return outList
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*tasksch.ErrMsg, err error) {
|
||||
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
if len(storeSkuList) > 1 {
|
||||
opResult, err2 := api.EbaiAPI.SkuPriceUpdateBatch(ctx.GetTrackInfo(), utils.Int2Str(storeID), StoreSkuInfoList2Ebai(storeSkuList), ebaiapi.SkuIDTypeSkuID)
|
||||
@@ -211,24 +216,29 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, storeID i
|
||||
failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult)
|
||||
}
|
||||
} else if len(storeSkuList) == 1 {
|
||||
_, err = api.EbaiAPI.SkuPriceUpdateOne(ctx.GetTrackInfo(), utils.Int2Str(storeID), StoreSkuInfoList2Ebai(storeSkuList)[0])
|
||||
opResult2, err := api.EbaiAPI.SkuPriceUpdateOne(ctx.GetTrackInfo(), utils.Int2Str(storeID), StoreSkuInfoList2Ebai(storeSkuList)[0])
|
||||
if err != nil && opResult2 != nil {
|
||||
failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult2)
|
||||
}
|
||||
}
|
||||
}
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (successList []*partner.StoreSkuInfo, err error) {
|
||||
func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
if len(storeSkuList) > 1 {
|
||||
opResult, err2 := api.EbaiAPI.SkuStockUpdateBatch(ctx.GetTrackInfo(), utils.Int2Str(storeID), StoreSkuInfoList2Ebai(storeSkuList), ebaiapi.SkuIDTypeSkuID)
|
||||
if err = err2; err != nil && opResult != nil {
|
||||
successList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getFailedVendorSkuIDsFromOpResult(opResult))
|
||||
failedList = putils.SelectStoreSkuListByOpResult(storeSkuList, opResult)
|
||||
// successList = putils.UnselectStoreSkuListByVendorSkuIDs(storeSkuList, getFailedVendorSkuIDsFromOpResult(opResult))
|
||||
}
|
||||
} else if len(storeSkuList) == 1 {
|
||||
err = api.EbaiAPI.SkuStockUpdateOne(ctx.GetTrackInfo(), utils.Int2Str(storeID), StoreSkuInfoList2Ebai(storeSkuList)[0])
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err)
|
||||
}
|
||||
}
|
||||
return successList, err
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate bool) (params map[string]interface{}) {
|
||||
|
||||
Reference in New Issue
Block a user