Skip to content

Commit 1b759ea

Browse files
committed
binarywang#623 群发接口增加clientmsgid
1 parent c0938ff commit 1b759ea

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpMassOpenIdsMessage.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public class WxMpMassOpenIdsMessage implements Serializable {
4141
*/
4242
private boolean sendIgnoreReprint = false;
4343

44+
/**
45+
* 开发者侧群发msgid,长度限制64字节,如不填,则后台默认以群发范围和群发内容的摘要值做为clientmsgid
46+
*/
47+
private String clientMsgId;
48+
4449
public WxMpMassOpenIdsMessage() {
4550
super();
4651
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpMassTagMessage.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,17 @@ public class WxMpMassTagMessage implements Serializable {
3838
* 是否群发给所有用户
3939
*/
4040
private boolean isSendAll = false;
41+
4142
/**
4243
* 文章被判定为转载时,是否继续进行群发操作。
4344
*/
4445
private boolean sendIgnoreReprint = false;
4546

47+
/**
48+
* 开发者侧群发msgid,长度限制64字节,如不填,则后台默认以群发范围和群发内容的摘要值做为clientmsgid
49+
*/
50+
private String clientMsgId;
51+
4652
public WxMpMassTagMessage() {
4753
super();
4854
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpMassOpenIdsMessageGsonAdapter.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
import com.google.gson.*;
44
import me.chanjar.weixin.common.api.WxConsts;
55
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
6+
import org.apache.commons.lang3.StringUtils;
67

78
import java.lang.reflect.Type;
89

10+
/**
11+
* @author someone
12+
*/
913
public class WxMpMassOpenIdsMessageGsonAdapter implements JsonSerializer<WxMpMassOpenIdsMessage> {
1014

1115
@Override
@@ -45,6 +49,11 @@ public JsonElement serialize(WxMpMassOpenIdsMessage message, Type typeOfSrc, Jso
4549
}
4650
messageJson.addProperty("msgtype", message.getMsgType());
4751
messageJson.addProperty("send_ignore_reprint", message.isSendIgnoreReprint() ? 0 : 1);
52+
53+
if(StringUtils.isNotEmpty(message.getClientMsgId())){
54+
messageJson.addProperty("clientmsgid", message.getClientMsgId());
55+
}
56+
4857
return messageJson;
4958
}
5059

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpMassTagMessageGsonAdapter.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
import com.google.gson.JsonSerializer;
77
import me.chanjar.weixin.common.api.WxConsts;
88
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
9+
import org.apache.commons.lang3.StringUtils;
910

1011
import java.lang.reflect.Type;
1112

13+
/**
14+
* @author someone
15+
*/
1216
public class WxMpMassTagMessageGsonAdapter implements JsonSerializer<WxMpMassTagMessage> {
1317

1418
@Override
@@ -51,6 +55,11 @@ public JsonElement serialize(WxMpMassTagMessage message, Type typeOfSrc, JsonSer
5155
}
5256
messageJson.addProperty("msgtype", message.getMsgType());
5357
messageJson.addProperty("send_ignore_reprint", message.isSendIgnoreReprint() ? 0 : 1);
58+
59+
if (StringUtils.isNotEmpty(message.getClientMsgId())) {
60+
messageJson.addProperty("clientmsgid", message.getClientMsgId());
61+
}
62+
5463
return messageJson;
5564
}
5665

0 commit comments

Comments
 (0)