Browse Source

fix:微信关注

zqbao 9 months ago
parent
commit
51bd61f45b
1 changed files with 10 additions and 9 deletions
  1. 10 9
      controllers/wechat.go

+ 10 - 9
controllers/wechat.go

@@ -19,6 +19,16 @@ type WechatController struct {
 	BaseCommonController
 }
 
+type Notify struct {
+	ToUserName   string `xml:"ToUserName"`
+	FromUserName string `xml:"FromUserName"`
+	CreateTime   int    `xml:"CreateTime"`
+	MsgType      string `xml:"MsgType"`
+	Event        string `xml:"Event"`
+	EventKey     string `xml:"EventKey"`
+	Content      string `xml:"Content"`
+}
+
 // @Title 微信获取签名接口
 // @Description 微信获取签名接口
 // @Param   Url   query   string  true       "url地址"
@@ -28,15 +38,6 @@ func (this *WechatController) Notify() {
 	echostr := this.GetString("echostr")
 	method := this.Ctx.Input.Method()
 
-	type Notify struct {
-		ToUserName   string `xml:"ToUserName"`
-		FromUserName string `xml:"FromUserName"`
-		CreateTime   int    `xml:"CreateTime"`
-		MsgType      string `xml:"MsgType"`
-		Event        string `xml:"Event"`
-		EventKey     string `xml:"EventKey"`
-		Content      string `xml:"Content"`
-	}
 	if method == "POST" {
 		body := this.Ctx.Input.RequestBody
 		utils.FileLog.Info("wechat notify:" + string(body))