message

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizerEvent

type AuthorizerEvent struct {
	AppId                        string
	InfoType                     string
	AuthorizerAppid              string
	AuthorizationCode            string
	AuthorizationCodeExpiredTime int64
	PreAuthCode                  string
}

AuthorizerEvent 开放平台公众账号授权事件

type CDATAText

type CDATAText struct {
	Text string `xml:",innerxml"`
}

CDATAText XML文本域

func PtrValue2CDATA

func PtrValue2CDATA(value string) *CDATAText

PtrValue2CDATA 值转换为指针型CDATA

func Value2CDATA

func Value2CDATA(value string) CDATAText

Value2CDATA 值转换为CDATA

type ComponentVerifyTicketEvent

type ComponentVerifyTicketEvent struct {
	AppId                 string
	InfoType              string
	ComponentVerifyTicket string
}

ComponentVerifyTicketEvent 开放平台 component_verify_ticket 推送事件

type Event

type Event struct {
	Event string // 事件类型

	// 扫描带参数的二维码
	EventKey string // 事件key
	Ticket   string // 二维码ticket

	MenuId string // 菜单ID

	// 模板消息发送事件
	MsgID  int64  // 模板消息ID
	Status string // 模板消息发送状态

	// 位置上报事件
	Latitude  string
	Longitude string
	Precision string

	// 开放平台相关事件
	AppId    string
	InfoType string

	// 开放平台 component_verify_ticket 推送事件
	AuthorizerComponentVerifyTicket string

	// 开放平台授权事件
	AuthorizerAppid              string
	AuthorizationCode            string
	AuthorizationCodeExpiredTime int64
	PreAuthCode                  string
}

Event 事件消息

func (*Event) Authorizer

func (e *Event) Authorizer() *AuthorizerEvent

Authorizer 开放平台-公众账号授权事件

func (*Event) ComponentVerifyTicket

func (e *Event) ComponentVerifyTicket() *ComponentVerifyTicketEvent

ComponentVerifyTicket 开放平台 component_verify_ticket 推送事件

func (*Event) Location

func (e *Event) Location() *LocationEvent

Location 位置上报事件

func (*Event) Menu

func (e *Event) Menu() *MenuEvent

Menu 菜单事件

func (*Event) Scan

func (e *Event) Scan() *ScanEvent

Scan 扫描带参数的二维码事件

func (*Event) TemplateSendJobFinish

func (e *Event) TemplateSendJobFinish() *TemplateSendJobFinishEvent

TemplateSendJobFinish 模板消息推荐状态事件

type Header struct {
	ToUserName   string
	FromUserName string
	CreateTime   time.Duration
	MsgType      string
	MsgId        int64
}

Header 消息头

type Image

type Image struct {
	MediaId string
	PicUrl  string
}

Image 图片消息

type Link struct {
	Title       string
	Description string
	Url         string
}

Link 链接消息

type Location

type Location struct {
	LocationX string `xml:"Location_X"`
	LocationY string `xml:"Location_Y"`
	Scale     string
	Label     string
}

Location 地理位置消息

type LocationEvent

type LocationEvent struct {
	Latitude  string
	Longitude string
	Precision string
}

LocationEvent 上报地理位置事件

type MenuEvent struct {
	EventKey string // 事件key
	MenuId   string // 菜单ID
}

MenuEvent 菜单事件

type Message

type Message struct {
	// 消息头
	XMLName      xml.Name `xml:"xml"`
	ToUserName   string
	FromUserName string
	CreateTime   time.Duration
	MsgType      string
	MsgId        int64

	// 文本消息
	Content string

	// 媒体消息通用字段
	MediaId string

	// 图片消息
	PicUrl string

	// 语音消息
	Format      string
	Recognition string

	// 视频消息
	ThumbMediaId string

	// 地理位置消息
	LocationX string `xml:"Location_X"`
	LocationY string `xml:"Location_Y"`
	Scale     string
	Label     string

	// 链接消息
	Title       string
	Description string
	Url         string

	// 事件消息
	Event string // 事件类型

	EventKey string // 事件key (扫描带参数的二维码、菜单点击事件)
	Ticket   string // 二维码ticket

	MenuId string // 菜单ID

	// 位置上报事件
	Latitude  string
	Longitude string
	Precision string

	// 模板消息发送事件
	MsgID  int64  // 模板消息ID
	Status string // 模板消息发送状态

	// 开放平台
	AppId                 string
	InfoType              string
	ComponentVerifyTicket string

	// 开放平台授权事件
	AuthorizerAppid              string
	AuthorizationCode            string
	AuthorizationCodeExpiredTime int64
	PreAuthCode                  string

	Ret      int    `xml:"ret"`
	Nickname string `xml:"nickname"`
	Reason   string `xml:"reason"`
	First    int64  `xml:"first"`
	Second   int64  `xml:"second"`

	SuccTime   int64
	FailTime   int64
	DelayTime  int64
	ScreenShot string
}

Message 消息体

func (*Message) EventMessage

func (m *Message) EventMessage() *Event

EventMessage 事件消息

func (*Message) Header

func (m *Message) Header() *Header

Header 消息头

func (*Message) Image

func (m *Message) Image() *Image

Image 图片消息

func (m *Message) Link() *Link

Link 链接消息

func (*Message) Location

func (m *Message) Location() *Location

Location 位置消息

func (*Message) ShortVideo

func (m *Message) ShortVideo() *Video

ShortVideo 短视频消息

func (*Message) Text

func (m *Message) Text() *Text

Text 文本消息

func (*Message) Video

func (m *Message) Video() *Video

Video 视频消息

func (*Message) Voice

func (m *Message) Voice() *Voice

Voice 语音消息

type ScanEvent

type ScanEvent struct {
	EventKey string // 事件key
	Ticket   string // 二维码ticket
}

ScanEvent 扫描带参数的二维码事件

type TemplateSendJobFinishEvent

type TemplateSendJobFinishEvent struct {
	MsgID  int64  // 模板消息ID
	Status string // 模板消息发送状态
}

TemplateSendJobFinishEvent 模板消息推荐通知事件

type Text

type Text struct {
	Content string
}

Text 文本消息

type Video

type Video struct {
	MediaId      string
	ThumbMediaId string
}

Video 视频消息

type Voice

type Voice struct {
	MediaId     string
	Format      string
	Recognition string
}

Voice 语音消息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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