|
@@ -89,13 +89,14 @@ func (wc *Client) upToken(key string, now int64) (token string, err error) {
|
|
bs, _ := json.Marshal(ct)
|
|
bs, _ := json.Marshal(ct)
|
|
cache.Set(key, string(bs), 0)
|
|
cache.Set(key, string(bs), 0)
|
|
//cache.Store(key, accessToken)
|
|
//cache.Store(key, accessToken)
|
|
|
|
+ //log.Println("upToken", key, string(bs))
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
// 更新公众号 access_token
|
|
// 更新公众号 access_token
|
|
func (wc *Client) UpdateToken() (token string, err error) {
|
|
func (wc *Client) UpdateToken() (token string, err error) {
|
|
- key := keyC(wc.AppID)
|
|
|
|
|
|
+ key := keyToken(wc.AppID)
|
|
token, err = wc.upToken(key, time.Now().Unix())
|
|
token, err = wc.upToken(key, time.Now().Unix())
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -140,6 +141,13 @@ func (wc *Client) getTicket(now int64) (ticket string, err error) {
|
|
|
|
|
|
key := keyC(wc.AppID)
|
|
key := keyC(wc.AppID)
|
|
memcache.Store(key, wc)
|
|
memcache.Store(key, wc)
|
|
|
|
+
|
|
|
|
+ var ct ClientTicket
|
|
|
|
+ ct.AppID = wc.AppID
|
|
|
|
+ ct.Ticket = ticket
|
|
|
|
+ ct.LastTicketTime = now
|
|
|
|
+ bs, _ := json.Marshal(ct)
|
|
|
|
+ cache.Set(key, string(bs), 0)
|
|
}
|
|
}
|
|
|
|
|
|
return
|
|
return
|
|
@@ -165,6 +173,7 @@ func (wc *Client) upTicket(now int64) (ticket string, err error) {
|
|
ct.Ticket = ticket
|
|
ct.Ticket = ticket
|
|
bs, _ := json.Marshal(ct)
|
|
bs, _ := json.Marshal(ct)
|
|
cache.Set(key, string(bs), 0)
|
|
cache.Set(key, string(bs), 0)
|
|
|
|
+ //log.Println("upTicket", key, string(bs))
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|