wchat

package
v0.0.0-...-593c55d Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URLUserInfo    = "https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s"
	URLAccessToken = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code"
)

Variables

View Source
var (
	ErrStatusFailed = errors.New("微信接口访问失败")
)

Functions

This section is empty.

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

func New

func New(code string) (au *Auth, err error)

func (*Auth) GetATK

func (a *Auth) GetATK() *WxAccessToken

func (*Auth) GetUserInfo

func (a *Auth) GetUserInfo() *WxUserInfo

func (*Auth) RequestUserInfo

func (a *Auth) RequestUserInfo() error

type DevInfo

type DevInfo struct {
	AppID     string `json:"app_id"`
	AppSecret string `json:"app_secret"`
}

type ResponseHandler

type ResponseHandler = func(rp *grequests.Response) error

type WxAccessToken

type WxAccessToken struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	OpenID       string `json:"openid"`
	Scope        string `json:"scope"`
	UnionID      string `json:"unionid"`
}

type WxUserInfo

type WxUserInfo struct {
	Openid     string   `json:"openid"`
	Nickname   string   `json:"nickname"`
	Sex        int      `json:"sex"`
	Province   string   `json:"province"`
	City       string   `json:"city"`
	Country    string   `json:"country"`
	HeadImgURL string   `json:"headimgurl"`
	Privilege  []string `json:"privilege,omitempty"`
	UnionID    string   `json:"unionid"`
	LocalImg   string   `json:"local_img,omitempty"`
}

func (*WxUserInfo) SaveImg

func (w *WxUserInfo) SaveImg() error

Jump to

Keyboard shortcuts

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