mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-11-01 11:38:27 +08:00
增加点击图文消息跳转链接
This commit is contained in:
@ -35,7 +35,8 @@ public class WxMpMaterialNews implements Serializable {
|
|||||||
* 4. contentSourceUrl 在图文消息页面点击“阅读原文”后的页面链接
|
* 4. contentSourceUrl 在图文消息页面点击“阅读原文”后的页面链接
|
||||||
* 5. content (必填) 图文消息页面的内容,支持HTML标签
|
* 5. content (必填) 图文消息页面的内容,支持HTML标签
|
||||||
* 6. digest 图文消息的描述
|
* 6. digest 图文消息的描述
|
||||||
* 7, showCoverPic 是否显示封面,true为显示,false为不显示
|
* 7. showCoverPic 是否显示封面,true为显示,false为不显示
|
||||||
|
* 8. url 点击图文消息跳转链接
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author chanjarster
|
* @author chanjarster
|
||||||
@ -70,6 +71,12 @@ public class WxMpMaterialNews implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private boolean showCoverPic;
|
private boolean showCoverPic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击图文消息跳转链接
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
public String getThumbMediaId() {
|
public String getThumbMediaId() {
|
||||||
return thumbMediaId;
|
return thumbMediaId;
|
||||||
}
|
}
|
||||||
@ -126,11 +133,19 @@ public class WxMpMaterialNews implements Serializable {
|
|||||||
this.showCoverPic = showCoverPic;
|
this.showCoverPic = showCoverPic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title +
|
return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title +
|
||||||
", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest +
|
", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest +
|
||||||
", showCoverPic=" + showCoverPic + "]";
|
", showCoverPic=" + showCoverPic +", url=" + url + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,9 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa
|
|||||||
articleJson.addProperty("digest", article.getDigest());
|
articleJson.addProperty("digest", article.getDigest());
|
||||||
}
|
}
|
||||||
articleJson.addProperty("show_cover_pic", article.isShowCoverPic() ? "1" : "0");
|
articleJson.addProperty("show_cover_pic", article.isShowCoverPic() ? "1" : "0");
|
||||||
|
if (null != article.getUrl()) {
|
||||||
|
articleJson.addProperty("url", article.getUrl());
|
||||||
|
}
|
||||||
return articleJson;
|
return articleJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +70,10 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa
|
|||||||
if (showCoverPic != null && !showCoverPic.isJsonNull()) {
|
if (showCoverPic != null && !showCoverPic.isJsonNull()) {
|
||||||
article.setShowCoverPic(GsonHelper.getAsBoolean(showCoverPic));
|
article.setShowCoverPic(GsonHelper.getAsBoolean(showCoverPic));
|
||||||
}
|
}
|
||||||
|
JsonElement url = articleInfo.get("url");
|
||||||
|
if (url != null && !url.isJsonNull()) {
|
||||||
|
article.setUrl(GsonHelper.getAsString(url));
|
||||||
|
}
|
||||||
return article;
|
return article;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user