公众号:调整二维码参数类 & 新增自定义菜单配置、自动回复配置查询接口

This commit is contained in:
jinyu
2015-04-16 11:30:42 +08:00
parent b6c2fe7d63
commit 8995196b8d
29 changed files with 817 additions and 230 deletions
@@ -29,19 +29,25 @@ public class Button implements Serializable {
*/
private String name;
/**
* 菜单的响应动作类型
* 菜单类型 </br> <font color="red">
* 公众平台官网上能够设置的菜单类型有view、text、img、photo、video、voice </font>
*
* @see com.foxinmy.weixin4j.type.ButtonType
*/
private ButtonType type;
private String type;
/**
* 菜单KEY值用于消息接口推送不超过128字节
* 菜单KEY值,根据type的类型而定,用于消息接口推送,不超过128字节.
* <p>
* 官网上设置的自定义菜单:</br> Text:保存文字到value Img、voice:保存mediaID到value
* Video:保存视频下载链接到value</br> News:保存图文消息到news_info View:保存链接到url。</br>
* <p>
* 使用API设置的自定义菜单:</br>
* click、scancode_push、scancode_waitmsg、pic_sysphoto、pic_photo_or_album
* 、</br> pic_weixin、location_select:保存值到keyview:保存链接到url
* </p>
* </p>
*/
private String key;
/**
* view类型必须 网页链接,用户点击菜单可打开链接,不超过256字节
*/
private String url;
private Serializable content;
/**
* 二级菜单数组,个数应为1~5个
*/
@@ -53,18 +59,18 @@ public class Button implements Serializable {
/**
* 创建一个菜单
* @param name 菜单显示的名称
* @param value 当buttonType为view时value设置为url,否则为key.
* @param buttonType 按钮类型
*
* @param name
* 菜单显示的名称
* @param content
* 当buttonType为view时content设置为url,否则为key.
* @param buttonType
* 按钮类型
*/
public Button(String name, String value, ButtonType buttonType) {
public Button(String name, String content, ButtonType buttonType) {
this.name = name;
this.type = buttonType;
if (buttonType == ButtonType.view) {
this.url = value;
} else {
this.key = value;
}
this.content = content;
this.type = buttonType.name();
}
public String getName() {
@@ -75,28 +81,25 @@ public class Button implements Serializable {
this.name = name;
}
public ButtonType getType() {
public String getType() {
return type;
}
public void setType(ButtonType type) {
@JSONField(serialize = false, deserialize = false)
public ButtonType getFormatType() {
return ButtonType.valueOf(type);
}
public void setType(String type) {
this.type = type;
}
public String getKey() {
return key;
public Serializable getContent() {
return content;
}
public void setKey(String key) {
this.key = key;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
public void setContent(Serializable content) {
this.content = content;
}
public List<Button> getSubs() {
@@ -117,19 +120,7 @@ public class Button implements Serializable {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[Button name=").append(name);
sb.append(" ,type=").append(type);
sb.append(" ,key=").append(key);
sb.append(" ,url=").append(url);
if (subs != null && !subs.isEmpty()) {
sb.append("{");
for (Button sub : subs) {
sb.append(sub.toString());
}
sb.append("}");
}
sb.append("]");
return sb.toString();
return "Button [name=" + name + ", type=" + type + ", content="
+ content + ", subs=" + subs + "]";
}
}
@@ -54,11 +54,11 @@ public final class Consts {
*/
public static final String MICROPAYURL = "https://api.mch.weixin.qq.com/pay/micropay";
/**
* 商户平台下native支付的url
* V2支付下natvie支付的url
*/
public static final String NATIVEURLV2 = "weixin://wxpay/bizpayurl?sign=%s&appid=%s&productid=%s&timestamp=%s&noncestr=%s";
/**
* V2支付下natvie支付的url
* 商户平台(V3)下native支付的url
*/
public static final String NATIVEURLV3 = "weixin://wxpay/bizpayurl?sign=%s&appid=%s&mch_id=%s&product_id=%s&time_stamp=%s&nonce_str=%s";
}
@@ -32,7 +32,7 @@ public class MpArticle implements Serializable {
* 在图文消息页面点击“阅读原文”后的页面 可为空
*/
@JSONField(name = "content_source_url")
private String url;
private String sourceUrl;
/**
* 图文消息页面的内容,支持HTML标签 非空
*/
@@ -46,6 +46,18 @@ public class MpArticle implements Serializable {
*/
@JSONField(name = "show_cover_pic")
private String showCoverPic;
/**
* 正文的URL 可为空
*/
@JSONField(name = "content_url")
private String contentUrl;
/**
* 封面图片的URL 可为空
*/
@JSONField(name = "cover_url")
private String coverUrl;
public MpArticle(String thumbMediaId, String title, String content) {
this.thumbMediaId = thumbMediaId;
@@ -81,12 +93,12 @@ public class MpArticle implements Serializable {
this.title = title;
}
public String getUrl() {
return url;
public String getSourceUrl() {
return sourceUrl;
}
public void setUrl(String url) {
this.url = url;
public void setSourceUrl(String sourceUrl) {
this.sourceUrl = sourceUrl;
}
public String getContent() {
@@ -113,16 +125,28 @@ public class MpArticle implements Serializable {
this.showCoverPic = showCoverPic ? "1" : "0";
}
public String getContentUrl() {
return contentUrl;
}
public void setContentUrl(String contentUrl) {
this.contentUrl = contentUrl;
}
public String getCoverUrl() {
return coverUrl;
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[MpArticle thumbMediaId=").append(thumbMediaId);
sb.append(", author=").append(author);
sb.append(", title=").append(title);
sb.append(", url=").append(url);
sb.append(", content=").append(content);
sb.append(", digest=").append(digest);
sb.append(", showCoverPic=").append(showCoverPic).append("]");
return sb.toString();
return "MpArticle [thumbMediaId=" + thumbMediaId + ", author=" + author
+ ", title=" + title + ", sourceUrl=" + sourceUrl
+ ", content=" + content + ", digest=" + digest
+ ", showCoverPic=" + showCoverPic + ", contentUrl="
+ contentUrl + ", coverUrl=" + coverUrl + "]";
}
}