Documentation ¶
Index ¶
- Constants
- type MP
- func (m *MP) GetAccessToken() (token string, err error)
- func (m *MP) GetJsAPITicket() (ticket string, err error)
- func (m *MP) GetUserInfo(code string) (result *UserInfo, err error)
- func (m *MP) JsAPIConfig(url string) (conf map[string]string, err error)
- func (m *MP) LoginRedirect(redirectURI string) (url string)
- type Mini
- type UserInfo
Constants ¶
View Source
const ( //LoginURL 拼接微信登陆请求 LoginURL string = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code" //RedirectURL 跳转微信登陆授权页 RedirectURL string = "" /* 145-byte string literal not displayed */ //UserInfoURL 微信用户信息 UserInfoURL string = "https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s&lang=zh_CN" // UserInfoCgiURL 用户信息 UserInfoCgiURL string = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=%s&openid=%s&lang=zh_CN" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MP ¶
type MP struct { Appid string `json:"appid"` Appsecret string `json:"appsecret"` JsAPITicket jsAPITicket `json:"-"` AccessToken tokenType `json:"-"` }
MP 微信公众号
func (*MP) GetAccessToken ¶
GetAccessToken 获取token
func (*MP) GetJsAPITicket ¶
GetJsAPITicket 获取JsAPITicket
func (*MP) GetUserInfo ¶
GetUserInfo 发送code换取微信登陆信息
func (*MP) JsAPIConfig ¶
JsAPIConfig 换取微信分享 jsapi授权
func (*MP) LoginRedirect ¶
LoginRedirect 获取登陆链接
type Mini ¶
type Mini struct { Appid string `json:"appid"` Appsecret string `json:"appsecret"` AssessToken tokenType }
Mini Mini
func (*Mini) GetAccessToken ¶
GetAccessToken 获取token
type UserInfo ¶
type UserInfo struct { AccessToken string `json:"access_token"` ExpiresIn int64 `json:"expires_in"` RefreshToken string `json:"refresh_token"` Openid string `json:"openid"` Scope string `json:"scope"` Nickname string `json:"nickname"` Sex int `json:"sex"` Headimgurl string `json:"headimgurl"` Province string `json:"province"` City string `json:"city"` Country string `json:"country"` Unionid string `json:"unionid"` Subscribe int `json:"subscribe"` }
UserInfo 用户信息
Click to show internal directories.
Click to hide internal directories.