Skip to content

Commit

Permalink
#623 群发接口增加clientmsgid
Browse files Browse the repository at this point in the history
  • Loading branch information
binarywang committed Jun 9, 2018
1 parent c0938ff commit 1b759ea
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public class WxMpMassOpenIdsMessage implements Serializable {
*/
private boolean sendIgnoreReprint = false;

/**
* 开发者侧群发msgid,长度限制64字节,如不填,则后台默认以群发范围和群发内容的摘要值做为clientmsgid
*/
private String clientMsgId;

public WxMpMassOpenIdsMessage() {
super();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ public class WxMpMassTagMessage implements Serializable {
* 是否群发给所有用户
*/
private boolean isSendAll = false;

/**
* 文章被判定为转载时,是否继续进行群发操作。
*/
private boolean sendIgnoreReprint = false;

/**
* 开发者侧群发msgid,长度限制64字节,如不填,则后台默认以群发范围和群发内容的摘要值做为clientmsgid
*/
private String clientMsgId;

public WxMpMassTagMessage() {
super();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
import com.google.gson.*;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
import org.apache.commons.lang3.StringUtils;

import java.lang.reflect.Type;

/**
* @author someone
*/
public class WxMpMassOpenIdsMessageGsonAdapter implements JsonSerializer<WxMpMassOpenIdsMessage> {

@Override
Expand Down Expand Up @@ -45,6 +49,11 @@ public JsonElement serialize(WxMpMassOpenIdsMessage message, Type typeOfSrc, Jso
}
messageJson.addProperty("msgtype", message.getMsgType());
messageJson.addProperty("send_ignore_reprint", message.isSendIgnoreReprint() ? 0 : 1);

if(StringUtils.isNotEmpty(message.getClientMsgId())){
messageJson.addProperty("clientmsgid", message.getClientMsgId());
}

return messageJson;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
import com.google.gson.JsonSerializer;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
import org.apache.commons.lang3.StringUtils;

import java.lang.reflect.Type;

/**
* @author someone
*/
public class WxMpMassTagMessageGsonAdapter implements JsonSerializer<WxMpMassTagMessage> {

@Override
Expand Down Expand Up @@ -51,6 +55,11 @@ public JsonElement serialize(WxMpMassTagMessage message, Type typeOfSrc, JsonSer
}
messageJson.addProperty("msgtype", message.getMsgType());
messageJson.addProperty("send_ignore_reprint", message.isSendIgnoreReprint() ? 0 : 1);

if (StringUtils.isNotEmpty(message.getClientMsgId())) {
messageJson.addProperty("clientmsgid", message.getClientMsgId());
}

return messageJson;
}

Expand Down

0 comments on commit 1b759ea

Please sign in to comment.