mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-06 21:57:48 +08:00
WxCpService添加getWxMpConfigStorage方法,同时修改相关位置
This commit is contained in:
parent
d01d372b65
commit
f42b22f5c1
@ -556,4 +556,11 @@ public interface WxCpService {
|
||||
* 初始化http请求对象
|
||||
*/
|
||||
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.util.http.apache.ApacheHttpClientBuilder;
|
||||
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 org.apache.http.HttpHost;
|
||||
@ -91,4 +92,9 @@ public class WxCpServiceImpl extends AbstractWxCpService<CloseableHttpClient, Ht
|
||||
|
||||
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.result.WxError;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.cp.api.WxCpConfigStorage;
|
||||
import me.chanjar.weixin.cp.api.impl.AbstractWxCpService;
|
||||
|
||||
public class WxCpServiceImpl extends AbstractWxCpService<HttpConnectionProvider, ProxyInfo> {
|
||||
@ -62,4 +63,9 @@ public class WxCpServiceImpl extends AbstractWxCpService<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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpConfigStorage getWxMpConfigStorage() {
|
||||
return this.configStorage;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class WxCpMessageAPITest {
|
||||
protected WxCpServiceImpl wxService;
|
||||
|
||||
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();
|
||||
message1.setAgentId(configStorage.getAgentId());
|
||||
message1.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
|
||||
|
Loading…
Reference in New Issue
Block a user