File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
weixin-java-common/src/main/java/me/chanjar/weixin/common/api
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ public class WxConsts {
30
30
public static final String CUSTOM_MSG_NEWS = "news" ;
31
31
public static final String CUSTOM_MSG_FILE = "file" ;
32
32
public static final String CUSTOM_MSG_TRANSFER_CUSTOMER_SERVICE = "transfer_customer_service" ;
33
+ public static final String CUSTOM_MSG_SAFE_NO = "0" ;
34
+ public static final String CUSTOM_MSG_SAFE_YES = "1" ;
33
35
34
36
///////////////////////
35
37
// 群发消息的消息类型
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ public class WxCpMessage implements Serializable {
26
26
private String description ;
27
27
private String musicUrl ;
28
28
private String hqMusicUrl ;
29
+ private String safe ;
29
30
private List <WxArticle > articles = new ArrayList <WxArticle >();
30
31
31
32
public String getToUser () {
@@ -63,6 +64,14 @@ public String getMsgType() {
63
64
return msgType ;
64
65
}
65
66
67
+ public String getSafe () {
68
+ return safe ;
69
+ }
70
+
71
+ public void setSafe (String safe ) {
72
+ this .safe = safe ;
73
+ }
74
+
66
75
/**
67
76
* <pre>
68
77
* 请使用
Original file line number Diff line number Diff line change 1
1
package me .chanjar .weixin .cp .bean .messagebuilder ;
2
2
3
+ import me .chanjar .weixin .common .api .WxConsts ;
3
4
import me .chanjar .weixin .cp .bean .WxCpMessage ;
4
5
5
6
public class BaseBuilder <T > {
@@ -8,6 +9,7 @@ public class BaseBuilder<T> {
8
9
protected String toUser ;
9
10
protected String toParty ;
10
11
protected String toTag ;
12
+ protected String safe ;
11
13
12
14
public T agentId (String agentId ) {
13
15
this .agentId = agentId ;
@@ -29,13 +31,20 @@ public T toTag(String toTag) {
29
31
return (T ) this ;
30
32
}
31
33
34
+ public T safe (String safe ) {
35
+ this .safe = safe ;
36
+ return (T ) this ;
37
+ }
38
+
32
39
public WxCpMessage build () {
33
40
WxCpMessage m = new WxCpMessage ();
34
41
m .setAgentId (this .agentId );
35
42
m .setMsgType (this .msgType );
36
43
m .setToUser (this .toUser );
37
44
m .setToParty (this .toParty );
38
45
m .setToTag (this .toTag );
46
+ m .setSafe (
47
+ (this .safe == null || "" .equals (this .safe ))? WxConsts .CUSTOM_MSG_SAFE_NO : this .safe );
39
48
return m ;
40
49
}
41
50
You can’t perform that action at this time.
0 commit comments