123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- package mp
-
- import "encoding/xml"
-
- // CDATA 解析 xml cdata 字段
- type CDATA struct {
- Value string `xml:",cdata"`
- }
-
- // Message 公众号消息
- type Message struct {
- XMLName xml.Name `xml:"xml"`
- ToUserName CDATA `xml:"ToUserName"`
- FromUserName CDATA `xml:"FromUserName"`
- CreateTime int64 `xml:"CreateTime"`
- MsgType CDATA `xml:"MsgType"`
- }
-
- // TextMessage 文本消息
- type TextMessage struct {
- Message
- Content CDATA `xml:"Content"`
- MsgID int64 `xml:"MsgId"`
-
- // BizMsgMenuID 发送客服文本消息的时候用户的响应
- BizMsgMenuID int `xml:"bizmsgmenuid"`
- }
-
- // ImageMessage 图片消息
- type ImageMessage struct {
- Message
- PicURL CDATA `xml:"PicUrl"`
- MediaID CDATA `xml:"MediaId"`
- MsgID int64 `xml:"MsgId"`
- }
-
- // VoiceMessage 语音消息
- type VoiceMessage struct {
- Message
- MediaID CDATA `xml:"MediaId"`
- Format CDATA `xml:"Format"`
- Recognition CDATA `xml:"Recognition"`
- MsgID int64 `xml:"MsgId"`
- }
-
- // VideoMessage 视频消息
- type VideoMessage struct {
- Message
- MediaID CDATA `xml:"MediaId"`
- ThumbMediaID CDATA `xml:"ThumbMediaId"`
- MsgID int64 `xml:"MsgId"`
- }
-
- // MusicReplyMessage 回复音乐消息
- type MusicReplyMessage struct {
- Message
- Title CDATA `xml:"Music>Title"`
- Description CDATA `xml:"Video>Description"`
- MusicURL CDATA `xml:"Video>MusicUrl"`
- HQMusicURL CDATA `xml:"Video>HQMusicUrl"`
- ThumbMediaID CDATA `xml:"Video>ThumbMediaId"`
- }
-
- // ShortVideoMessage 小视频消息
- type ShortVideoMessage struct {
- Message
- MediaID CDATA `xml:"MediaId"`
- ThumbMediaID CDATA `xml:"ThumbMediaId"`
- MsgID int64 `xml:"MsgId"`
- }
-
- // LocationMessage 地理位置消息
- type LocationMessage struct {
- Message
- LocationX float64 `xml:"Location_X"`
- LocationY float64 `xml:"Location_Y"`
- Scale int `xml:"Scale"`
- Label CDATA `xml:"Label"`
- MsgID int64 `xml:"MsgId"`
- }
-
- // LinkMessage 链接消息
- type LinkMessage struct {
- Message
- Title CDATA `xml:"Title"`
- Description CDATA `xml:"Description"`
- URL CDATA `xml:"Url"`
- MsgID int64 `xml:"MsgId"`
- }
-
- // ReplyTextMessage 回复文本消息
- type ReplyTextMessage struct {
- Message
- Content CDATA `xml:"Content"`
- }
-
- // ReplyImageMessage 回复图片消息
- type ReplyImageMessage struct {
- Message
- MediaID CDATA `xml:"Image>MediaId"`
- }
-
- // ReplyVoiceMessage 回复语音消息
- type ReplyVoiceMessage struct {
- Message
- MediaID CDATA `xml:"Voice>MediaId"`
- }
-
- // ReplyVideoMessage 回复视频消息
- type ReplyVideoMessage struct {
- Message
- MediaID CDATA `xml:"Video>MediaId"`
- Title CDATA `xml:"Video>Title"`
- Description CDATA `xml:"Video>Description"`
- }
-
- // ReplyItem 回复图文消息的单独一个item
- type ReplyItem struct {
- Title CDATA `xml:"Title"`
- Description CDATA `xml:"Description"`
- PicURL CDATA `xml:"PicUrl"`
- URL CDATA `xml:"Url"`
- }
-
- // ReplyNewsMessage 回复图文消息
- type ReplyNewsMessage struct {
- Message
- ArticleCount int `xml:"ArticleCount"`
- Articles []ReplyItem `xml:"Articles>item"`
- }
|