|
@@ -1,8 +1,24 @@
|
1
|
|
-package event
|
|
1
|
+package mp
|
|
2
|
+
|
|
3
|
+import "encoding/xml"
|
|
4
|
+
|
|
5
|
+// CDATA 解析 xml cdata 字段
|
|
6
|
+type CDATA struct {
|
|
7
|
+ Value string `xml:",cdata"`
|
|
8
|
+}
|
|
9
|
+
|
|
10
|
+// Message 公众号消息
|
|
11
|
+type Message struct {
|
|
12
|
+ XMLName xml.Name `xml:"xml"`
|
|
13
|
+ ToUserName CDATA `xml:"ToUserName"`
|
|
14
|
+ FromUserName CDATA `xml:"FromUserName"`
|
|
15
|
+ CreateTime int64 `xml:"CreateTime"`
|
|
16
|
+ MsgType CDATA `xml:"MsgType"`
|
|
17
|
+}
|
2
|
18
|
|
3
|
19
|
// TextMessage 文本消息
|
4
|
20
|
type TextMessage struct {
|
5
|
|
- AuthorizerEvent
|
|
21
|
+ Message
|
6
|
22
|
Content CDATA `xml:"Content"`
|
7
|
23
|
MsgID int64 `xml:"MsgId"`
|
8
|
24
|
|
|
@@ -10,60 +26,34 @@ type TextMessage struct {
|
10
|
26
|
BizMsgMenuID int `xml:"bizmsgmenuid"`
|
11
|
27
|
}
|
12
|
28
|
|
13
|
|
-// TextReplyMessage 回复文本消息
|
14
|
|
-type TextReplyMessage struct {
|
15
|
|
- AuthorizerEvent
|
16
|
|
- Content CDATA `xml:"Content"`
|
17
|
|
-}
|
18
|
|
-
|
19
|
29
|
// ImageMessage 图片消息
|
20
|
30
|
type ImageMessage struct {
|
21
|
|
- AuthorizerEvent
|
|
31
|
+ Message
|
22
|
32
|
PicURL CDATA `xml:"PicUrl"`
|
23
|
33
|
MediaID CDATA `xml:"MediaId"`
|
24
|
34
|
MsgID int64 `xml:"MsgId"`
|
25
|
35
|
}
|
26
|
36
|
|
27
|
|
-// ImageReplyMessage 回复图片消息
|
28
|
|
-type ImageReplyMessage struct {
|
29
|
|
- AuthorizerEvent
|
30
|
|
- MediaID CDATA `xml:"Image>MediaId"`
|
31
|
|
-}
|
32
|
|
-
|
33
|
37
|
// VoiceMessage 语音消息
|
34
|
38
|
type VoiceMessage struct {
|
35
|
|
- AuthorizerEvent
|
|
39
|
+ Message
|
36
|
40
|
MediaID CDATA `xml:"MediaId"`
|
37
|
41
|
Format CDATA `xml:"Format"`
|
38
|
42
|
Recognition CDATA `xml:"Recognition"`
|
39
|
43
|
MsgID int64 `xml:"MsgId"`
|
40
|
44
|
}
|
41
|
45
|
|
42
|
|
-// VoiceReplyMessage 回复语音消息
|
43
|
|
-type VoiceReplyMessage struct {
|
44
|
|
- AuthorizerEvent
|
45
|
|
- MediaID CDATA `xml:"Voice>MediaId"`
|
46
|
|
-}
|
47
|
|
-
|
48
|
46
|
// VideoMessage 视频消息
|
49
|
47
|
type VideoMessage struct {
|
50
|
|
- AuthorizerEvent
|
|
48
|
+ Message
|
51
|
49
|
MediaID CDATA `xml:"MediaId"`
|
52
|
50
|
ThumbMediaID CDATA `xml:"ThumbMediaId"`
|
53
|
51
|
MsgID int64 `xml:"MsgId"`
|
54
|
52
|
}
|
55
|
53
|
|
56
|
|
-// VideoReplyMessage 回复视频消息
|
57
|
|
-type VideoReplyMessage struct {
|
58
|
|
- AuthorizerEvent
|
59
|
|
- MediaID CDATA `xml:"Video>MediaId"`
|
60
|
|
- Title CDATA `xml:"Video>Title"`
|
61
|
|
- Description CDATA `xml:"Video>Description"`
|
62
|
|
-}
|
63
|
|
-
|
64
|
54
|
// MusicReplyMessage 回复音乐消息
|
65
|
55
|
type MusicReplyMessage struct {
|
66
|
|
- AuthorizerEvent
|
|
56
|
+ Message
|
67
|
57
|
Title CDATA `xml:"Music>Title"`
|
68
|
58
|
Description CDATA `xml:"Video>Description"`
|
69
|
59
|
MusicURL CDATA `xml:"Video>MusicUrl"`
|
|
@@ -73,7 +63,7 @@ type MusicReplyMessage struct {
|
73
|
63
|
|
74
|
64
|
// ShortVideoMessage 小视频消息
|
75
|
65
|
type ShortVideoMessage struct {
|
76
|
|
- AuthorizerEvent
|
|
66
|
+ Message
|
77
|
67
|
MediaID CDATA `xml:"MediaId"`
|
78
|
68
|
ThumbMediaID CDATA `xml:"ThumbMediaId"`
|
79
|
69
|
MsgID int64 `xml:"MsgId"`
|
|
@@ -81,7 +71,7 @@ type ShortVideoMessage struct {
|
81
|
71
|
|
82
|
72
|
// LocationMessage 地理位置消息
|
83
|
73
|
type LocationMessage struct {
|
84
|
|
- AuthorizerEvent
|
|
74
|
+ Message
|
85
|
75
|
LocationX float64 `xml:"Location_X"`
|
86
|
76
|
LocationY float64 `xml:"Location_Y"`
|
87
|
77
|
Scale int `xml:"Scale"`
|
|
@@ -91,24 +81,50 @@ type LocationMessage struct {
|
91
|
81
|
|
92
|
82
|
// LinkMessage 链接消息
|
93
|
83
|
type LinkMessage struct {
|
94
|
|
- AuthorizerEvent
|
|
84
|
+ Message
|
95
|
85
|
Title CDATA `xml:"Title"`
|
96
|
86
|
Description CDATA `xml:"Description"`
|
97
|
87
|
URL CDATA `xml:"Url"`
|
98
|
88
|
MsgID int64 `xml:"MsgId"`
|
99
|
89
|
}
|
100
|
90
|
|
101
|
|
-// ItemMessage 回复图文消息的单独一个item
|
102
|
|
-type ItemMessage struct {
|
|
91
|
+// ReplyTextMessage 回复文本消息
|
|
92
|
+type ReplyTextMessage struct {
|
|
93
|
+ Message
|
|
94
|
+ Content CDATA `xml:"Content"`
|
|
95
|
+}
|
|
96
|
+
|
|
97
|
+// ReplyImageMessage 回复图片消息
|
|
98
|
+type ReplyImageMessage struct {
|
|
99
|
+ Message
|
|
100
|
+ MediaID CDATA `xml:"Image>MediaId"`
|
|
101
|
+}
|
|
102
|
+
|
|
103
|
+// ReplyVoiceMessage 回复语音消息
|
|
104
|
+type ReplyVoiceMessage struct {
|
|
105
|
+ Message
|
|
106
|
+ MediaID CDATA `xml:"Voice>MediaId"`
|
|
107
|
+}
|
|
108
|
+
|
|
109
|
+// ReplyVideoMessage 回复视频消息
|
|
110
|
+type ReplyVideoMessage struct {
|
|
111
|
+ Message
|
|
112
|
+ MediaID CDATA `xml:"Video>MediaId"`
|
|
113
|
+ Title CDATA `xml:"Video>Title"`
|
|
114
|
+ Description CDATA `xml:"Video>Description"`
|
|
115
|
+}
|
|
116
|
+
|
|
117
|
+// ReplyItem 回复图文消息的单独一个item
|
|
118
|
+type ReplyItem struct {
|
103
|
119
|
Title CDATA `xml:"Title"`
|
104
|
120
|
Description CDATA `xml:"Description"`
|
105
|
121
|
PicURL CDATA `xml:"PicUrl"`
|
106
|
122
|
URL CDATA `xml:"Url"`
|
107
|
123
|
}
|
108
|
124
|
|
109
|
|
-// NewsReplyMessage 回复图文消息
|
110
|
|
-type NewsReplyMessage struct {
|
111
|
|
- AuthorizerEvent
|
112
|
|
- ArticleCount int `xml:"ArticleCount"`
|
113
|
|
- Articles []ItemMessage `xml:"Articles>item"`
|
|
125
|
+// ReplyNewsMessage 回复图文消息
|
|
126
|
+type ReplyNewsMessage struct {
|
|
127
|
+ Message
|
|
128
|
+ ArticleCount int `xml:"ArticleCount"`
|
|
129
|
+ Articles []ReplyItem `xml:"Articles>item"`
|
114
|
130
|
}
|