|
@@ -30,13 +30,23 @@ public class WxCpConfiguration {
|
|
|
|
|
|
@PostConstruct
|
|
|
public void initServices() {
|
|
|
- cpServices = this.properties.getAppConfigs().stream().map(a -> {
|
|
|
+ cpServices = this.properties.getAppConfigs().stream().map(agent -> {
|
|
|
val configStorage = new WxCpDefaultConfigImpl();
|
|
|
configStorage.setCorpId(this.properties.getCorpId());
|
|
|
- configStorage.setAgentId(a.getAgentId());
|
|
|
- configStorage.setCorpSecret(a.getSecret());
|
|
|
- configStorage.setToken(a.getToken());
|
|
|
- configStorage.setAesKey(a.getAesKey());
|
|
|
+ configStorage.setAgentId(agent.getAgentId());
|
|
|
+ configStorage.setCorpSecret(agent.getSecret());
|
|
|
+ configStorage.setToken(agent.getToken());
|
|
|
+ configStorage.setAesKey(agent.getAesKey());
|
|
|
+
|
|
|
+ // 设置代理对象
|
|
|
+ WxCpHttpProxyConfig proxy = properties.getProxy();
|
|
|
+ if (proxy.isEnabled()){
|
|
|
+ configStorage.setHttpProxyHost(proxy.getHost());
|
|
|
+ configStorage.setHttpProxyPort(proxy.getPort());
|
|
|
+ configStorage.setHttpProxyUsername(proxy.getUserName());
|
|
|
+ configStorage.setHttpProxyPassword(proxy.getPassword());
|
|
|
+ }
|
|
|
+
|
|
|
val service = new WxCpServiceApacheHttpClientImpl();
|
|
|
service.setWxCpConfigStorage(configStorage);
|
|
|
return service;
|