mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-21 02:57:37 +08:00
🎨 #1554 优化小程序获取token逻辑,减少刷新请求次数
This commit is contained in:
@@ -116,6 +116,10 @@ public class WxMaServiceImpl implements WxMaService, RequestHttp<CloseableHttpCl
|
||||
Lock lock = this.getWxMaConfig().getAccessTokenLock();
|
||||
lock.lock();
|
||||
try {
|
||||
if (!this.getWxMaConfig().isAccessTokenExpired() && !forceRefresh) {
|
||||
return this.getWxMaConfig().getAccessToken();
|
||||
}
|
||||
|
||||
String url = String.format(WxMaService.GET_ACCESS_TOKEN_URL, this.getWxMaConfig().getAppid(),
|
||||
this.getWxMaConfig().getSecret());
|
||||
try {
|
||||
|
Reference in New Issue
Block a user