Skip to content

Commit

Permalink
增加点击图文消息跳转链接
Browse files Browse the repository at this point in the history
  • Loading branch information
alanchenup committed Sep 3, 2015
1 parent cf9ccbc commit a645a28
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public boolean isEmpty() {
* 4. contentSourceUrl 在图文消息页面点击“阅读原文”后的页面链接
* 5. content (必填) 图文消息页面的内容,支持HTML标签
* 6. digest 图文消息的描述
* 7, showCoverPic 是否显示封面,true为显示,false为不显示
* 7. showCoverPic 是否显示封面,true为显示,false为不显示
* 8. url 点击图文消息跳转链接
* </pre>
*
* @author chanjarster
Expand Down Expand Up @@ -70,6 +71,12 @@ public static class WxMpMaterialNewsArticle {
*/
private boolean showCoverPic;

/**
* 点击图文消息跳转链接
* @return
*/
private String url;

public String getThumbMediaId() {
return thumbMediaId;
}
Expand Down Expand Up @@ -126,11 +133,19 @@ public void setShowCoverPic(boolean showCoverPic) {
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 + "]";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public JsonElement serialize(WxMpMaterialNews.WxMpMaterialNewsArticle article, T
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;
}

Expand Down Expand Up @@ -67,6 +70,10 @@ public WxMpMaterialNews.WxMpMaterialNewsArticle deserialize(JsonElement jsonElem
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;
}
}

0 comments on commit a645a28

Please sign in to comment.