同步错误返回
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mtwm
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -319,16 +320,24 @@ func getAppFoodCodeList(l []*mtwmapi.AppFoodResult) (vendorSkuIDs []string) {
|
||||
return vendorSkuIDs
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (successList []*partner.StoreSkuInfo, err error) {
|
||||
func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableMtwmStoreWrite {
|
||||
if len(storeSkuList) == 1 {
|
||||
err = api.MtwmAPI.RetailDelete(ctx.GetTrackInfo(), vendorStoreID, storeSkuList[0].VendorSkuID)
|
||||
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err)
|
||||
} else {
|
||||
// todo 部分失败
|
||||
err = api.MtwmAPI.RetailCatSkuBatchDelete2(ctx.GetTrackInfo(), vendorStoreID, nil, nil, nil, nil, partner.BareStoreSkuInfoList(storeSkuList).GetVendorSkuIDList())
|
||||
if err != nil {
|
||||
if errExt, ok := err.(*utils.ErrorWithCode); ok {
|
||||
myMap := make(map[string][]*mtwmapi.AppFoodResult)
|
||||
json.Unmarshal([]byte(errExt.ErrMsg()), &myMap)
|
||||
failedList = putils.SelectStoreSkuListByFoodList(storeSkuList, myMap["retail_error_list"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
func stockCount2Mtwm(stock int) (mtwmStock string) {
|
||||
|
||||
Reference in New Issue
Block a user