request

package
v2.1.3+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2023 License: MIT Imports: 3 Imported by: 2

Documentation

Overview

接收微信回调的消息/事件

接收事件推送

接收普通消息

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image struct {
	message.MsgCommon
	MsgID   int64  `xml:"MsgId" json:"MsgId"`     // 消息id,64位整型
	MediaID string `xml:"MediaId" json:"MediaId"` // 图片消息媒体id,可以调用多媒体文件下载接口拉取数据
	PicURL  string `xml:"PicUrl"   json:"PicUrl"` // 图片链接(由系统生成)
}

图片消息

func GetImage

func GetImage(msg *message.MixMessage) (image *Image)
type Link struct {
	message.MsgCommon
	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"`         // 消息链接
}

链接消息

func GetLink(msg *message.MixMessage) (link *Link)

type Location

type Location struct {
	message.MsgCommon
	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     float64 `xml:"Scale"      json:"Scale"`      // 地图缩放大小
	Label     string  `xml:"Label"      json:"Label"`      // 地理位置信息
}

地理位置消息

func GetLocation

func GetLocation(msg *message.MixMessage) (location *Location)

type LocationEvent

type LocationEvent struct {
	message.MsgCommon
	Event     message.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 *message.MixMessage) (locationEvent *LocationEvent)
type MenuEvent struct {
	message.MsgCommon
	Event    message.EventType `xml:"Event" json:"Event"`       //事件类型 CLICK/VIEW
	EventKey string            `xml:"EventKey" json:"EventKey"` //事件KEY值,与自定义菜单接口中KEY值对应,如果是view,key为跳转URL
}

点击菜单事件

func GetMenuEvent

func GetMenuEvent(msg *message.MixMessage) (menuEvent *MenuEvent)

type ScanEvent

type ScanEvent struct {
	message.MsgCommon
	Event    message.EventType `xml:"Event" json:"Event"`       //事件类型 SCAN
	EventKey string            `xml:"EventKey" json:"EventKey"` //事件KEY值,是一个32位无符号整数,即创建二维码时的二维码scene_id
	Ticket   string            `xml:"Ticket"   json:"Ticket"`   //二维码的ticket,可用来换取二维码图片
}

扫描带参数二维码的事件(已关注用户)

func GetScanEvent

func GetScanEvent(msg *message.MixMessage) (scanEvent *ScanEvent)

type ShortVideo

type ShortVideo struct {
	message.MsgCommon
	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 *message.MixMessage) (shortVideo *ShortVideo)

type SubscribeEvent

type SubscribeEvent struct {
	message.MsgCommon
	Event message.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 *message.MixMessage) (subscribeEvent *SubscribeEvent)

func (*SubscribeEvent) Scene

func (event *SubscribeEvent) Scene() (scene string, err error)

获取二维码参数

type TemplateSendJobFinishEvent

type TemplateSendJobFinishEvent struct {
	message.MsgCommon
	Event  message.EventType `xml:"Event" json:"Event"`   //事件类型 TEMPLATESENDJOBFINISH
	MsgID  int64             `xml:"MsgId"  json:"MsgId"`  // 模板消息ID
	Status string            `xml:"Status" json:"Status"` // 发送状态
}

模板消息送达通知

func GetTemplateSendJobFinishEvent

func GetTemplateSendJobFinishEvent(msg *message.MixMessage) (templateSendJobFinishEvent *TemplateSendJobFinishEvent)

type Text

type Text struct {
	message.MsgCommon
	MsgID   int64  `xml:"MsgId"   json:"MsgId"`   // 消息id, 64位整型
	Content string `xml:"Content" json:"Content"` // 文本消息内容
}

文本消息

func GetText

func GetText(msg *message.MixMessage) (text *Text)

type UnsubscribeEvent

type UnsubscribeEvent struct {
	message.MsgCommon
	Event    message.EventType `xml:"Event" json:"Event"`                           //事件类型 unsubscribe
	EventKey string            `xml:"EventKey,omitempty" json:"EventKey,omitempty"` // 事件KEY值, 空值
}

取消关注事件

func GetUnsubscribeEvent

func GetUnsubscribeEvent(msg *message.MixMessage) (unsubscribeEvent *UnsubscribeEvent)

type Video

type Video struct {
	message.MsgCommon
	MsgID        int64  `xml:"MsgId" json:"MsgId"`                 // 消息id,64位整型
	MediaID      string `xml:"MediaId" json:"MediaId"`             // 图片消息媒体id,可以调用多媒体文件下载接口拉取数据
	ThumbMediaID string `xml:"ThumbMediaId"   json:"ThumbMediaId"` // 视频消息缩略图的媒体id,可以调用多媒体文件下载接口拉取数据
}

视频消息

func GetVideo

func GetVideo(msg *message.MixMessage) (video *Video)

type Voice

type Voice struct {
	message.MsgCommon
	MsgID       int64  `xml:"MsgId" json:"MsgId"`                                 // 消息id,64位整型
	MediaID     string `xml:"MediaId" json:"MediaId"`                             // 图片消息媒体id,可以调用多媒体文件下载接口拉取数据
	Format      string `xml:"Format"   json:"Format"`                             // 语音格式,如amr,speex等
	Recognition string `xml:"Recognition,omitempty" json:"Recognition,omitempty"` // 语音识别结果, UTF8编码  需要开通语音识别功能, 否则该字段为空,即使开通也可能为空
}

语音消息

func GetVoice

func GetVoice(msg *message.MixMessage) (voice *Voice)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL