diff --git a/README.md b/README.md
index 1ab0f0b6..907263cb 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ weixin-popular 已支持的微信平台
com.github.liyiorg
weixin-popular
- 2.8.26-SNAPSHOT
+ 2.8.26
```
* [升级注意事项](https://github.com/liyiorg/weixin-popular/wiki/jar_update)
diff --git a/changelog.txt b/changelog.txt
index 863b845f..933d9e17 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -2,9 +2,11 @@ WEIXIN-POPULAR CHANGELOG
===========================
https://github.com/liyiorg/weixin-popular
-Changes in version 2.8.26 (2019-02-?)
+Changes in version 2.8.26 (2019-02-22)
-------------------------------------
* #186 添加多次分账接口,添加分账完结接口
+* #193 添加客服消息类型 mpnews,miniprogrampage,msgmenu
+* 添加客服输入状态接口 MessageAPI.messageCustomTyping
Changes in version 2.8.25 (2018-12-18)
-------------------------------------
diff --git a/pom.xml b/pom.xml
index 51aefa32..44ba6986 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.github.liyiorg
weixin-popular
- 2.8.26-SNAPSHOT
+ 2.8.26
weixin-popular
The weixin-popular is a JAVA SDK for weixin. Weixin web url is https://mp.weixin.qq.com.
diff --git a/src/main/java/weixin/popular/Version.java b/src/main/java/weixin/popular/Version.java
index dac7d74a..b1e467a1 100644
--- a/src/main/java/weixin/popular/Version.java
+++ b/src/main/java/weixin/popular/Version.java
@@ -2,5 +2,5 @@
public interface Version {
- String VERSION = "2.8.26-SNAPSHOT";
+ String VERSION = "2.8.26";
}
diff --git a/src/main/java/weixin/popular/api/MessageAPI.java b/src/main/java/weixin/popular/api/MessageAPI.java
index cc1f43c9..440ea821 100644
--- a/src/main/java/weixin/popular/api/MessageAPI.java
+++ b/src/main/java/weixin/popular/api/MessageAPI.java
@@ -69,6 +69,27 @@ public static BaseResult messageCustomSend(String access_token, Message message)
String str = JsonUtil.toJSONString(message);
return messageCustomSend(access_token, str);
}
+
+ /**
+ * 客服输入状态
+ * @since 2.8.26
+ * @param access_token access_token
+ * @param touser touser
+ * @param command
+ * "Typing":对用户下发“正在输入"状态
+ * "CancelTyping":取消对用户的”正在输入"状态
+ * @return BaseResult
+ */
+ public static BaseResult messageCustomTyping(String access_token, String touser, String command) {
+ String json = String.format("{\"touser\":\"%s\",\"command\":\"%s\"}", touser, command);
+ HttpUriRequest httpUriRequest = RequestBuilder.post()
+ .setHeader(jsonHeader)
+ .setUri(BASE_URI + "/cgi-bin/message/custom/typing")
+ .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
+ .setEntity(new StringEntity(json, Charset.forName("utf-8")))
+ .build();
+ return LocalHttpClient.executeJsonResult(httpUriRequest, BaseResult.class);
+ }
/**
* 高级群发 构成 MassMPnewsMessage 对象的前置请求接口
diff --git a/src/main/java/weixin/popular/bean/message/message/Message.java b/src/main/java/weixin/popular/bean/message/message/Message.java
index 3bbb1ae1..ce56a9f0 100644
--- a/src/main/java/weixin/popular/bean/message/message/Message.java
+++ b/src/main/java/weixin/popular/bean/message/message/Message.java
@@ -13,12 +13,12 @@ protected Message(String touser,String msgtype) {
}
- private Customservice customservice; //如果需要以某个客服帐号来发消息(在微信6.0.2及以上版本中显示自定义头像),则需在JSON数据包的后半部分加入customservice参数,例如发送文本消息则改为:
-
private String touser;
private String msgtype;
+ private Customservice customservice; //如果需要以某个客服帐号来发消息(在微信6.0.2及以上版本中显示自定义头像),则需在JSON数据包的后半部分加入customservice参数,例如发送文本消息则改为:
+
public String getTouser() {
return touser;
}
@@ -35,27 +35,27 @@ protected void setMsgtype(String msgtype) {
this.msgtype = msgtype;
}
+ public Customservice getCustomservice() {
+ return customservice;
+ }
+
+ public void setCustomservice(Customservice customservice) {
+ this.customservice = customservice;
+ }
+
public static class Customservice{
private String kf_account;
-
+
public String getKf_account() {
return kf_account;
}
-
+
public void setKf_account(String kf_account) {
this.kf_account = kf_account;
}
}
-
- public Customservice getCustomservice() {
- return customservice;
- }
-
- public void setCustomservice(Customservice customservice) {
- this.customservice = customservice;
- }
diff --git a/src/main/java/weixin/popular/bean/message/message/MiniprogrampageMessage.java b/src/main/java/weixin/popular/bean/message/message/MiniprogrampageMessage.java
new file mode 100644
index 00000000..3941f1ff
--- /dev/null
+++ b/src/main/java/weixin/popular/bean/message/message/MiniprogrampageMessage.java
@@ -0,0 +1,74 @@
+package weixin.popular.bean.message.message;
+
+/**
+ * 小程序卡片
+ *
+ * @serial 2.8.26
+ * @author LiYi
+ *
+ */
+public class MiniprogrampageMessage extends Message {
+
+ public MiniprogrampageMessage() {
+ }
+
+ public MiniprogrampageMessage(String touser) {
+ super(touser, "miniprogrampage");
+ }
+
+ public MiniprogrampageMessage(String touser, Miniprogrampage miniprogrampage) {
+ this(touser);
+ this.miniprogrampage = miniprogrampage;
+ }
+
+ private Miniprogrampage miniprogrampage;
+
+ public Miniprogrampage getMiniprogrampage() {
+ return miniprogrampage;
+ }
+
+ public void setMiniprogrampage(Miniprogrampage miniprogrampage) {
+ this.miniprogrampage = miniprogrampage;
+ }
+
+ public static class Miniprogrampage {
+
+ private String title;
+ private String pagepath;
+ private String thumb_media_id;
+ private String appid;
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getPagepath() {
+ return pagepath;
+ }
+
+ public void setPagepath(String pagepath) {
+ this.pagepath = pagepath;
+ }
+
+ public String getThumb_media_id() {
+ return thumb_media_id;
+ }
+
+ public void setThumb_media_id(String thumb_media_id) {
+ this.thumb_media_id = thumb_media_id;
+ }
+
+ public String getAppid() {
+ return appid;
+ }
+
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
+
+ }
+}
diff --git a/src/main/java/weixin/popular/bean/message/message/MpnewsMessage.java b/src/main/java/weixin/popular/bean/message/message/MpnewsMessage.java
new file mode 100644
index 00000000..8c861a4e
--- /dev/null
+++ b/src/main/java/weixin/popular/bean/message/message/MpnewsMessage.java
@@ -0,0 +1,42 @@
+package weixin.popular.bean.message.message;
+
+/**
+ *
+ * 发送图文消息(点击跳转到图文消息页面)
+ *
+ * @since 2.8.26
+ * @author LiYi
+ */
+public class MpnewsMessage extends Message {
+
+ public MpnewsMessage() {
+ }
+
+ public MpnewsMessage(String toUser, String mediaId) {
+ super(toUser, "mpnews");
+ this.mpnews = new Mpnews();
+ this.mpnews.setMedia_id(mediaId);
+ }
+
+ private Mpnews mpnews;
+
+ public Mpnews getMpnews() {
+ return mpnews;
+ }
+
+ public void setMpnews(Mpnews mpnews) {
+ this.mpnews = mpnews;
+ }
+
+ public static class Mpnews {
+ private String media_id;
+
+ public String getMedia_id() {
+ return media_id;
+ }
+
+ public void setMedia_id(String mediaId) {
+ media_id = mediaId;
+ }
+ }
+}
diff --git a/src/main/java/weixin/popular/bean/message/message/MsgmenuMessage.java b/src/main/java/weixin/popular/bean/message/message/MsgmenuMessage.java
new file mode 100644
index 00000000..04308b98
--- /dev/null
+++ b/src/main/java/weixin/popular/bean/message/message/MsgmenuMessage.java
@@ -0,0 +1,86 @@
+package weixin.popular.bean.message.message;
+
+import java.util.List;
+
+/**
+ * 菜单消息
+ *
+ * @since 2.8.26
+ * @author LiYi
+ */
+public class MsgmenuMessage extends Message {
+
+ public MsgmenuMessage() {
+ }
+
+ public MsgmenuMessage(String touser, Msgmenu msgmenu) {
+ super(touser, "msgmenu");
+ this.msgmenu = msgmenu;
+ }
+
+ private Msgmenu msgmenu;
+
+ public Msgmenu getMsgmenu() {
+ return msgmenu;
+ }
+
+ public void setMsgmenu(Msgmenu msgmenu) {
+ this.msgmenu = msgmenu;
+ }
+
+ public static class Msgmenu {
+
+ private String head_content;
+
+ private String tail_content;
+
+ private List list;
+
+ public String getHead_content() {
+ return head_content;
+ }
+
+ public void setHead_content(String head_content) {
+ this.head_content = head_content;
+ }
+
+ public String getTail_content() {
+ return tail_content;
+ }
+
+ public void setTail_content(String tail_content) {
+ this.tail_content = tail_content;
+ }
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+
+ }
+
+ public static class MenuOption {
+ private String id;
+ private String content;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ }
+}
diff --git a/src/main/java/weixin/popular/bean/message/message/NewsMessage.java b/src/main/java/weixin/popular/bean/message/message/NewsMessage.java
index 9df82860..8f19d3b3 100644
--- a/src/main/java/weixin/popular/bean/message/message/NewsMessage.java
+++ b/src/main/java/weixin/popular/bean/message/message/NewsMessage.java
@@ -1,10 +1,11 @@
package weixin.popular.bean.message.message;
+import java.util.Collections;
import java.util.List;
/**
- * 图文消息
- * 图文消息条数限制在10条以内,注意,如果图文数超过10,则将会无响应。
+ * 发送图文消息(点击跳转到外链)
+ * 图文消息条数限制在1条以内,注意,如果图文数超过1,则将会返回错误码45008。
*
* @author LiYi
*/
@@ -18,6 +19,17 @@ public NewsMessage(String touser, List articles) {
this.news = new News();
this.news.setArticles(articles);
}
+
+ /**
+ * @since 2.8.26
+ * @param touser
+ * @param article
+ */
+ public NewsMessage(String touser, Article article) {
+ super(touser, "news");
+ this.news = new News();
+ this.news.setArticles(Collections.singletonList(article));
+ }
private News news;
diff --git a/src/main/java/weixin/popular/bean/xmlmessage/XMLNewsMessage.java b/src/main/java/weixin/popular/bean/xmlmessage/XMLNewsMessage.java
index 336574e7..051e827e 100644
--- a/src/main/java/weixin/popular/bean/xmlmessage/XMLNewsMessage.java
+++ b/src/main/java/weixin/popular/bean/xmlmessage/XMLNewsMessage.java
@@ -1,6 +1,7 @@
package weixin.popular.bean.xmlmessage;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import weixin.popular.bean.message.message.Message;
@@ -24,6 +25,20 @@ public XMLNewsMessage(String toUserName, String fromUserName, List arti
super(toUserName, fromUserName, "news");
this.articles = articles;
}
+
+ /**
+ * @since 2.8.26
+ * @param toUserName
+ * toUserName
+ * @param fromUserName
+ * fromUserName
+ * @param article
+ * article
+ */
+ public XMLNewsMessage(String toUserName, String fromUserName, Article article) {
+ super(toUserName, fromUserName, "news");
+ this.articles = Collections.singletonList(article);
+ }
@Override
public String subXML() {