wechat

package
v0.0.0-...-0747d37 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct{}

Message message

func (*Message) Push

func (m *Message) Push(appID, appSecret string, data interface{}) ([]byte, error)

Push message

type Prompt

type Prompt struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

Prompt prompt

type Token

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

Token token

func (*Token) Access

func (t *Token) Access(appID, appSecret, code string) (Token, error)

Access token

func (*Token) Refresh

func (t *Token) Refresh(appID, refreshToken string) (Token, error)

Refresh token

func (*Token) Verify

func (t *Token) Verify(accessToken, openID string) (Prompt, error)

Verify token

type User

type User struct {
	OpenID     string   `json:"openid"`     // 用户的唯一标识
	NickName   string   `json:"nickname"`   // 用户昵称
	Sex        int      `json:"sex"`        // 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知
	Province   string   `json:"province"`   // 用户个人资料填写的省份
	City       string   `json:"city"`       // 普通用户个人资料填写的城市
	Country    string   `json:"country"`    // 国家,如中国为CN
	HeadImgURL string   `json:"headimgurl"` // 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空。若用户更换头像,原有头像URL将失效。
	Privilege  []string `json:"privilege"`  // 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom)
	UnionID    string   `json:"unionid"`    // 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。详见:获取用户个人信息(UnionID机制)
	Language   string   `json:"language"`   // 语言
}

User user

func (*User) Info

func (u *User) Info(accessToken, openID string) (User, error)

Info user

Jump to

Keyboard shortcuts

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