- 只有存在相应的API才注册purchase partner
This commit is contained in:
@@ -8,22 +8,24 @@ import (
|
||||
)
|
||||
|
||||
func OnCallbackMsg(msg *ebaiapi.CallbackMsg) (response *ebaiapi.CallbackResponse) {
|
||||
if orderID := GetOrderIDFromMsg(msg); orderID != "" {
|
||||
jxutils.CallMsgHandler(func() {
|
||||
switch msg.Cmd {
|
||||
case ebaiapi.CmdOrderCreate, ebaiapi.CmdOrderStatus, ebaiapi.CmdOrderUserCancel, ebaiapi.CmdOrderPartRefund:
|
||||
response = CurPurchaseHandler.onOrderMsg(msg)
|
||||
case ebaiapi.CmdOrderDeliveryStatus:
|
||||
response = CurPurchaseHandler.onWaybillMsg(msg)
|
||||
}
|
||||
}, jxutils.ComposeUniversalOrderID(orderID, model.VendorIDEBAI))
|
||||
}
|
||||
if msg.Cmd == ebaiapi.CmdOrderPartRefund || msg.Cmd == ebaiapi.CmdOrderUserCancel || msg.Cmd == ebaiapi.CmdOrderDeliveryStatus {
|
||||
utils.CallFuncAsync(func() {
|
||||
OnFinancialMsg(msg)
|
||||
})
|
||||
} else if msg.Cmd == ebaiapi.CmdShopMsgPush {
|
||||
response = CurPurchaseHandler.onShopMsgPush(msg)
|
||||
if CurPurchaseHandler != nil {
|
||||
if orderID := GetOrderIDFromMsg(msg); orderID != "" {
|
||||
jxutils.CallMsgHandler(func() {
|
||||
switch msg.Cmd {
|
||||
case ebaiapi.CmdOrderCreate, ebaiapi.CmdOrderStatus, ebaiapi.CmdOrderUserCancel, ebaiapi.CmdOrderPartRefund:
|
||||
response = CurPurchaseHandler.onOrderMsg(msg)
|
||||
case ebaiapi.CmdOrderDeliveryStatus:
|
||||
response = CurPurchaseHandler.onWaybillMsg(msg)
|
||||
}
|
||||
}, jxutils.ComposeUniversalOrderID(orderID, model.VendorIDEBAI))
|
||||
}
|
||||
if msg.Cmd == ebaiapi.CmdOrderPartRefund || msg.Cmd == ebaiapi.CmdOrderUserCancel || msg.Cmd == ebaiapi.CmdOrderDeliveryStatus {
|
||||
utils.CallFuncAsync(func() {
|
||||
OnFinancialMsg(msg)
|
||||
})
|
||||
} else if msg.Cmd == ebaiapi.CmdShopMsgPush {
|
||||
response = CurPurchaseHandler.onShopMsgPush(msg)
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -19,8 +19,10 @@ type PurchaseHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
CurPurchaseHandler = new(PurchaseHandler)
|
||||
partner.RegisterPurchasePlatform(CurPurchaseHandler)
|
||||
if api.EbaiAPI != nil {
|
||||
CurPurchaseHandler = new(PurchaseHandler)
|
||||
partner.RegisterPurchasePlatform(CurPurchaseHandler)
|
||||
}
|
||||
}
|
||||
|
||||
func EbaiBusStatus2JxStatus(ebaiStatus int) int {
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -20,8 +21,10 @@ type PurchaseHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
curPurchaseHandler = new(PurchaseHandler)
|
||||
partner.RegisterPurchasePlatform(curPurchaseHandler)
|
||||
if api.ElmAPI != nil {
|
||||
curPurchaseHandler = new(PurchaseHandler)
|
||||
partner.RegisterPurchasePlatform(curPurchaseHandler)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetVendorID() int {
|
||||
@@ -29,7 +32,10 @@ func (c *PurchaseHandler) GetVendorID() int {
|
||||
}
|
||||
|
||||
func OnCallbackMsg(msg *elmapi.CallbackMsg) (retVal *elmapi.CallbackResponse) {
|
||||
return curPurchaseHandler.OnCallbackMsg(msg)
|
||||
if curPurchaseHandler != nil {
|
||||
retVal = curPurchaseHandler.OnCallbackMsg(msg)
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) OnCallbackMsg(msg *elmapi.CallbackMsg) (retVal *elmapi.CallbackResponse) {
|
||||
|
||||
@@ -8,26 +8,35 @@ import (
|
||||
)
|
||||
|
||||
func OnOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
|
||||
if retVal = curPurchaseHandler.OnOrderMsg(msg); retVal == nil {
|
||||
retVal = jdapi.Err2CallbackResponse(errors.New("Internal Error"), "")
|
||||
if curPurchaseHandler != nil {
|
||||
if retVal = curPurchaseHandler.OnOrderMsg(msg); retVal == nil {
|
||||
retVal = jdapi.Err2CallbackResponse(errors.New("Internal Error"), "")
|
||||
}
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
|
||||
func OnWaybillMsg(msg *jdapi.CallbackDeliveryStatusMsg) (retVal *jdapi.CallbackResponse) {
|
||||
if retVal = curPurchaseHandler.OnWaybillMsg(msg); retVal == nil {
|
||||
retVal = jdapi.Err2CallbackResponse(errors.New("Internal Error"), "")
|
||||
if curPurchaseHandler != nil {
|
||||
if retVal = curPurchaseHandler.OnWaybillMsg(msg); retVal == nil {
|
||||
retVal = jdapi.Err2CallbackResponse(errors.New("Internal Error"), "")
|
||||
}
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
|
||||
func OnStoreMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
|
||||
return curPurchaseHandler.onStoreMsg(msg)
|
||||
if curPurchaseHandler != nil {
|
||||
retVal = curPurchaseHandler.onStoreMsg(msg)
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
|
||||
func OnAfterSaleMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
|
||||
utils.CallFuncAsync(func() {
|
||||
OnFinancialMsg(msg)
|
||||
})
|
||||
if curPurchaseHandler != nil {
|
||||
utils.CallFuncAsync(func() {
|
||||
OnFinancialMsg(msg)
|
||||
})
|
||||
}
|
||||
return retVal
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -16,8 +17,10 @@ type PurchaseHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
curPurchaseHandler = new(PurchaseHandler)
|
||||
partner.RegisterPurchasePlatform(curPurchaseHandler)
|
||||
if api.JdAPI != nil {
|
||||
curPurchaseHandler = new(PurchaseHandler)
|
||||
partner.RegisterPurchasePlatform(curPurchaseHandler)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetVendorID() int {
|
||||
|
||||
@@ -8,22 +8,24 @@ import (
|
||||
)
|
||||
|
||||
func OnOrderCallbackMsg(msg *mtwmapi.CallbackMsg) (response *mtwmapi.CallbackResponse) {
|
||||
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 msg.Cmd == mtwmapi.MsgTypeStoreStatusChanged {
|
||||
response = curPurchaseHandler.onStoreStatusChanged(msg)
|
||||
if curPurchaseHandler != nil {
|
||||
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 msg.Cmd == mtwmapi.MsgTypeStoreStatusChanged {
|
||||
response = curPurchaseHandler.onStoreStatusChanged(msg)
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -22,8 +22,10 @@ type PurchaseHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
curPurchaseHandler = new(PurchaseHandler)
|
||||
partner.RegisterPurchasePlatform(curPurchaseHandler)
|
||||
if api.MtwmAPI != nil {
|
||||
curPurchaseHandler = new(PurchaseHandler)
|
||||
partner.RegisterPurchasePlatform(curPurchaseHandler)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetVendorID() int {
|
||||
|
||||
@@ -8,9 +8,11 @@ import (
|
||||
)
|
||||
|
||||
func OnCallbackMsg(msg *weimobapi.CallbackMsg) (response *weimobapi.CallbackResponse) {
|
||||
orderID := utils.Int64ToStr(msg.OrderNo)
|
||||
jxutils.CallMsgHandler(func() {
|
||||
response = curPurchaseHandler.onOrderMsg(msg)
|
||||
}, jxutils.ComposeUniversalOrderID(orderID, model.VendorIDWSC))
|
||||
if curPurchaseHandler != nil {
|
||||
orderID := utils.Int64ToStr(msg.OrderNo)
|
||||
jxutils.CallMsgHandler(func() {
|
||||
response = curPurchaseHandler.onOrderMsg(msg)
|
||||
}, jxutils.ComposeUniversalOrderID(orderID, model.VendorIDWSC))
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@ type PurchaseHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
curPurchaseHandler = new(PurchaseHandler)
|
||||
partner.RegisterPurchasePlatform(curPurchaseHandler)
|
||||
if api.WeimobAPI != nil {
|
||||
curPurchaseHandler = new(PurchaseHandler)
|
||||
partner.RegisterPurchasePlatform(curPurchaseHandler)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetVendorID() int {
|
||||
|
||||
@@ -105,6 +105,8 @@ weixinToken = "17_roSCZgkCxhRnyFVtei0KdfHwdGP8PmLzJFhCieka4_X4_d-lgfaTxF6oIS6FE5
|
||||
dbConnectStr = "root:WebServer@1@tcp(127.0.0.1:3306)/jxd_dev_0?charset=utf8mb4&loc=Local&parseTime=true"
|
||||
|
||||
[prod]
|
||||
EnableDocs = false
|
||||
|
||||
jdToken = "ccb10daf-e6f5-4a58-ada5-b97f9073a137"
|
||||
jdAppKey = "1dba76d40cac446ca500c0391a0b6c9d"
|
||||
jdSecret = "a88d031a1e7b462cb1579f12e97fe7f4"
|
||||
@@ -143,6 +145,9 @@ dingdingSecret = "LWrZAFeqUfuVv7n_tc8vPpCAx6PT4CwManx2XCVhJOqGsx2L5XCDuX1sAN_Jtv
|
||||
dingdingCallbackURL = "http://callback.jxc4.com/dingding/msg"
|
||||
|
||||
[jxgy]
|
||||
httpport = 8088
|
||||
EnableDocs = false
|
||||
|
||||
dbConnectStr = "root:WebServer@1@tcp(db1.int.jxc4.com:3306)/jxgy?charset=utf8mb4&loc=Local&parseTime=true"
|
||||
|
||||
jdToken = "b9f98667-9856-45e9-a31c-9a8862b1bfde"
|
||||
|
||||
Reference in New Issue
Block a user