wechat

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthPacket added in v1.0.13

func AuthPacket(mchid, serialno, signature, timestamp, nonce string) string

AuthPacket generate wechat authorization string packet

func NotifyPacket added in v1.0.13

func NotifyPacket(timestamp, nonce, body string) string

NotifyPacket generate wechat notification string packet

func SignPacket added in v1.0.13

func SignPacket(method, URL, timestamp, nonce, body string) string

SignPacket generate wechat signature string packet

Types

type WxIFAgent

type WxIFAgent struct {
	AppID     string // Unique marker for official account
	AppSecret string // Appsecret of the official account
	Scope     string // 'snsapi_base' or 'snsapi_userinfo'
}

WxIFAgent wechat interfaces agent

func (*WxIFAgent) ToWxCodeUrl

func (w *WxIFAgent) ToWxCodeUrl(redirecturl string, state ...string) string

ToWxCodeUrl bind redirect url and return wechat url to get request code Step 1

func (*WxIFAgent) ToWxRefreshUrl

func (w *WxIFAgent) ToWxRefreshUrl(accesscode string) string

ToWxRefreshUrl bind expired access toke and return wechat url to refresh it Step 3

func (*WxIFAgent) ToWxTokenUrl

func (w *WxIFAgent) ToWxTokenUrl(requestcode string) string

ToWxTokenUrl bind request code and return wechat url to get access token Step 2

func (*WxIFAgent) ToWxUserUrl

func (w *WxIFAgent) ToWxUserUrl(accesstoken, openid string) string

ToWxUserUrl bind access token and openid, than return wechat url to get user informations Step 4

func (*WxIFAgent) ToWxVerifyUrl

func (w *WxIFAgent) ToWxVerifyUrl(accesstoken, openid string) string

ToWxVerifyUrl bind access token and openid, than return wechat url to check access token expires Step Annex

type WxResult

type WxResult struct {
	ErrCode int    `json:"errcode"`
	Message string `json:"errmsg"`
}

WxResult request result return from server

type WxToken

type WxToken struct {
	AccessToken  string `json:"access_token"`
	Expires      int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	OpenID       string `json:"openid"`
	Scope        string `json:"scope"`
}

WxToken wechat access and refresh tokens

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"`
	UnionID    string   `json:"unionid"`
}

WxUserInfo wechat user informations

Jump to

Keyboard shortcuts

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