File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
main/java/me/chanjar/weixin/cp/api/impl
test/java/me/chanjar/weixin/cp/api Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,10 @@ public WxJsapiSignature createJsapiSignature(String url) throws WxErrorException
131
131
@ Override
132
132
public WxCpMessageSendResult messageSend (WxCpMessage message ) throws WxErrorException {
133
133
String url = "https://qyapi.weixin.qq.com/cgi-bin/message/send" ;
134
+ Integer agentId = message .getAgentId ();
135
+ if (null == agentId ){
136
+ message .setAgentId (this .getWxCpConfigStorage ().getAgentId ());
137
+ }
134
138
return WxCpMessageSendResult .fromJson (this .post (url , message .toJson ()));
135
139
}
136
140
Original file line number Diff line number Diff line change 20
20
public class WxCpMessageAPITest {
21
21
22
22
@ Inject
23
- protected WxCpServiceImpl wxService ;
23
+ protected WxCpService wxService ;
24
+
24
25
private ApiTestModule .WxXmlCpInMemoryConfigStorage configStorage ;
25
26
26
27
@ BeforeTest
@@ -30,7 +31,7 @@ public void setup() {
30
31
31
32
public void testSendMessage () throws WxErrorException {
32
33
WxCpMessage message = new WxCpMessage ();
33
- message .setAgentId (configStorage .getAgentId ());
34
+ // message.setAgentId(configStorage.getAgentId());
34
35
message .setMsgType (WxConsts .CUSTOM_MSG_TEXT );
35
36
message .setToUser (configStorage .getUserId ());
36
37
message .setContent ("欢迎欢迎,热烈欢迎\n 换行测试\n 超链接:<a href=\" http://www.baidu.com\" >Hello World</a>" );
@@ -43,10 +44,11 @@ public void testSendMessage() throws WxErrorException {
43
44
System .out .println (messageSendResult .getInvalidTagList ());
44
45
}
45
46
47
+ @ Test
46
48
public void testSendMessage1 () throws WxErrorException {
47
49
WxCpMessage message = WxCpMessage
48
50
.TEXT ()
49
- .agentId (configStorage .getAgentId ())
51
+ // .agentId(configStorage.getAgentId())
50
52
.toUser (configStorage .getUserId ())
51
53
.content ("欢迎欢迎,热烈欢迎\n 换行测试\n 超链接:<a href=\" http://www.baidu.com\" >Hello World</a>" )
52
54
.build ();
You can’t perform that action at this time.
0 commit comments