Help us shape the future of Go! Take the 2026 Go Developer Survey

template

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataItem

type DataItem struct {
	Value string `json:"value"`
	Color string `json:"color,omitempty"`
}

DataItem 模版内某个 .DATA 的值

type Message

type Message 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]*DataItem `json:"data"`            // 必须, 模板数据

	MiniProgram struct {
		AppID    string `json:"appid"`    //所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系)
		PagePath string `json:"pagepath"` //所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar)
	} `json:"miniprogram"` //可选,跳转至小程序地址
}

Message 发送的模板消息内容

type Template

type Template struct {
	*context.Context
}

Template 模板消息

func NewTemplate

func NewTemplate(context *context.Context) *Template

NewTemplate 实例化

func (*Template) Send

func (tpl *Template) Send(msg *Message) (msgID int64, err error)

Send 发送模板消息

Jump to

Keyboard shortcuts

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