Documentation ¶
Overview ¶
被动接收的基本消息(事件)的数据结构定义, 更多的消息(事件)定义在对应的业务模块内.
Index ¶
Constants ¶
View Source
const ( // 普通事件类型 EventTypeSubscribe core.EventType = "subscribe" // 关注事件, 包括点击关注和扫描二维码(公众号二维码和公众号带参数二维码)关注 EventTypeUnsubscribe core.EventType = "unsubscribe" // 取消关注事件 EventTypeScan core.EventType = "SCAN" // 已经关注的用户扫描带参数二维码事件 EventTypeLocation core.EventType = "LOCATION" // 上报地理位置事件 EventTypeMessageSendJobFinish core.EventType = "MASSSENDJOBFINISH" // 事件推送群发结果 EventTypeAddExpressPath core.EventType = "add_express_path" // 运单轨迹更新事件 EventTypeSubscribeMsgPopupEvent core.EventType = "subscribe_msg_popup_event" // 小程序订阅消息事件 )
View Source
const ( // 普通消息类型 MsgTypeText core.MsgType = "text" // 文本消息 MsgTypeImage core.MsgType = "image" // 图片消息 MsgTypeVoice core.MsgType = "voice" // 语音消息 MsgTypeVideo core.MsgType = "video" // 视频消息 MsgTypeShortVideo core.MsgType = "shortvideo" // 小视频消息 MsgTypeLocation core.MsgType = "location" // 地理位置消息 MsgTypeLink core.MsgType = "link" // 链接消息 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddExpressPathEvent ¶ added in v1.1.10
type AddExpressPathEvent struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader EventType core.EventType `xml:"Event" json:"Event"` // add_express_path MsgId int64 `xml:"MsgId" json:"MsgId"` // 消息id, 64位整型 DeliveryID string `xml:"DeliveryID" json:"DeliveryID"` // 快递公司ID WaybillID string `xml:"WayBillId" json:"WayBillId"` // 运单ID OrderID string `xml:"OrderId" json:"OrderId"` // 订单ID Version int `xml:"Version" json:"Version"` // 轨迹版本号(整型) Count int `xml:"Count" json:"Count"` // 轨迹节点数(整型) Actions []core.AddExpressPathAction `xml:"Actions" json:"Actions"` // 轨迹列表 }
运单轨迹更新事件
func GetAddExpressPathEvent ¶ added in v1.1.10
func GetAddExpressPathEvent(msg *core.MixedMsg) *AddExpressPathEvent
type Image ¶
type Image struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader MsgId int64 `xml:"MsgId" json:"MsgId"` // 消息id, 64位整型 MediaId string `xml:"MediaId" json:"MediaId"` // 图片消息媒体id, 可以调用多媒体文件下载接口拉取数据. PicURL string `xml:"PicUrl" json:"PicUrl"` // 图片链接 }
图片消息
type Link ¶
type Link struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader MsgId int64 `xml:"MsgId" json:"MsgId"` // 消息id, 64位整型 Title string `xml:"Title" json:"Title"` // 消息标题 Description string `xml:"Description" json:"Description"` // 消息描述 URL string `xml:"Url" json:"Url"` // 消息链接 }
链接消息
type Location ¶
type Location struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader MsgId int64 `xml:"MsgId" json:"MsgId"` // 消息id, 64位整型 LocationX float64 `xml:"Location_X" json:"Location_X"` // 地理位置纬度 LocationY float64 `xml:"Location_Y" json:"Location_Y"` // 地理位置经度 Scale int `xml:"Scale" json:"Scale"` // 地图缩放大小 Label string `xml:"Label" json:"Label"` // 地理位置信息 }
地理位置消息
func GetLocation ¶
type LocationEvent ¶
type LocationEvent struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader EventType core.EventType `xml:"Event" json:"Event"` // LOCATION Latitude float64 `xml:"Latitude" json:"Latitude"` // 地理位置纬度 Longitude float64 `xml:"Longitude" json:"Longitude"` // 地理位置经度 Precision float64 `xml:"Precision" json:"Precision"` // 地理位置精度(整数? 但是微信推送过来是浮点数形式) }
上报地理位置事件
func GetLocationEvent ¶
func GetLocationEvent(msg *core.MixedMsg) *LocationEvent
type MessageSendJobFinishEvent ¶
type MessageSendJobFinishEvent struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader EventType core.EventType `xml:"Event" json:"Event"` // MASSSENDJOBFINISH MsgId int64 `xml:"MsgId" json:"MsgId"` // 消息id, 64位整型 Status string `xml:"Status" json:"Status"` // 群发的结果,为“send success”或“send fail”或“err(num)”。但send success时,也有可能因用户拒收公众号的消息、系统错误等原因造成少量用户接收失败。err(num)是审核失败的具体原因,可能的情况如下:err(10001):涉嫌广告, err(20001):涉嫌政治, err(20004):涉嫌社会, err(20002):涉嫌色情, err(20006):涉嫌违法犯罪, err(20008):涉嫌欺诈, err(20013):涉嫌版权, err(22000):涉嫌互推(互相宣传), err(21000):涉嫌其他, err(30001):原创校验出现系统错误且用户选择了被判为转载就不群发, err(30002): 原创校验被判定为不能群发, err(30003): 原创校验被判定为转载文且用户选择了被判为转载就不群发, err(40001):管理员拒绝, err(40002):管理员30分钟内无响应,超时 TotalCount int `xml:"TotalCount" json:"TotalCount"` FilterCount int `xml:"FilterCount" json:"FilterCount"` SentCount int `xml:"SentCount" json:"SentCount"` ErrorCount int `xml:"ErrorCount" json:"ErrorCount"` ArticleUrlResult *core.ArticleUrlResult `xml:"ArticleUrlResult" json:"ArticleUrlResult"` }
事件推送群发结果
func GetMessageSendJobFinishEvent ¶
func GetMessageSendJobFinishEvent(msg *core.MixedMsg) *MessageSendJobFinishEvent
type ScanEvent ¶
type ScanEvent struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader EventType core.EventType `xml:"Event" json:"Event"` // SCAN EventKey string `xml:"EventKey" json:"EventKey"` // 事件KEY值, 二维码的参数值(scene_id, scene_str) Ticket string `xml:"Ticket" json:"Ticket"` // 二维码的ticket, 可用来换取二维码图片 }
用户已关注时, 扫描带参数二维码的事件
func GetScanEvent ¶
type ShortVideo ¶
type ShortVideo struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader MsgId int64 `xml:"MsgId" json:"MsgId"` // 消息id, 64位整型 MediaId string `xml:"MediaId" json:"MediaId"` // 视频消息媒体id, 可以调用多媒体文件下载接口拉取数据. ThumbMediaId string `xml:"ThumbMediaId" json:"ThumbMediaId"` // 视频消息缩略图的媒体id, 可以调用多媒体文件下载接口拉取数据. }
小视频消息
func GetShortVideo ¶
func GetShortVideo(msg *core.MixedMsg) *ShortVideo
type SubscribeEvent ¶
type SubscribeEvent struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader EventType core.EventType `xml:"Event" json:"Event"` // subscribe // 下面两个字段只有在扫描带参数二维码进行关注时才有值, 否则为空值! EventKey string `xml:"EventKey,omitempty" json:"EventKey,omitempty"` // 事件KEY值, 格式为: qrscene_二维码的参数值 Ticket string `xml:"Ticket,omitempty" json:"Ticket,omitempty"` // 二维码的ticket, 可用来换取二维码图片 }
关注事件
func GetSubscribeEvent ¶
func GetSubscribeEvent(msg *core.MixedMsg) *SubscribeEvent
func (*SubscribeEvent) Scene ¶
func (event *SubscribeEvent) Scene() (scene string, err error)
获取二维码参数
type SubscribeMsgPopupEvent ¶ added in v1.1.10
type SubscribeMsgPopupEvent struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader EventType core.EventType `xml:"Event" json:"Event"` // subscribe_msg_popup_event SubscribeMsgPopupEvent *core.SubscribeMsgPopupEvent }
小程序订阅消息事件
func GetSubscribeMsgPopupEvent ¶ added in v1.1.10
func GetSubscribeMsgPopupEvent(msg *core.MixedMsg) *SubscribeMsgPopupEvent
type Text ¶
type Text struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader MsgId int64 `xml:"MsgId" json:"MsgId"` // 消息id, 64位整型 Content string `xml:"Content" json:"Content"` // 文本消息内容 }
文本消息
type UnsubscribeEvent ¶
type UnsubscribeEvent struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader EventType core.EventType `xml:"Event" json:"Event"` // unsubscribe EventKey string `xml:"EventKey,omitempty" json:"EventKey,omitempty"` // 事件KEY值, 空值 }
取消关注事件
func GetUnsubscribeEvent ¶
func GetUnsubscribeEvent(msg *core.MixedMsg) *UnsubscribeEvent
type Video ¶
type Video struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader MsgId int64 `xml:"MsgId" json:"MsgId"` // 消息id, 64位整型 MediaId string `xml:"MediaId" json:"MediaId"` // 视频消息媒体id, 可以调用多媒体文件下载接口拉取数据. ThumbMediaId string `xml:"ThumbMediaId" json:"ThumbMediaId"` // 视频消息缩略图的媒体id, 可以调用多媒体文件下载接口拉取数据. }
视频消息
type Voice ¶
type Voice struct { XMLName struct{} `xml:"xml" json:"-"` core.MsgHeader MsgId int64 `xml:"MsgId" json:"MsgId"` // 消息id, 64位整型 MediaId string `xml:"MediaId" json:"MediaId"` // 语音消息媒体id, 可以调用多媒体文件下载接口拉取该媒体 Format string `xml:"Format" json:"Format"` // 语音格式, 如amr, speex等 // 语音识别结果, UTF8编码, // NOTE: 需要开通语音识别功能, 否则该字段为空, 即使开通了语音识别该字段还是有可能为空 Recognition string `xml:"Recognition,omitempty" json:"Recognition,omitempty"` }
语音消息
Click to show internal directories.
Click to hide internal directories.