Documentation ¶
Overview ¶
微信第三方登录相关 公众号支付相关 全局token相关
client:=NewClient(appId,secret) client.SetApiKey("支付的apiKey") ....
Index ¶
- type AccessData
- type Client
- func (c *Client) CodeToAccessToken(code string) (accessData *AccessData, err error)
- func (c *Client) GetJSAPIConfig(ticket, url string) (data *JSWXConfig, err error)
- func (c *Client) GetJSAPITicket(mpGlobalToken string) (ticketData *TicketData, err error)
- func (c *Client) GetMpGlobalToken() (mpTokenData *MpTokenData, err error)
- func (c *Client) GetPayConfig(payParam string) (payConfig *PayConfig, err error)
- func (c *Client) GetWxUser(accessToken, openid string) (wxUser *WxUser, err error)
- func (c *Client) SetApiKey(apiKey string)
- type JSWXConfig
- type MpTokenData
- type PayConfig
- type TicketData
- type WxUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessData ¶
type AccessData struct { AccessType int64 `json:"access_type"` 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"` ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` }
AccessData AccessData
type Client ¶
Client Client
func (*Client) CodeToAccessToken ¶
func (c *Client) CodeToAccessToken(code string) (accessData *AccessData, err error)
CodeToAccessToken 根据code值换行accessToken 第一步
func (*Client) GetJSAPIConfig ¶
func (c *Client) GetJSAPIConfig(ticket, url string) (data *JSWXConfig, err error)
GetJSAPIConfig 获取微信公众号js sdk api 的配置信息 输出到H5页面 ticket为暂存的ticket值 url为H5页面的完整地址
func (*Client) GetJSAPITicket ¶
func (c *Client) GetJSAPITicket(mpGlobalToken string) (ticketData *TicketData, err error)
GetJSAPITicket 根据全局token,获取ticket 返回的ticket需要存放起来,过期时间通常为:7200
func (*Client) GetMpGlobalToken ¶
func (c *Client) GetMpGlobalToken() (mpTokenData *MpTokenData, err error)
GetMpGlobalToken 获取微信公众号的全局token expiresIn:过期时间 此值返回后,需要存放起来,过期时间通常为:7200
type JSWXConfig ¶
type JSWXConfig struct { Debug bool `json:"debug"` AppID string `json:"appId"` TimeStamp int64 `json:"timestamp"` NonceStr string `json:"nonceStr"` Signature string `json:"signature"` JsAPIList []string `json:"jsApiList"` }
JSWXConfig 公众号开发模式下,H5需要使用的JSWXConfig
type MpTokenData ¶
type MpTokenData struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` }
MpTokenData 微信公众号的全局token
type PayConfig ¶
type PayConfig struct { AppID string `json:"appId"` TimeStamp int64 `json:"timeStamp"` NonceStr string `json:"nonceStr"` Package string `json:"package"` SignType string `json:"signType"` PaySign string `json:"paySign"` }
PayConfig 公众号支付时pay参数配置
type TicketData ¶
type TicketData struct { ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` Ticket string `json:"ticket"` ExpiresIn int `json:"expires_in"` }
TicketData ticket返回值
type WxUser ¶
type WxUser 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"` ErrCode int `json:"errcode"` ErrMsg string `json:"errmsg"` }
WxUser 微信的获取用户信息
Click to show internal directories.
Click to hide internal directories.