Skip to content

Commit b6762f1

Browse files
authored
Update default_access_token.go
微信获取稳定版token,只有不等于空字符串的情况下才会返回access_token信息,未空的情况,继续调去微信服务
1 parent 3fbe863 commit b6762f1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: credential/default_access_token.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ func (ak *StableAccessToken) GetAccessTokenContext(ctx context.Context) (accessT
130130
// 先从cache中取
131131
accessTokenCacheKey := fmt.Sprintf("%s_stable_access_token_%s", ak.cacheKeyPrefix, ak.appID)
132132
if val := ak.cache.Get(accessTokenCacheKey); val != nil {
133-
return val.(string), nil
133+
if accessToken = val.(string); accessToken != "" {
134+
return
135+
}
134136
}
135137

136138
// cache失效,从微信服务器获取

0 commit comments

Comments
 (0)