修改bug

This commit is contained in:
邹宗楠
2022-03-15 11:46:51 +08:00
parent 39a3a636db
commit eaca4b3275
10 changed files with 107 additions and 60 deletions

View File

@@ -6,32 +6,55 @@ import (
"git.rosy.net.cn/jx-callback/business/model"
)
func OnCallbackMsg(msg *mtwmapi.CallbackMsg) (response *mtwmapi.CallbackResponse) {
if CurPurchaseHandler != nil {
if msg.Cmd == mtwmapi.MsgTypeStoreStatusChanged || msg.Cmd == mtwmapi.MsgTypeStoreAuditStatusChanged {
response = CurPurchaseHandler.onStoreStatusChanged(msg)
} else if msg.Cmd == mtwmapi.MsgTypePrivateNumberDowngrade {
response = CurPurchaseHandler.onNumberDowngrade(msg)
} else if msg.Cmd == mtwmapi.MsgTypeStoreBind {
//
//if msg.Cmd == mtwmapi.MsgTypeStoreStatusChanged || msg.Cmd == mtwmapi.MsgTypeStoreAuditStatusChanged {
//response = CurPurchaseHandler.onStoreStatusChanged(msg)
//} else if msg.Cmd == mtwmapi.MsgTypePrivateNumberDowngrade {
//response = CurPurchaseHandler.onNumberDowngrade(msg)
//} else if msg.Cmd == mtwmapi.MsgTypeStoreBind {
//
//} else {
//if orderID := GetOrderIDFromMsg(msg); orderID != "" {
//jxutils.CallMsgHandler(func() {
//switch msg.Cmd {
//case mtwmapi.MsgTypeWaybillStatus:
//response = CurPurchaseHandler.onWaybillMsg(msg)
//default:
//response = CurPurchaseHandler.onOrderMsg(msg)
//}
//}, jxutils.ComposeUniversalOrderID(orderID, model.VendorIDMTWM))
//}
///*if msg.Cmd == mtwmapi.MsgTypeOrderRefund || msg.Cmd == mtwmapi.MsgTypeOrderPartialRefund {
// utils.CallFuncAsync(func() {
// OnFinancialMsg(msg)
// })
//} */
//}
} else {
if orderID := GetOrderIDFromMsg(msg); orderID != "" {
jxutils.CallMsgHandler(func() {
switch msg.Cmd {
case mtwmapi.MsgTypeWaybillStatus:
response = CurPurchaseHandler.onWaybillMsg(msg)
default:
response = CurPurchaseHandler.onOrderMsg(msg)
}
}, jxutils.ComposeUniversalOrderID(orderID, model.VendorIDMTWM))
}
/*if msg.Cmd == mtwmapi.MsgTypeOrderRefund || msg.Cmd == mtwmapi.MsgTypeOrderPartialRefund {
utils.CallFuncAsync(func() {
OnFinancialMsg(msg)
})
} */
}
func OnCallbackMsg(msg *mtwmapi.CallbackMsg) (response *mtwmapi.CallbackResponse) {
if CurPurchaseHandler == nil {
return &mtwmapi.CallbackResponse{Data: "CurPurchaseHandler init fail"}
}
// 获取orderId
orderID := GetOrderIDFromMsg(msg)
switch {
case msg.Cmd == mtwmapi.MsgTypeStoreStatusChanged || msg.Cmd == mtwmapi.MsgTypeStoreAuditStatusChanged:
response = CurPurchaseHandler.onStoreStatusChanged(msg)
case msg.Cmd == mtwmapi.MsgTypePrivateNumberDowngrade:
response = CurPurchaseHandler.onNumberDowngrade(msg)
case msg.Cmd == mtwmapi.MsgTypeStoreBind:
break
case orderID != "" && msg.Cmd == mtwmapi.MsgTypeWaybillStatus:
jxutils.CallMsgHandler(func() {
if msg.Cmd == mtwmapi.MsgTypeWaybillStatus {
response = CurPurchaseHandler.onWaybillMsg(msg)
} else {
response = CurPurchaseHandler.onOrderMsg(msg)
}
}, jxutils.ComposeUniversalOrderID(orderID, model.VendorIDMTWM))
}
return response
}