添加京东im
This commit is contained in:
@@ -3,6 +3,8 @@ package controllers
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/im"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
@@ -244,6 +246,38 @@ func (c *DjswController) ApplyOrderInvoiceStatus() {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *DjswController) imMsg() {
|
||||
if c.Ctx.Input.Method() == http.MethodPost {
|
||||
var callbackResponse *jdapi.CallbackResponse
|
||||
|
||||
msg, url, err := jdapi.ImChatRiskMsg(getUsefulRequest(c.Ctx))
|
||||
if err != nil {
|
||||
callbackResponse = jdapi.Err2CallbackResponse(err, "")
|
||||
} else {
|
||||
callbackResponse = jdapi.Err2CallbackResponse(im.ReadMsgFromVendor(model.VendorIDJD, url, msg), "")
|
||||
}
|
||||
c.Data["json"] = c.transferResponse("orderStatus", callbackResponse)
|
||||
c.ServeJSON()
|
||||
} else {
|
||||
c.Abort("404")
|
||||
}
|
||||
}
|
||||
|
||||
// ChatRiskMsg 风控消息推送
|
||||
func (c *DjswController) ChatRiskMsg() {
|
||||
c.imMsg()
|
||||
}
|
||||
|
||||
// MsChatMessageMsg 用户消息
|
||||
func (c *DjswController) MsChatMessageMsg() {
|
||||
c.imMsg()
|
||||
}
|
||||
|
||||
// MsgReadAckMsg 消息已读
|
||||
func (c *DjswController) MsgReadAckMsg() {
|
||||
c.imMsg()
|
||||
}
|
||||
|
||||
//免费开卡接不到回调
|
||||
//func (c *DjswController) MemberCreateCard() {
|
||||
// if c.Ctx.Input.Method() == http.MethodPost {
|
||||
|
||||
Reference in New Issue
Block a user