🎨 #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 = this.getWxMaConfig().getAccessTokenLock();
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
|
if (!this.getWxMaConfig().isAccessTokenExpired() && !forceRefresh) {
|
||||||
|
return this.getWxMaConfig().getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
String url = String.format(WxMaService.GET_ACCESS_TOKEN_URL, this.getWxMaConfig().getAppid(),
|
String url = String.format(WxMaService.GET_ACCESS_TOKEN_URL, this.getWxMaConfig().getAppid(),
|
||||||
this.getWxMaConfig().getSecret());
|
this.getWxMaConfig().getSecret());
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user