| @@ -556,4 +556,11 @@ public interface WxCpService { | |||||
| * 初始化http请求对象 | * 初始化http请求对象 | ||||
| */ | */ | ||||
| void initHttp(); | void initHttp(); | ||||
| /** | |||||
| * 获取WxMpConfigStorage 对象 | |||||
| * | |||||
| * @return WxMpConfigStorage | |||||
| */ | |||||
| WxCpConfigStorage getWxMpConfigStorage(); | |||||
| } | } | ||||
| @@ -6,6 +6,7 @@ import me.chanjar.weixin.common.bean.result.WxError; | |||||
| import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | ||||
| import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder; | import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder; | ||||
| import me.chanjar.weixin.cp.api.WxCpConfigStorage; | |||||
| import me.chanjar.weixin.cp.api.impl.AbstractWxCpService; | import me.chanjar.weixin.cp.api.impl.AbstractWxCpService; | ||||
| import org.apache.http.HttpHost; | import org.apache.http.HttpHost; | ||||
| @@ -91,4 +92,9 @@ public class WxCpServiceImpl extends AbstractWxCpService<CloseableHttpClient, Ht | |||||
| this.httpClient = apacheHttpClientBuilder.build(); | this.httpClient = apacheHttpClientBuilder.build(); | ||||
| } | } | ||||
| @Override | |||||
| public WxCpConfigStorage getWxMpConfigStorage() { | |||||
| return this.configStorage; | |||||
| } | |||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import jodd.http.*; | |||||
| import me.chanjar.weixin.common.bean.WxAccessToken; | import me.chanjar.weixin.common.bean.WxAccessToken; | ||||
| import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||
| import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
| import me.chanjar.weixin.cp.api.WxCpConfigStorage; | |||||
| import me.chanjar.weixin.cp.api.impl.AbstractWxCpService; | import me.chanjar.weixin.cp.api.impl.AbstractWxCpService; | ||||
| public class WxCpServiceImpl extends AbstractWxCpService<HttpConnectionProvider, ProxyInfo> { | public class WxCpServiceImpl extends AbstractWxCpService<HttpConnectionProvider, ProxyInfo> { | ||||
| @@ -62,4 +63,9 @@ public class WxCpServiceImpl extends AbstractWxCpService<HttpConnectionProvider, | |||||
| httpClient = JoddHttp.httpConnectionProvider; | httpClient = JoddHttp.httpConnectionProvider; | ||||
| } | } | ||||
| @Override | |||||
| public WxCpConfigStorage getWxMpConfigStorage() { | |||||
| return this.configStorage; | |||||
| } | |||||
| } | } | ||||
| @@ -87,4 +87,9 @@ public class WxCpServiceImpl extends AbstractWxCpService<ConnectionPool, OkhttpP | |||||
| httpClient = new ConnectionPool(); | httpClient = new ConnectionPool(); | ||||
| } | } | ||||
| @Override | |||||
| public WxCpConfigStorage getWxMpConfigStorage() { | |||||
| return this.configStorage; | |||||
| } | |||||
| } | } | ||||
| @@ -21,7 +21,7 @@ public class WxCpMessageAPITest { | |||||
| protected WxCpServiceImpl wxService; | protected WxCpServiceImpl wxService; | ||||
| public void testSendCustomMessage() throws WxErrorException { | public void testSendCustomMessage() throws WxErrorException { | ||||
| ApiTestModule.WxXmlCpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlCpInMemoryConfigStorage) this.wxService.configStorage; | |||||
| ApiTestModule.WxXmlCpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlCpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage(); | |||||
| WxCpMessage message1 = new WxCpMessage(); | WxCpMessage message1 = new WxCpMessage(); | ||||
| message1.setAgentId(configStorage.getAgentId()); | message1.setAgentId(configStorage.getAgentId()); | ||||
| message1.setMsgType(WxConsts.CUSTOM_MSG_TEXT); | message1.setMsgType(WxConsts.CUSTOM_MSG_TEXT); | ||||