Skip to content

Commit 54ee287

Browse files
committed
群发预览消息格式中加入对towxname和touser的支持
1 parent 29353ff commit 54ee287

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
*/
1010
public class WxMpMassPreviewMessage implements Serializable {
1111
private static final long serialVersionUID = 9095211638358424020L;
12-
private String toWxUsername;
12+
private String toWxUserName;
13+
private String toWxUserOpenid;
1314
private String msgType;
1415
private String content;
1516
private String mediaId;
@@ -18,12 +19,12 @@ public WxMpMassPreviewMessage() {
1819
super();
1920
}
2021

21-
public String getToWxUsername() {
22-
return this.toWxUsername;
22+
public String getToWxUserName() {
23+
return this.toWxUserName;
2324
}
2425

25-
public void setToWxUsername(String toWxUsername) {
26-
this.toWxUsername = toWxUsername;
26+
public void setToWxUserName(String toWxUserName) {
27+
this.toWxUserName = toWxUserName;
2728
}
2829

2930
public String getMsgType() {
@@ -41,7 +42,7 @@ public String getMsgType() {
4142
* 如果msgtype和media_id不匹配的话,会返回系统繁忙的错误
4243
* </pre>
4344
*
44-
* @param msgType
45+
* @param msgType 消息类型
4546
*/
4647
public void setMsgType(String msgType) {
4748
this.msgType = msgType;
@@ -63,6 +64,14 @@ public void setMediaId(String mediaId) {
6364
this.mediaId = mediaId;
6465
}
6566

67+
public String getToWxUserOpenid() {
68+
return this.toWxUserOpenid;
69+
}
70+
71+
public void setToWxUserOpenid(String toWxUserOpenid) {
72+
this.toWxUserOpenid = toWxUserOpenid;
73+
}
74+
6675
public String toJson() {
6776
return WxMpGsonBuilder.INSTANCE.create().toJson(this);
6877
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class WxMpMassPreviewMessageGsonAdapter implements JsonSerializer<WxMpMas
1717
public JsonElement serialize(WxMpMassPreviewMessage wxMpMassPreviewMessage, Type type, JsonSerializationContext jsonSerializationContext) {
1818
JsonObject jsonObject = new JsonObject();
1919
jsonObject.addProperty("towxname", wxMpMassPreviewMessage.getToWxUsername());
20+
jsonObject.addProperty("touser", wxMpMassPreviewMessage.getToWxUserOpenid());
2021
if (WxConsts.MASS_MSG_NEWS.equals(wxMpMassPreviewMessage.getMsgType())) {
2122
JsonObject news = new JsonObject();
2223
news.addProperty("media_id", wxMpMassPreviewMessage.getMediaId());

0 commit comments

Comments
 (0)