Parcourir la source

fixed client token from cache

ls il y a 3 ans
Parent
commit
139326708f
1 fichiers modifiés avec 1 ajouts et 2 suppressions
  1. 1 2
      wechat/client.go

+ 1 - 2
wechat/client.go

@@ -33,7 +33,7 @@ func NewClient(appID, appSecret, token, encodingAESKey string) *Client {
 
 // getToken get token
 func (wc *Client) getToken() (token string, err error) {
-	key := key(wc.AppID)
+	key := keyToken(wc.AppID)
 	if wc.UseCacheToken {
 		var ct ClientToken
 		s := ``
@@ -74,7 +74,6 @@ func (wc *Client) getToken() (token string, err error) {
 		token = wc.AccessToken
 
 		memcache.Store(key, wc)
-		key = keyToken(wc.AppID)
 		ct := ClientToken{AppID: wc.AppID, AccessToken: wc.AccessToken, LastTokenTime: now}
 		bs, _ := json.Marshal(ct)
 		cache.Set(key, string(bs), 0)