京东商城订单初接入
This commit is contained in:
35
business/partner/purchase/jdshop/callback.go
Normal file
35
business/partner/purchase/jdshop/callback.go
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package jdshop
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi/jdshopapi"
|
||||||
|
)
|
||||||
|
|
||||||
|
func OnCallbackMsg(msg *jdshopapi.CallBackResult) {
|
||||||
|
fmt.Println("testcallback")
|
||||||
|
// if CurPurchaseHandler != nil {
|
||||||
|
// if msg.Cmd == mtwmapi.MsgTypeStoreStatusChanged {
|
||||||
|
// response = CurPurchaseHandler.onStoreStatusChanged(msg)
|
||||||
|
// } else if msg.Cmd == mtwmapi.MsgTypePrivateNumberDowngrade {
|
||||||
|
// response = CurPurchaseHandler.onNumberDowngrade(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)
|
||||||
|
// })
|
||||||
|
// } */
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return response
|
||||||
|
}
|
||||||
@@ -1,6 +1,15 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/jx-callback/business/partner/purchase/jdshop"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -8,15 +17,18 @@ type JdsController struct {
|
|||||||
beego.Controller
|
beego.Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *JdsController) Msg(msgType string) {
|
func (c *JdsController) Msg() {
|
||||||
// c.Data["json"] = mtwmapi.Err2CallbackResponse(nil, "")
|
if c.Ctx.Input.Method() == http.MethodPost {
|
||||||
// msg, callbackResponse := api.MtwmAPI.GetCallbackMsg(c.Ctx.Request)
|
ctx := c.Ctx
|
||||||
// if callbackResponse == nil {
|
ctx.Request.Body = ioutil.NopCloser(bytes.NewReader(ctx.Input.RequestBody))
|
||||||
// callbackResponse = mtwm.OnCallbackMsg(msg)
|
call, err := api.JdShopAPI.GetCallbackMsg(ctx.Request)
|
||||||
// if callbackResponse == nil {
|
if err == nil {
|
||||||
// callbackResponse = mtwmapi.Err2CallbackResponse(nil, "")
|
jdshop.OnCallbackMsg(call)
|
||||||
// }
|
}
|
||||||
// }
|
globals.SugarLogger.Debugf("jds callback callbackResponse:%s", utils.Format4Output(call, true))
|
||||||
// c.Data["json"] = callbackResponse
|
c.Data["json"] = call
|
||||||
// c.ServeJSON()
|
c.ServeJSON()
|
||||||
|
} else {
|
||||||
|
c.Abort("404")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ func init() {
|
|||||||
beego.AutoRouter(&controllers.Djsw2Controller{})
|
beego.AutoRouter(&controllers.Djsw2Controller{})
|
||||||
beego.AutoRouter(&controllers.TongLianController{})
|
beego.AutoRouter(&controllers.TongLianController{})
|
||||||
beego.AutoRouter(&controllers.EclpController{})
|
beego.AutoRouter(&controllers.EclpController{})
|
||||||
|
beego.AutoRouter(&controllers.JdsController{})
|
||||||
|
|
||||||
// 如下都是用于检测存活的空接口
|
// 如下都是用于检测存活的空接口
|
||||||
beego.Any("/", func(ctx *beecontext.Context) {
|
beego.Any("/", func(ctx *beecontext.Context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user