From cf4be7e4b2a20cc5a4350484b7f25b525a42ceb3 Mon Sep 17 00:00:00 2001 From: Gitea Date: Mon, 21 Feb 2022 17:47:58 +0800 Subject: [PATCH] #1494 fix --- modules/auth/wechat/event_handle.go | 4 +++- routers/authentication/wechat_event.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/auth/wechat/event_handle.go b/modules/auth/wechat/event_handle.go index 757d6498a..9e05f5e6e 100644 --- a/modules/auth/wechat/event_handle.go +++ b/modules/auth/wechat/event_handle.go @@ -4,6 +4,7 @@ import ( "code.gitea.io/gitea/modules/redis/redis_client" "code.gitea.io/gitea/modules/redis/redis_key" "encoding/json" + "encoding/xml" "strings" "time" ) @@ -29,7 +30,8 @@ type WechatEvent struct { Ticket string } -type Xml struct { +type EventReply struct { + XMLName xml.Name `xml:"xml"` ToUserName string FromUserName string CreateTime int64 diff --git a/routers/authentication/wechat_event.go b/routers/authentication/wechat_event.go index 67149de5d..35ba23166 100644 --- a/routers/authentication/wechat_event.go +++ b/routers/authentication/wechat_event.go @@ -25,7 +25,7 @@ func AcceptWechatEvent(ctx *context.Context) { log.Info("reply str is empty") return } - reply := &wechat.Xml{ + reply := &wechat.EventReply{ ToUserName: we.FromUserName, FromUserName: we.ToUserName, CreateTime: time.Now().Unix(),