1
0
mirror of synced 2025-12-15 19:47:58 +08:00

🎨 #3694 统一各模块微信接口请求的基础地址字段命名为apiHostUrl,并完善Spring Boot starter配置支持

This commit is contained in:
水依寒
2025-09-04 09:17:36 +08:00
committed by GitHub
parent 1eefd11e03
commit 8447caa75f
20 changed files with 175 additions and 28 deletions

View File

@@ -65,6 +65,16 @@ public class WxOpenInMemoryConfigStorage implements WxOpenConfigStorage {
*/
private int maxRetryTimes = 5;
/**
* 自定义API主机地址用于替换默认的 https://api.weixin.qq.com
*/
private String apiHostUrl;
/**
* 自定义获取AccessToken地址用于向自定义统一服务获取AccessToken
*/
private String accessTokenUrl;
private ApacheHttpClientBuilder apacheHttpClientBuilder;
private Map<String, Token> authorizerRefreshTokens = new ConcurrentHashMap<>();
@@ -290,6 +300,13 @@ public class WxOpenInMemoryConfigStorage implements WxOpenConfigStorage {
this.accessTokenLock = wxOpenConfigStorage.getLockByKey(appId + ":accessTokenLock");
this.jsapiTicketLock = wxOpenConfigStorage.getLockByKey(appId + ":jsapiTicketLock");
this.cardApiTicketLock = wxOpenConfigStorage.getLockByKey(appId + ":cardApiTicketLock");
// 自动获取外层配置的URL设置
if (wxOpenConfigStorage instanceof WxOpenInMemoryConfigStorage) {
WxOpenInMemoryConfigStorage parentConfig = (WxOpenInMemoryConfigStorage) wxOpenConfigStorage;
this.apiHostUrl = parentConfig.getApiHostUrl();
this.accessTokenUrl = parentConfig.getAccessTokenUrl();
}
}
@Override
@@ -637,5 +654,25 @@ public class WxOpenInMemoryConfigStorage implements WxOpenConfigStorage {
public void setHostConfig(WxMpHostConfig hostConfig) {
this.hostConfig = hostConfig;
}
@Override
public String getApiHostUrl() {
return this.apiHostUrl;
}
@Override
public void setApiHostUrl(String apiHostUrl) {
this.apiHostUrl = apiHostUrl;
}
@Override
public String getAccessTokenUrl() {
return this.accessTokenUrl;
}
@Override
public void setAccessTokenUrl(String accessTokenUrl) {
this.accessTokenUrl = accessTokenUrl;
}
}
}