同步返回错误

This commit is contained in:
苏尹岚
2019-11-20 10:49:19 +08:00
parent 0e481ffe72
commit 82ac23ab0a
7 changed files with 115 additions and 18 deletions

View File

@@ -4,6 +4,10 @@ import (
"fmt"
"sort"
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/baseapi/utils"
@@ -230,6 +234,52 @@ func UnselectStoreSkuListByVendorSkuIDs(storeSkuList []*partner.StoreSkuInfo, ve
return selectedStoreSkuList
}
func SelectStoreSkuListByFoodList(storeID int, storeSkuList []*partner.StoreSkuInfo, foodList []*mtwmapi.AppFoodResult) (selectedStoreSkuList []*tasksch.ErrMsg) {
foodMap := make(map[string]string)
if len(foodList) > 0 {
for _, v := range foodList {
foodMap[v.AppFoodCode] = v.ErrorMsg
}
for _, v := range storeSkuList {
if foodMap[v.VendorSkuID] != "" {
foodFailed := &tasksch.ErrMsg{
SkuID: v.SkuID,
VendorSkuID: v.VendorSkuID,
StoreID: storeID,
Status: v.Status,
VendorPrice: v.VendorPrice,
Err: foodMap[v.VendorSkuID],
}
selectedStoreSkuList = append(selectedStoreSkuList, foodFailed)
}
}
}
return selectedStoreSkuList
}
func SelectStoreSkuListByOpResult(storeID int, storeSkuList []*partner.StoreSkuInfo, opResult *ebaiapi.BatchOpResult) (selectedStoreSkuList []*tasksch.ErrMsg) {
opResultMap := make(map[int64]string)
if len(opResult.FailedList) > 0 {
for _, v := range opResult.FailedList {
opResultMap[v.SkuID] = v.ErrorMsg
}
for _, v := range storeSkuList {
if opResultMap[utils.Str2Int64(v.VendorSkuID)] != "" {
opFailed := &tasksch.ErrMsg{
SkuID: v.SkuID,
VendorSkuID: v.VendorSkuID,
StoreID: storeID,
Status: v.Status,
VendorPrice: v.VendorPrice,
Err: opResultMap[utils.Str2Int64(v.VendorSkuID)],
}
selectedStoreSkuList = append(selectedStoreSkuList, opFailed)
}
}
}
return selectedStoreSkuList
}
func UnselectStoreSkuSyncListByVendorSkuIDs(storeSkuList []*dao.StoreSkuSyncInfo, vendorSkuIDs []string) (selectedStoreSkuList []*dao.StoreSkuSyncInfo) {
if len(vendorSkuIDs) > 0 {
vendorSkuIDMap := jxutils.StringList2Map(vendorSkuIDs)