Documentation ¶
Index ¶
- type DataItem
- type Message
- type Subscribe
- func (s *Subscribe) Add(ShortID string, kidList []int, sceneDesc string) (templateID string, err error)
- func (s *Subscribe) Delete(templateID string) (err error)
- func (s *Subscribe) ListTemplates() (*TemplateList, error)
- func (s *Subscribe) Send(msg *Message) (err error)
- func (s *Subscribe) UniformSend(msg *UniformMessage) (err error)
- type TemplateItem
- type TemplateList
- type UniformMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataItem ¶
type DataItem struct { Value interface{} `json:"value"` Color string `json:"color"` }
DataItem 模版内某个 .DATA 的值
type Message ¶
type Message struct { ToUser string `json:"touser"` // 必选,接收者(用户)的 openid TemplateID string `json:"template_id"` // 必选,所需下发的订阅模板id Page string `json:"page"` // 可选,点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。 Data map[string]*DataItem `json:"data"` // 必选, 模板内容 MiniprogramState string `json:"miniprogram_state"` // 可选,跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版 Lang string `json:"lang"` // 入小程序查看”的语言类型,支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文),默认为zh_CN }
Message 订阅消息请求参数
type Subscribe ¶
Subscribe 订阅消息
func (*Subscribe) Add ¶ added in v2.0.9
func (s *Subscribe) Add(ShortID string, kidList []int, sceneDesc string) (templateID string, err error)
Add 添加订阅消息模板
func (*Subscribe) ListTemplates ¶ added in v2.0.3
func (s *Subscribe) ListTemplates() (*TemplateList, error)
ListTemplates 获取当前帐号下的个人模板列表 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getTemplateList.html
func (*Subscribe) UniformSend ¶ added in v2.0.6
func (s *Subscribe) UniformSend(msg *UniformMessage) (err error)
UniformSend 发送统一服务消息
type TemplateItem ¶ added in v2.0.3
type TemplateItem struct { PriTmplID string `json:"priTmplId"` Title string `json:"title"` Content string `json:"content"` Example string `json:"example"` Type int64 `json:"type"` }
TemplateItem template item
type TemplateList ¶ added in v2.0.3
type TemplateList struct { util.CommonError Data []TemplateItem `json:"data"` }
TemplateList template list
type UniformMessage ¶ added in v2.0.6
type UniformMessage struct { ToUser string `json:"touser"` WeappTemplateMsg struct { TemplateID string `json:"template_id"` Page string `json:"page"` FormID string `json:"form_id"` Data map[string]*DataItem `json:"data"` EmphasisKeyword string `json:"emphasis_keyword"` } `json:"weapp_template_msg"` MpTemplateMsg struct { Appid string `json:"appid"` TemplateID string `json:"template_id"` URL string `json:"url"` Miniprogram struct { Appid string `json:"appid"` Pagepath string `json:"page"` } `json:"miniprogram"` Data map[string]*DataItem `json:"data"` } `json:"mp_template_msg"` }
UniformMessage 统一服务消息
Click to show internal directories.
Click to hide internal directories.