🎨【微信开放平台】优化 Spring Boot Starter 配置逻辑

This commit is contained in:
Forever杨
2021-12-08 18:26:49 +08:00
committed by GitHub
parent f351ecf2a1
commit b8f328b90b

View File

@ -9,19 +9,20 @@ import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage;
public abstract class AbstractWxOpenConfigStorageConfiguration { public abstract class AbstractWxOpenConfigStorageConfiguration {
protected WxOpenInMemoryConfigStorage config(WxOpenInMemoryConfigStorage config, WxOpenProperties properties) { protected WxOpenInMemoryConfigStorage config(WxOpenInMemoryConfigStorage config, WxOpenProperties properties) {
WxOpenProperties.ConfigStorage configStorageProperties = properties.getConfigStorage(); WxOpenProperties.ConfigStorage storage = properties.getConfigStorage();
config.setWxOpenInfo(properties.getAppId(), properties.getSecret(), properties.getToken(), properties.getAesKey()); config.setWxOpenInfo(properties.getAppId(), properties.getSecret(), properties.getToken(), properties.getAesKey());
config.setHttpProxyHost(configStorageProperties.getHttpProxyHost()); config.setHttpProxyHost(storage.getHttpProxyHost());
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername()); config.setHttpProxyUsername(storage.getHttpProxyUsername());
config.setHttpProxyPassword(configStorageProperties.getHttpProxyPassword()); config.setHttpProxyPassword(storage.getHttpProxyPassword());
if (configStorageProperties.getHttpProxyPort() != null) { Integer httpProxyPort = storage.getHttpProxyPort();
config.setHttpProxyPort(configStorageProperties.getHttpProxyPort()); if (httpProxyPort != null) {
config.setHttpProxyPort(httpProxyPort);
} }
int maxRetryTimes = configStorageProperties.getMaxRetryTimes(); int maxRetryTimes = storage.getMaxRetryTimes();
if (configStorageProperties.getMaxRetryTimes() < 0) { if (maxRetryTimes < 0) {
maxRetryTimes = 0; maxRetryTimes = 0;
} }
int retrySleepMillis = configStorageProperties.getRetrySleepMillis(); int retrySleepMillis = storage.getRetrySleepMillis();
if (retrySleepMillis < 0) { if (retrySleepMillis < 0) {
retrySleepMillis = 1000; retrySleepMillis = 1000;
} }