Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
|
- //analyze xml message
- package main
-
- import (
- "encoding/xml"
- )
-
- //all xml message has these headers
- type CommonHeader struct {
- ToUserName string
- FromUserName string
- CreateTime int64
- MsgType string
- }
-
- //text message
- type TextMsg struct {
- Content string
- MsgId int64
- }
-
- //picture
- type PicMsg struct {
- PicUrl string
- MeidaId string
- MsgId int64
- }
-
- //voice
- type VoiceMsg struct {
- MeidaId string
- Format string
- MsgId int64
- }
-
- //video
- type VideoMsg struct {
- MediaId string
- ThumbMediaId string
- MsgId int64
- }
-
- //short video
- type ShortVideo struct {
- MeidaId string
- ThumbMediaId string
- MsgId int64
- }
-
- //Location Info
- type Location struct {
- Location_X float64
- Location_Y float64
- Scale int
- Label string
- MsgId int64
- }
-
- type LinkMsg struct {
- Title string
- Description string
- Url string
- MsgId int64
- }
-
- //ReadCommonHeader parse xml of common field of wechat post message
- func ReadCommonHeader(s string) CommonHeader {
- var r = CommonHeader{}
- xml.Unmarshal([]byte(s), &r)
- return r
- }
|