mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
fix #56 分组群发消息没有 is_to_all 字段
This commit is contained in:
@@ -14,7 +14,7 @@ public class WxMpGsonBuilder {
|
||||
INSTANCE.disableHtmlEscaping();
|
||||
INSTANCE.registerTypeAdapter(WxMpCustomMessage.class, new WxMpCustomMessageGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpMassNews.class, new WxMpMassNewsGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpMassGroupMessage.class, new WxMpMassMessageGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpMassGroupMessage.class, new WxMpMassGroupMessageGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpMassOpenIdsMessage.class, new WxMpMassOpenIdsMessageGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpGroup.class, new WxMpGroupGsonAdapter());
|
||||
INSTANCE.registerTypeAdapter(WxMpUser.class, new WxUserGsonAdapter());
|
||||
|
||||
@@ -22,13 +22,18 @@ import java.lang.reflect.Type;
|
||||
* @author qianjia
|
||||
*
|
||||
*/
|
||||
public class WxMpMassMessageGsonAdapter implements JsonSerializer<WxMpMassGroupMessage> {
|
||||
public class WxMpMassGroupMessageGsonAdapter implements JsonSerializer<WxMpMassGroupMessage> {
|
||||
|
||||
public JsonElement serialize(WxMpMassGroupMessage message, Type typeOfSrc, JsonSerializationContext context) {
|
||||
JsonObject messageJson = new JsonObject();
|
||||
|
||||
JsonObject filter = new JsonObject();
|
||||
filter.addProperty("group_id", message.getGroupId());
|
||||
if(null == message.getGroupId()) {
|
||||
filter.addProperty("is_to_all", true);
|
||||
} else {
|
||||
filter.addProperty("is_to_all", false);
|
||||
filter.addProperty("group_id", message.getGroupId());
|
||||
}
|
||||
messageJson.add("filter", filter);
|
||||
|
||||
if (WxConsts.MASS_MSG_NEWS.equals(message.getMsgtype())) {
|
||||
Reference in New Issue
Block a user