同步错误返回
This commit is contained in:
@@ -237,47 +237,40 @@ func UnselectStoreSkuListByVendorSkuIDs(storeSkuList []*partner.StoreSkuInfo, ve
|
||||
}
|
||||
|
||||
//美团api返回
|
||||
func SelectStoreSkuListByFoodList(storeSkuList []*partner.StoreSkuInfo, foodList []*mtwmapi.AppFoodResult) (selectedStoreSkuList []*partner.StoreSkuInfoWithErr) {
|
||||
func SelectStoreSkuListByFoodList(storeSkuList interface{}, foodList []*mtwmapi.AppFoodResult) (selectedStoreSkuList []*partner.StoreSkuInfoWithErr) {
|
||||
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 := &partner.StoreSkuInfoWithErr{
|
||||
StoreSkuInfo: v,
|
||||
ErrMsg: foodMap[v.VendorSkuID],
|
||||
if storeSkuLists, ok := storeSkuList.([]*partner.StoreSkuInfo); ok {
|
||||
for _, v := range storeSkuLists {
|
||||
if foodMap[v.VendorSkuID] != "" {
|
||||
foodFailed := &partner.StoreSkuInfoWithErr{
|
||||
StoreSkuInfo: v,
|
||||
ErrMsg: foodMap[v.VendorSkuID],
|
||||
}
|
||||
selectedStoreSkuList = append(selectedStoreSkuList, foodFailed)
|
||||
}
|
||||
selectedStoreSkuList = append(selectedStoreSkuList, foodFailed)
|
||||
}
|
||||
}
|
||||
}
|
||||
return selectedStoreSkuList
|
||||
}
|
||||
|
||||
//美团api返回
|
||||
func SelectStoreSynSkuByFoodList(storeSkuList []*dao.StoreSkuSyncInfo, foodList []*mtwmapi.AppFoodResult) (selectedStoreSkuList []*partner.StoreSkuInfoWithErr) {
|
||||
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] != "" {
|
||||
storeSkuInfo := &partner.StoreSkuInfo{
|
||||
SkuID: v.SkuID,
|
||||
VendorSkuID: v.VendorSkuID,
|
||||
NameID: v.NameID,
|
||||
VendorNameID: v.VendorNameID,
|
||||
VendorPrice: v.VendorPrice,
|
||||
Status: v.Status,
|
||||
if storeSkuLists, ok := storeSkuList.([]*dao.StoreSkuSyncInfo); ok {
|
||||
for _, v := range storeSkuLists {
|
||||
if foodMap[v.VendorSkuID] != "" {
|
||||
storeSkuInfo := &partner.StoreSkuInfo{
|
||||
SkuID: v.SkuID,
|
||||
VendorSkuID: v.VendorSkuID,
|
||||
NameID: v.NameID,
|
||||
VendorNameID: v.VendorNameID,
|
||||
VendorPrice: v.VendorPrice,
|
||||
Status: v.Status,
|
||||
}
|
||||
foodFailed := &partner.StoreSkuInfoWithErr{
|
||||
StoreSkuInfo: storeSkuInfo,
|
||||
ErrMsg: foodMap[v.VendorSkuID],
|
||||
}
|
||||
selectedStoreSkuList = append(selectedStoreSkuList, foodFailed)
|
||||
}
|
||||
foodFailed := &partner.StoreSkuInfoWithErr{
|
||||
StoreSkuInfo: storeSkuInfo,
|
||||
ErrMsg: foodMap[v.VendorSkuID],
|
||||
}
|
||||
selectedStoreSkuList = append(selectedStoreSkuList, foodFailed)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,35 +319,31 @@ func SelectStoreSkuListByResponseList(storeSkuList []*partner.StoreSkuInfo, resp
|
||||
return selectedStoreSkuList
|
||||
}
|
||||
|
||||
func GetErrMsg2FailedSingleList(storeSkuList []*partner.StoreSkuInfo, err error) (failedList []*partner.StoreSkuInfoWithErr) {
|
||||
func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error) (failedList []*partner.StoreSkuInfoWithErr) {
|
||||
if err != nil {
|
||||
if errExt, ok := err.(*utils.ErrorWithCode); ok {
|
||||
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
|
||||
StoreSkuInfo: storeSkuList[0],
|
||||
ErrMsg: errExt.ErrMsg(),
|
||||
if storeSkuLists, ok := storeSkuList.([]*partner.StoreSkuInfo); ok {
|
||||
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
|
||||
StoreSkuInfo: storeSkuLists[0],
|
||||
ErrMsg: errExt.ErrMsg(),
|
||||
}
|
||||
failedList = append(failedList, storeSkuInfoWithErr)
|
||||
}
|
||||
failedList = append(failedList, storeSkuInfoWithErr)
|
||||
}
|
||||
}
|
||||
return failedList
|
||||
}
|
||||
|
||||
func GetErrMsg2FailedSyncSingleList(storeSkuList []*dao.StoreSkuSyncInfo, err error) (failedList []*partner.StoreSkuInfoWithErr) {
|
||||
if err != nil {
|
||||
if errExt, ok := err.(*utils.ErrorWithCode); ok {
|
||||
storeSkuInfo := &partner.StoreSkuInfo{
|
||||
SkuID: storeSkuList[0].SkuID,
|
||||
VendorSkuID: storeSkuList[0].VendorSkuID,
|
||||
NameID: storeSkuList[0].NameID,
|
||||
VendorNameID: storeSkuList[0].VendorNameID,
|
||||
VendorPrice: storeSkuList[0].VendorPrice,
|
||||
Status: storeSkuList[0].Status,
|
||||
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(),
|
||||
}
|
||||
failedList = append(failedList, storeSkuInfoWithErr)
|
||||
}
|
||||
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
|
||||
StoreSkuInfo: storeSkuInfo,
|
||||
ErrMsg: errExt.ErrMsg(),
|
||||
}
|
||||
failedList = append(failedList, storeSkuInfoWithErr)
|
||||
}
|
||||
}
|
||||
return failedList
|
||||
|
||||
Reference in New Issue
Block a user