Bladeren bron

update

master
DengBiao 1 jaar geleden
bovenliggende
commit
b10b03fbb4
1 gewijzigde bestanden met toevoegingen van 15 en 19 verwijderingen
  1. +15
    -19
      app/hdl/hdl_wx.go

+ 15
- 19
app/hdl/hdl_wx.go Bestand weergeven

@@ -11,7 +11,6 @@ import (
"errors"
"fmt"
"log"
"net/http"
"time"

"github.com/gin-gonic/gin"
@@ -89,15 +88,15 @@ type WXEventForScanMsg struct {

// WXMsgReceive 微信消息接收
func WXMsgReceive(c *gin.Context) {
//log.Printf("[消息接收] - 收到新消息")
//var msg WXMsg
//err := c.ShouldBindXML(&msg)
//if err != nil {
// log.Printf("[消息接收] - XML数据包解析失败: %v\n", err)
// return
//}
//utils.FilePutContents("WXMsgReceive", utils.SerializeStr(msg))
//log.Printf("[消息接收] - 收到消息, 消息类型为: %s", msg.MsgType)
log.Printf("[消息接收] - 收到新消息")
var msg WXMsg
err := c.ShouldBindXML(&msg)
if err != nil {
log.Printf("[消息接收] - XML数据包解析失败: %v\n", err)
return
}
utils.FilePutContents("WXMsgReceive", utils.SerializeStr(msg))
log.Printf("[消息接收] - 收到消息, 消息类型为: %s", msg.MsgType)
//if msg.MsgType == "event" {
// //事件类型消息
// eventMsg := msg
@@ -143,15 +142,12 @@ func WXMsgReceive(c *gin.Context) {
// }
// }
//}
//if msg.MsgType == "text" {
// //文本类型消息
// textMsg := msg
// log.Printf("[文本消息]-收到消息, 消息内容为: %s", textMsg.Content)
// WXMsgReply(c, textMsg.ToUserName, textMsg.FromUserName, textMsg.Content)
//}

c.JSON(http.StatusOK, "")
return
if msg.MsgType == "text" {
//文本类型消息
textMsg := msg
log.Printf("[文本消息]-收到消息, 消息内容为: %s", textMsg.Content)
WXMsgReply(c, textMsg.ToUserName, textMsg.FromUserName, textMsg.Content)
}
}

// WXRepTextMsg 微信回复文本消息结构体


Laden…
Annuleren
Opslaan