|
@@ -12,7 +12,7 @@ import (
|
|
|
"git.chuangxin1.com/cx/myth"
|
|
|
)
|
|
|
|
|
|
-func key(appid string) string {
|
|
|
+func keyC(appid string) string {
|
|
|
return "wechat:client:" + appid
|
|
|
}
|
|
|
|
|
@@ -22,7 +22,7 @@ func keyToken(appid string) string {
|
|
|
|
|
|
// NewClient new client
|
|
|
func NewClient(appID, appSecret, token, encodingAESKey string) *Client {
|
|
|
- key := key(appID)
|
|
|
+ key := keyC(appID)
|
|
|
if v, ok := memcache.Load(key); ok {
|
|
|
return v.(*Client)
|
|
|
}
|
|
@@ -73,7 +73,7 @@ func (wc *Client) getToken() (token string, err error) {
|
|
|
wc.AccessToken = accessToken
|
|
|
token = wc.AccessToken
|
|
|
|
|
|
- key1 := key(wc.AppID)
|
|
|
+ key1 := keyC(wc.AppID)
|
|
|
memcache.Store(key1, wc)
|
|
|
ct := ClientToken{AppID: wc.AppID, AccessToken: wc.AccessToken, LastTokenTime: now}
|
|
|
bs, _ := json.Marshal(ct)
|
|
@@ -103,7 +103,7 @@ func (wc *Client) getTicket(now int64) (ticket string, err error) {
|
|
|
wc.LastTicketTime = now
|
|
|
wc.Ticket = ticket
|
|
|
|
|
|
- key := key(wc.AppID)
|
|
|
+ key := keyC(wc.AppID)
|
|
|
memcache.Store(key, wc)
|
|
|
}
|
|
|
|