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