1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-11 16:22:26 +08:00

Update default_access_token.go

微信获取稳定版token,只有不等于空字符串的情况下才会返回access_token信息,未空的情况,继续调去微信服务
This commit is contained in:
yangyl12345
2024-11-25 22:18:24 +08:00
committed by GitHub
parent 3fbe8634d9
commit b6762f11ef

View File

@@ -130,7 +130,9 @@ func (ak *StableAccessToken) GetAccessTokenContext(ctx context.Context) (accessT
// 先从cache中取
accessTokenCacheKey := fmt.Sprintf("%s_stable_access_token_%s", ak.cacheKeyPrefix, ak.appID)
if val := ak.cache.Get(accessTokenCacheKey); val != nil {
return val.(string), nil
if accessToken = val.(string); accessToken != "" {
return
}
}
// cache失效从微信服务器获取