Merge pull request #202 from alanchenup/f-url

增加点击图文消息跳转链接
This commit is contained in:
Daniel Qian 2015-09-04 13:10:47 +08:00
commit 8935048040
2 changed files with 24 additions and 2 deletions

View File

@ -35,7 +35,8 @@ public class WxMpMaterialNews implements Serializable {
* 4. contentSourceUrl 在图文消息页面点击阅读原文后的页面链接
* 5. content (必填) 图文消息页面的内容支持HTML标签
* 6. digest 图文消息的描述
* 7, showCoverPic 是否显示封面true为显示false为不显示
* 7. showCoverPic 是否显示封面true为显示false为不显示
* 8. url 点击图文消息跳转链接
* </pre>
*
* @author chanjarster
@ -70,6 +71,12 @@ public class WxMpMaterialNews implements Serializable {
*/
private boolean showCoverPic;
/**
* 点击图文消息跳转链接
* @return
*/
private String url;
public String getThumbMediaId() {
return thumbMediaId;
}
@ -126,11 +133,19 @@ public class WxMpMaterialNews implements Serializable {
this.showCoverPic = showCoverPic;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public String toString() {
return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title +
", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest +
", showCoverPic=" + showCoverPic + "]";
", showCoverPic=" + showCoverPic +", url=" + url + "]";
}
}

View File

@ -32,6 +32,9 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa
articleJson.addProperty("digest", article.getDigest());
}
articleJson.addProperty("show_cover_pic", article.isShowCoverPic() ? "1" : "0");
if (null != article.getUrl()) {
articleJson.addProperty("url", article.getUrl());
}
return articleJson;
}
@ -67,6 +70,10 @@ public class WxMpMaterialNewsArticleGsonAdapter implements JsonSerializer<WxMpMa
if (showCoverPic != null && !showCoverPic.isJsonNull()) {
article.setShowCoverPic(GsonHelper.getAsBoolean(showCoverPic));
}
JsonElement url = articleInfo.get("url");
if (url != null && !url.isJsonNull()) {
article.setUrl(GsonHelper.getAsString(url));
}
return article;
}
}