Skip to content

Commit f42b22f

Browse files
author
ecoolper
committed
WxCpService添加getWxMpConfigStorage方法,同时修改相关位置
1 parent d01d372 commit f42b22f

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,4 +556,11 @@ WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream i
556556
* 初始化http请求对象
557557
*/
558558
void initHttp();
559+
560+
/**
561+
* 获取WxMpConfigStorage 对象
562+
*
563+
* @return WxMpConfigStorage
564+
*/
565+
WxCpConfigStorage getWxMpConfigStorage();
559566
}

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/apache/WxCpServiceImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import me.chanjar.weixin.common.exception.WxErrorException;
77
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
88
import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder;
9+
import me.chanjar.weixin.cp.api.WxCpConfigStorage;
910
import me.chanjar.weixin.cp.api.impl.AbstractWxCpService;
1011

1112
import org.apache.http.HttpHost;
@@ -91,4 +92,9 @@ public void initHttp() {
9192

9293
this.httpClient = apacheHttpClientBuilder.build();
9394
}
95+
96+
@Override
97+
public WxCpConfigStorage getWxMpConfigStorage() {
98+
return this.configStorage;
99+
}
94100
}

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/jodd/WxCpServiceImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import me.chanjar.weixin.common.bean.WxAccessToken;
55
import me.chanjar.weixin.common.bean.result.WxError;
66
import me.chanjar.weixin.common.exception.WxErrorException;
7+
import me.chanjar.weixin.cp.api.WxCpConfigStorage;
78
import me.chanjar.weixin.cp.api.impl.AbstractWxCpService;
89

910
public class WxCpServiceImpl extends AbstractWxCpService<HttpConnectionProvider, ProxyInfo> {
@@ -62,4 +63,9 @@ public void initHttp() {
6263

6364
httpClient = JoddHttp.httpConnectionProvider;
6465
}
66+
67+
@Override
68+
public WxCpConfigStorage getWxMpConfigStorage() {
69+
return this.configStorage;
70+
}
6571
}

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/okhttp/WxCpServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,9 @@ public void initHttp() {
8787

8888
httpClient = new ConnectionPool();
8989
}
90+
91+
@Override
92+
public WxCpConfigStorage getWxMpConfigStorage() {
93+
return this.configStorage;
94+
}
9095
}

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/apache/WxCpMessageAPITest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class WxCpMessageAPITest {
2121
protected WxCpServiceImpl wxService;
2222

2323
public void testSendCustomMessage() throws WxErrorException {
24-
ApiTestModule.WxXmlCpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlCpInMemoryConfigStorage) this.wxService.configStorage;
24+
ApiTestModule.WxXmlCpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlCpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage();
2525
WxCpMessage message1 = new WxCpMessage();
2626
message1.setAgentId(configStorage.getAgentId());
2727
message1.setMsgType(WxConsts.CUSTOM_MSG_TEXT);

0 commit comments

Comments
 (0)