被动回复用户消息解析失败?
使用的GO开发后端。数据结构如下: type TextMessage struct {
ToUserName string `xml:"ToUserName"`
FromUserName string `xml:"FromUserName"`
CreateTime int64 `xml:"CreateTime"`
MsgType string `xml:"MsgType"`
Content string `xml:"Content"`
}
构造的响应:
responseMsg := utils.TextMessage{
ToUserName: "123",
FromUserName: "123",
CreateTime: 123123,
MsgType: "text",
Content: "好吧",
}
responseXML, err := xml.Marshal(responseMsg)
if err != nil {
fmt.Println("Error encoding response", err)
return
}
// 发送 XML 响应
c.String(http.StatusOK, string(responseXML))
接口调试结果: 成功或失败: Decrypt Fail! 错误原因: Xml fields error, please check your response xml!