wechat

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AppID appid
	AppID string

	// AppSecret app secret
	AppSecret string
)

Functions

This section is empty.

Types

type MI

type MI struct {
	ToUser           string             `json:"touser,omitempty"`            // 是 接收者(用户)的 openid
	TemplateID       string             `json:"template_id,omitempty"`       // 是 所需下发的订阅模板id
	Page             string             `json:"page,omitempty"`              // 是 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。
	Data             map[string]*Option `json:"data,omitempty"`              // 是 小程序模板数据
	MiniprogramState string             `json:"miniprogram_state,omitempty"` // 否 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版
	Lang             string             `json:"lang,omitempty"`              // 是 进入小程序查看”的语言类型,支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文),默认为zh_CN
}

MI miniprogram message

type MP

type MP struct {
	ToUser      string             `json:"touser,omitempty"`      // 是 公众号appid,要求与小程序有绑定且同主体
	TemplateID  string             `json:"template_id,omitempty"` // 是 公众号模板id
	URL         string             `json:"url,omitempty"`         // 是 公众号模板消息所要跳转的url
	MiniProgram *MiniProgram       `json:"miniprogram,omitempty"` // 是 公众号模板消息所要跳转的小程序,小程序的必须与公众号具有绑定关系
	Data        map[string]*Option `json:"data,omitempty"`        // 是 公众号模板消息的数据
}

MP office account message

type Message

type Message struct {
	ErrCode int    `json:"errcode"` // 错误代码
	ErrMsg  string `json:"errmsg"`  // 错误消息
}

Message message

func NewMessage

func NewMessage() *Message

NewMessage new message

func (*Message) MI

func (m *Message) MI(args *MI) (*Message, error)

MI mi message

func (*Message) MP

func (m *Message) MP(args *MP) (*Message, error)

MP mp message

type MiniProgram

type MiniProgram struct {
	AppID    string `json:"appid,omitempty"`    // 小程序编号
	PagePath string `json:"pagepath,omitempty"` // 小程序路径
}

MiniProgram miniprogram

type Option

type Option struct {
	Value string `json:"value,omitempty"` // 内容
	Color string `json:"color,omitempty"` // 颜色
}

Option option

type Token

type Token struct {
	AccessToken  string `json:"access_token,omitempty"`  // 网页授权接口调用凭证,注意:此access_token与基础支持的access_token不同
	ExpiresIn    int    `json:"expires_in,omitempty"`    // access_token接口调用凭证超时时间,单位(秒)
	RefreshToken string `json:"refresh_token,omitempty"` // 用户刷新access_token
	OpenID       string `json:"openid,omitempty"`        // 用户唯一标识
	Scope        string `json:"scope,omitempty"`         // 用户授权的作用域,使用逗号(,)分隔
	ErrCode      int    `json:"errcode,omitempty"`       // 错误代码
	ErrMsg       string `json:"errmsg,omitempty"`        // 错误消息
}

Token token

func NewToken

func NewToken() *Token

NewToken new token

func (*Token) Access

func (t *Token) Access() (string, error)

Access access token

func (*Token) Cache added in v1.0.7

func (t *Token) Cache() (string, error)

Cache get token from cache

func (*Token) Network added in v1.0.7

func (t *Token) Network() (*Token, error)

Network get token from network

Jump to

Keyboard shortcuts

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