Documentation ¶
Index ¶
- Constants
- func Signature(jsTicket, noncestr, timestamp, url string) string
- func WxSignRdsInit(rc *redis.Client)
- type WxJsSign
- type WxSign
- func (wSign *WxSign) GetAccessToken() (accessToken string, err error)
- func (wSign *WxSign) GetJsSign(url string) (*WxJsSign, error)
- func (wSign *WxSign) GetTicket() (ticket string, err error)
- func (wSign *WxSign) GetTicketByCache() string
- func (wSign *WxSign) GetTokenByCache() string
- func (wSign *WxSign) PushTicketByCache(token string, duration time.Duration)
- func (wSign *WxSign) PushTokenByCache(token string, duration time.Duration)
Constants ¶
View Source
const ( // APIURLPrefix 微信授权请求 WxAPIURLPrefix = "https://api.weixin.qq.com/cgi-bin" // AuthURL get access_token route WxAuthURL = "/token?grant_type=client_credential&" // GetTicketURL get ticket route WxGetTicketURL = "/ticket/getticket?" // TokenExpire token缓存的时间 TokenExpire = 3600 // TicketExpire tocket缓存时间 TicketExpire = 3600 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type WxJsSign ¶
type WxJsSign struct { Appid string `json:"appid"` Noncestr string `json:"noncestr"` Timestamp string `json:"timestamp"` Url string `json:"url"` Signature string `json:"signature"` }
WxJsSign
type WxSign ¶
type WxSign struct { // Appid 公众号appid Appid string // AppSecret 公众号秘钥 AppSecret string // TokenRdsKey access_token缓存key TokenRdsKey string // TicketRdsKey ticket缓存key TicketRdsKey string }
func (*WxSign) GetAccessToken ¶
GetAccessToken 获取普通api调用需要的access_token 因为有次数限制,需要缓存
func (*WxSign) GetTicketByCache ¶
GetTicketByCache 从缓存获取ticket
func (*WxSign) GetTokenByCache ¶
GetTokenByCache 从缓存获取access_token
func (*WxSign) PushTicketByCache ¶
PushTicket 将微信jsticket 存到 redis 中
Click to show internal directories.
Click to hide internal directories.