- weimob order callback
This commit is contained in:
9
business/partner/purchase/weimob/wsc/callback.go
Normal file
9
business/partner/purchase/weimob/wsc/callback.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package wsc
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/weimobapi"
|
||||
)
|
||||
|
||||
func OnCallbackMsg(msg *weimobapi.CallbackMsg) (response *weimobapi.CallbackResponse) {
|
||||
return weimobapi.SuccessResponse
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package controllers
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasks"
|
||||
_ "git.rosy.net.cn/jx-callback/business/partner/purchase/weimob/wsc"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/weimob/wsc"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego"
|
||||
@@ -12,9 +12,17 @@ type WeimobController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
func (c *WeimobController) onCallbackMsg(msgType string) {
|
||||
c.Data["json"] = "ok"
|
||||
c.ServeJSON()
|
||||
func (c *WeimobController) onCallbackMsg() {
|
||||
if true { //c.Ctx.Input.Method() == http.MethodPost {
|
||||
msg, callbackResponse := api.WeimobAPI.GetCallbackMsg(c.Ctx.Input.RequestBody)
|
||||
if callbackResponse == nil {
|
||||
callbackResponse = wsc.OnCallbackMsg(msg)
|
||||
}
|
||||
c.Data["json"] = callbackResponse
|
||||
c.ServeJSON()
|
||||
} else {
|
||||
c.Abort("404")
|
||||
}
|
||||
}
|
||||
|
||||
func (c *WeimobController) Code() {
|
||||
@@ -30,3 +38,11 @@ func (c *WeimobController) Code() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *WeimobController) CreateOrder() {
|
||||
c.onCallbackMsg()
|
||||
}
|
||||
|
||||
func (c *WeimobController) OrderStatusChange() {
|
||||
c.onCallbackMsg()
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
package routers
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/weimobapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/controllers"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
@@ -102,4 +104,9 @@ func init() {
|
||||
beego.Any("/addstoremsg", func(ctx *beecontext.Context) {
|
||||
ctx.WriteString("pong\n")
|
||||
})
|
||||
|
||||
// 在微盟配置回调时能通过检测
|
||||
beego.Any("/weimob", func(ctx *beecontext.Context) {
|
||||
ctx.WriteString(string(utils.MustMarshal(weimobapi.SuccessResponse)))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user