mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-14 18:25:10 +08:00
群发消息增加isSendAll属性及相关方法,用于显式指定是否群发消息至所有用户
This commit is contained in:
@@ -16,6 +16,7 @@ public class WxMpMassTagMessage implements Serializable {
|
||||
private String msgType;
|
||||
private String content;
|
||||
private String mediaId;
|
||||
private boolean isSendAll = false;
|
||||
private boolean sendIgnoreReprint = false;
|
||||
|
||||
public WxMpMassTagMessage() {
|
||||
@@ -88,4 +89,18 @@ public class WxMpMassTagMessage implements Serializable {
|
||||
this.sendIgnoreReprint = sendIgnoreReprint;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否群发给所有用户
|
||||
*/
|
||||
public boolean isSendAll() {
|
||||
return isSendAll;
|
||||
}
|
||||
|
||||
public void setSendAll(boolean sendAll) {
|
||||
if(sendAll){
|
||||
this.tagId = null;
|
||||
}
|
||||
|
||||
isSendAll = sendAll;
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ public class WxMpMassTagMessageGsonAdapter implements JsonSerializer<WxMpMassTag
|
||||
JsonObject messageJson = new JsonObject();
|
||||
|
||||
JsonObject filter = new JsonObject();
|
||||
if (null == message.getTagId()) {
|
||||
if (message.isSendAll() || null == message.getTagId()) {
|
||||
filter.addProperty("is_to_all", true);
|
||||
} else {
|
||||
filter.addProperty("is_to_all", false);
|
||||
|
Reference in New Issue
Block a user