Documentation
¶
Index ¶
- Constants
- type CDATA
- type EncryptedXMLMsg
- type EventType
- type MixMessage
- type PrivateSubscribeItem
- type ResponseEncryptedXMLMsg
- type Subscribe
- func (tpl *Subscribe) Add(ShortID string, kidList []int, sceneDesc string) (templateID string, err error)
- func (tpl *Subscribe) Delete(templateID string) (err error)
- func (tpl *Subscribe) List() (templateList []*PrivateSubscribeItem, err error)
- func (tpl *Subscribe) Send(msg *SubscribeMessage) (err error)
- type SubscribeDataItem
- type SubscribeMessage
- type Template
- type TemplateDataItem
- type TemplateItem
- type TemplateMessage
Constants ¶
View Source
const ( // EventSubscribe 订阅 EventSubscribe EventType = "subscribe" // EventUnsubscribe 取消订阅 EventUnsubscribe = "unsubscribe" // EventScan 用户已经关注公众号,则微信会将带场景值扫描事件推送给开发者 EventScan = "SCAN" // EventLocation 上报地理位置事件 EventLocation = "LOCATION" // EventClick 点击菜单拉取消息时的事件推送 EventClick = "CLICK" // EventView 点击菜单跳转链接时的事件推送 EventView = "VIEW" // EventScancodePush 扫码推事件的事件推送 EventScancodePush = "scancode_push" // EventScancodeWaitmsg 扫码推事件且弹出“消息接收中”提示框的事件推送 EventScancodeWaitmsg = "scancode_waitmsg" // EventPicSysphoto 弹出系统拍照发图的事件推送 EventPicSysphoto = "pic_sysphoto" // EventPicPhotoOrAlbum 弹出拍照或者相册发图的事件推送 EventPicPhotoOrAlbum = "pic_photo_or_album" // EventPicWeixin 弹出微信相册发图器的事件推送 EventPicWeixin = "pic_weixin" // EventLocationSelect 弹出地理位置选择器的事件推送 EventLocationSelect = "location_select" // EventTemplateSendJobFinish 发送模板消息推送通知 EventTemplateSendJobFinish = "TEMPLATESENDJOBFINISH" // EventMassSendJobFinish 群发消息推送通知 EventMassSendJobFinish = "MASSSENDJOBFINISH" // EventWxaMediaCheck 异步校验图片/音频是否含有违法违规内容推送事件 EventWxaMediaCheck = "wxa_media_check" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CDATA ¶
type CDATA string
CDATA 使用该类型,在序列化为 xml 文本时文本会被解析器忽略
func (CDATA) MarshalXML ¶
MarshalXML 实现自己的序列化方法
type EncryptedXMLMsg ¶
type EncryptedXMLMsg struct { XMLName struct{} `xml:"xml" json:"-"` ToUserName string `xml:"ToUserName" json:"ToUserName"` EncryptedMsg string `xml:"Encrypt" json:"Encrypt"` }
EncryptedXMLMsg 安全模式下的消息体
type MixMessage ¶
type MixMessage struct { // 事件相关 Event EventType `xml:"Event"` ChangeType string `xml:"ChangeType"` UserID string `xml:"UserID"` Position string `xml:"Position"` Name string `xml:"Name"` Department []int `xml:"Department"` MainDepartment int `xml:"MainDepartment"` IsLeaderInDept []int `xml:"IsLeaderInDept"` Id string `xml:"Id"` ParentId string `xml:"ParentId"` Status int `xml:"Status"` }
MixMessage 存放所有微信发送过来的消息和事件
func (*MixMessage) GetUserID ¶
func (msg *MixMessage) GetUserID() string
GetOpenID get the FromUserName value
type PrivateSubscribeItem ¶
type PrivateSubscribeItem struct { PriTmplID string `json:"priTmplId"` // 添加至帐号下的模板 id,发送订阅通知时所需 Title string `json:"title"` // 模版标题 Content string `json:"content"` // 模版内容 Example string `json:"example"` // 模板内容示例 SubType int `json:"type"` // 模版类型,2 为一次性订阅,3 为长期订阅 }
PrivateSubscribeItem 私有订阅消息模板
type ResponseEncryptedXMLMsg ¶
type ResponseEncryptedXMLMsg struct { XMLName struct{} `xml:"xml" json:"-"` EncryptedMsg string `xml:"Encrypt" json:"Encrypt"` MsgSignature string `xml:"MsgSignature" json:"MsgSignature"` Timestamp int64 `xml:"TimeStamp" json:"TimeStamp"` Nonce string `xml:"Nonce" json:"Nonce"` }
ResponseEncryptedXMLMsg 需要返回的消息体
type Subscribe ¶
Subscribe 订阅消息
func (*Subscribe) Add ¶
func (tpl *Subscribe) Add(ShortID string, kidList []int, sceneDesc string) (templateID string, err error)
Add 添加订阅消息模板
func (*Subscribe) List ¶
func (tpl *Subscribe) List() (templateList []*PrivateSubscribeItem, err error)
List 获取私有订阅消息模板列表
type SubscribeDataItem ¶
type SubscribeDataItem struct {
Value string `json:"value"`
}
SubscribeDataItem 模版内某个 .DATA 的值
type SubscribeMessage ¶
type SubscribeMessage struct { ToUser string `json:"touser"` // 必须, 接受者OpenID TemplateID string `json:"template_id"` // 必须, 模版ID Page string `json:"page,omitempty"` // 可选, 跳转网页时填写 Data map[string]*SubscribeDataItem `json:"data"` // 必须, 模板数据 MiniProgram struct { AppID string `json:"appid"` // 所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系) PagePath string `json:"pagepath"` // 所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar) } `json:"miniprogram"` // 可选,跳转至小程序地址 }
SubscribeMessage 发送的订阅消息内容
type Template ¶
Template 模板消息
func (*Template) List ¶
func (tpl *Template) List() (templateList []*TemplateItem, err error)
List 获取模板列表
type TemplateDataItem ¶
TemplateDataItem 模版内某个 .DATA 的值
type TemplateItem ¶
type TemplateItem struct { TemplateID string `json:"template_id"` Title string `json:"title"` PrimaryIndustry string `json:"primary_industry"` DeputyIndustry string `json:"deputy_industry"` Content string `json:"content"` Example string `json:"example"` }
TemplateItem 模板消息.
type TemplateMessage ¶
type TemplateMessage struct { ToUser string `json:"touser"` // 必须, 接受者OpenID TemplateID string `json:"template_id"` // 必须, 模版ID URL string `json:"url,omitempty"` // 可选, 用户点击后跳转的URL, 该URL必须处于开发者在公众平台网站中设置的域中 Color string `json:"color,omitempty"` // 可选, 整个消息的颜色, 可以不设置 Data map[string]*TemplateDataItem `json:"data"` // 必须, 模板数据 MiniProgram struct { AppID string `json:"appid"` // 所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系) PagePath string `json:"pagepath"` // 所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar) } `json:"miniprogram"` // 可选,跳转至小程序地址 }
TemplateMessage 发送的模板消息内容
Click to show internal directories.
Click to hide internal directories.