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 {
3030 public static final String CUSTOM_MSG_NEWS = "news" ;
3131 public static final String CUSTOM_MSG_FILE = "file" ;
3232 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" ;
3335
3436 ///////////////////////
3537 // 群发消息的消息类型
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ public class WxCpMessage implements Serializable {
2626 private String description ;
2727 private String musicUrl ;
2828 private String hqMusicUrl ;
29+ private String safe ;
2930 private List <WxArticle > articles = new ArrayList <WxArticle >();
3031
3132 public String getToUser () {
@@ -63,6 +64,14 @@ public String getMsgType() {
6364 return msgType ;
6465 }
6566
67+ public String getSafe () {
68+ return safe ;
69+ }
70+
71+ public void setSafe (String safe ) {
72+ this .safe = safe ;
73+ }
74+
6675 /**
6776 * <pre>
6877 * 请使用
Original file line number Diff line number Diff line change 11package me .chanjar .weixin .cp .bean .messagebuilder ;
22
3+ import me .chanjar .weixin .common .api .WxConsts ;
34import me .chanjar .weixin .cp .bean .WxCpMessage ;
45
56public class BaseBuilder <T > {
@@ -8,6 +9,7 @@ public class BaseBuilder<T> {
89 protected String toUser ;
910 protected String toParty ;
1011 protected String toTag ;
12+ protected String safe ;
1113
1214 public T agentId (String agentId ) {
1315 this .agentId = agentId ;
@@ -29,13 +31,20 @@ public T toTag(String toTag) {
2931 return (T ) this ;
3032 }
3133
34+ public T safe (String safe ) {
35+ this .safe = safe ;
36+ return (T ) this ;
37+ }
38+
3239 public WxCpMessage build () {
3340 WxCpMessage m = new WxCpMessage ();
3441 m .setAgentId (this .agentId );
3542 m .setMsgType (this .msgType );
3643 m .setToUser (this .toUser );
3744 m .setToParty (this .toParty );
3845 m .setToTag (this .toTag );
46+ m .setSafe (
47+ (this .safe == null || "" .equals (this .safe ))? WxConsts .CUSTOM_MSG_SAFE_NO : this .safe );
3948 return m ;
4049 }
4150
You can’t perform that action at this time.
0 commit comments