公众号:调整客服接口的方法名 & 新增二维码接口获取二维码url方法
This commit is contained in:
parent
8995196b8d
commit
e89e988c62
@ -247,3 +247,9 @@
|
|||||||
+ **weixin4j-mp**: <font color="red">调整[二维码参数](./weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/model/QRParameter.java)类</font>
|
+ **weixin4j-mp**: <font color="red">调整[二维码参数](./weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/model/QRParameter.java)类</font>
|
||||||
|
|
||||||
+ **weixin4j-mp**: 新增获取[自定义菜单配置、自动回复配置](./weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/api/HelperApi.java)接口
|
+ **weixin4j-mp**: 新增获取[自定义菜单配置、自动回复配置](./weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/api/HelperApi.java)接口
|
||||||
|
|
||||||
|
* 2015-04-18
|
||||||
|
|
||||||
|
+ **weixin4j-mp**: <font color="red">调整[客服接口](./weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/api/CustomApi.java)类的方法名</font>
|
||||||
|
|
||||||
|
+ **weixin4j-mp**: <font color="red">在[二维码接口](./weixin4j-mp/weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/api/QRApi.java)类新增获取二维码url方法</font>
|
||||||
@ -71,6 +71,10 @@ netty的代码没有放到maven中心仓库,也没什么意义,因为最终需
|
|||||||
|
|
||||||
接下来
|
接下来
|
||||||
------
|
------
|
||||||
|
* 被动消息服务重构
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
* 公众号第三方服务应用
|
* 公众号第三方服务应用
|
||||||
|
|
||||||
* 企业号第三方应用 & 企业号登陆授权
|
* 企业号第三方应用 & 企业号登陆授权
|
||||||
@ -80,5 +84,3 @@ netty的代码没有放到maven中心仓库,也没什么意义,因为最终需
|
|||||||
* 微信小店
|
* 微信小店
|
||||||
|
|
||||||
* 微信卡券
|
* 微信卡券
|
||||||
|
|
||||||

|
|
||||||
@ -220,6 +220,12 @@ weixin4j-mp
|
|||||||
|
|
||||||
* 2015-04-16
|
* 2015-04-16
|
||||||
|
|
||||||
+ **weixin4j-mp**: <font color="red">调整[二维码参数](./weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/model/QRParameter.java)类</font>
|
+ **weixin4j-mp-api**: <font color="red">调整[二维码参数](./weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/model/QRParameter.java)类</font>
|
||||||
|
|
||||||
+ **weixin4j-mp**: 新增获取[自定义菜单配置、自动回复配置](./weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/api/HelperApi.java)接口
|
+ **weixin4j-mp-api**: 新增获取[自定义菜单配置、自动回复配置](./weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/api/HelperApi.java)接口
|
||||||
|
|
||||||
|
* 2015-04-18
|
||||||
|
|
||||||
|
+ **weixin4j-mp-api**: <font color="red">调整[客服接口](./weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/api/CustomApi.java)类的方法名</font>
|
||||||
|
|
||||||
|
+ **weixin4j-mp-api**: <font color="red">在[二维码接口](./weixin4j-mp-api/src/main/java/com/foxinmy/weixin4j/mp/api/QRApi.java)类新增获取二维码url方法</font>
|
||||||
@ -198,3 +198,9 @@ weixin.properties说明
|
|||||||
+ **weixin4j-mp-api**: <font color="red">调整[二维码参数](./src/main/java/com/foxinmy/weixin4j/mp/model/QRParameter.java)类</font>
|
+ **weixin4j-mp-api**: <font color="red">调整[二维码参数](./src/main/java/com/foxinmy/weixin4j/mp/model/QRParameter.java)类</font>
|
||||||
|
|
||||||
+ **weixin4j-mp-api**: 新增获取[自定义菜单配置、自动回复配置](./src/main/java/com/foxinmy/weixin4j/mp/api/HelperApi.java)接口
|
+ **weixin4j-mp-api**: 新增获取[自定义菜单配置、自动回复配置](./src/main/java/com/foxinmy/weixin4j/mp/api/HelperApi.java)接口
|
||||||
|
|
||||||
|
* 2015-04-18
|
||||||
|
|
||||||
|
+ <font color="red">调整[客服接口](./src/main/java/com/foxinmy/weixin4j/mp/api/CustomApi.java)类的方法名</font>
|
||||||
|
|
||||||
|
+ <font color="red">在[二维码接口](./src/main/java/com/foxinmy/weixin4j/mp/api/QRApi.java)类新增获取二维码url方法</font>
|
||||||
@ -28,6 +28,7 @@ import com.foxinmy.weixin4j.mp.model.Group;
|
|||||||
import com.foxinmy.weixin4j.mp.model.KfAccount;
|
import com.foxinmy.weixin4j.mp.model.KfAccount;
|
||||||
import com.foxinmy.weixin4j.mp.model.KfSession;
|
import com.foxinmy.weixin4j.mp.model.KfSession;
|
||||||
import com.foxinmy.weixin4j.mp.model.MediaCounter;
|
import com.foxinmy.weixin4j.mp.model.MediaCounter;
|
||||||
|
import com.foxinmy.weixin4j.mp.model.MediaItem;
|
||||||
import com.foxinmy.weixin4j.mp.model.MediaRecord;
|
import com.foxinmy.weixin4j.mp.model.MediaRecord;
|
||||||
import com.foxinmy.weixin4j.mp.model.MenuSetting;
|
import com.foxinmy.weixin4j.mp.model.MenuSetting;
|
||||||
import com.foxinmy.weixin4j.mp.model.QRParameter;
|
import com.foxinmy.weixin4j.mp.model.QRParameter;
|
||||||
@ -87,6 +88,7 @@ public class WeixinProxy {
|
|||||||
/**
|
/**
|
||||||
* TokenHolder对象
|
* TokenHolder对象
|
||||||
*
|
*
|
||||||
|
* @see com.foxinmy.weixin4j.token.TokenHolder
|
||||||
* @param tokenHolder
|
* @param tokenHolder
|
||||||
*/
|
*/
|
||||||
public WeixinProxy(TokenHolder tokenHolder) {
|
public WeixinProxy(TokenHolder tokenHolder) {
|
||||||
@ -342,6 +344,21 @@ public class WeixinProxy {
|
|||||||
return mediaApi.listMaterialMedia(mediaType, offset, count);
|
return mediaApi.listMaterialMedia(mediaType, offset, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部的媒体素材
|
||||||
|
*
|
||||||
|
* @param mediaType
|
||||||
|
* 媒体类型
|
||||||
|
* @return 素材列表
|
||||||
|
* @see com.foxinmy.weixin4j.mp.api.MediaApi
|
||||||
|
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#listMaterialMedia(MediaType, int, int)}
|
||||||
|
* @throws WeixinException
|
||||||
|
*/
|
||||||
|
public List<MediaItem> listAllMaterialMedia(MediaType mediaType)
|
||||||
|
throws WeixinException {
|
||||||
|
return mediaApi.listAllMaterialMedia(mediaType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送客服消息(在48小时内不限制发送次数)
|
* 发送客服消息(在48小时内不限制发送次数)
|
||||||
*
|
*
|
||||||
@ -389,7 +406,7 @@ public class WeixinProxy {
|
|||||||
* @param endtime
|
* @param endtime
|
||||||
* 查询结束时间 每次查询不能跨日查询
|
* 查询结束时间 每次查询不能跨日查询
|
||||||
* @param pagesize
|
* @param pagesize
|
||||||
* 每页大小 每页最多拉取1000条
|
* 每页大小 每页最多拉取50条
|
||||||
* @param pageindex
|
* @param pageindex
|
||||||
* 查询第几页 从1开始
|
* 查询第几页 从1开始
|
||||||
* @see com.foxinmy.weixin4j.mp.model.CustomRecord
|
* @see com.foxinmy.weixin4j.mp.model.CustomRecord
|
||||||
@ -512,7 +529,7 @@ public class WeixinProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建会话
|
* 创建客服会话
|
||||||
* <p>
|
* <p>
|
||||||
* 开发者可以使用本接口,为多客服的客服工号创建会话,将某个客户直接指定给客服工号接待,需要注意此接口不会受客服自动接入数以及自动接入开关限制。
|
* 开发者可以使用本接口,为多客服的客服工号创建会话,将某个客户直接指定给客服工号接待,需要注意此接口不会受客服自动接入数以及自动接入开关限制。
|
||||||
* 只能为在线的客服(PC客户端在线,或者已绑定多客服助手)创建会话。
|
* 只能为在线的客服(PC客户端在线,或者已绑定多客服助手)创建会话。
|
||||||
@ -530,13 +547,13 @@ public class WeixinProxy {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.88.9B.E5.BB.BA.E4.BC.9A.E8.AF.9D">创建会话</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.88.9B.E5.BB.BA.E4.BC.9A.E8.AF.9D">创建会话</a>
|
||||||
*/
|
*/
|
||||||
public JsonResult createSession(String userOpenId, String kfAccount,
|
public JsonResult createKfSession(String userOpenId, String kfAccount,
|
||||||
String text) throws WeixinException {
|
String text) throws WeixinException {
|
||||||
return customApi.createSession(userOpenId, kfAccount, text);
|
return customApi.createKfSession(userOpenId, kfAccount, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭会话
|
* 关闭客服会话
|
||||||
*
|
*
|
||||||
* @param userOpenId
|
* @param userOpenId
|
||||||
* 用户的userOpenId
|
* 用户的userOpenId
|
||||||
@ -550,9 +567,9 @@ public class WeixinProxy {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.85.B3.E9.97.AD.E4.BC.9A.E8.AF.9D">创建会话</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.85.B3.E9.97.AD.E4.BC.9A.E8.AF.9D">创建会话</a>
|
||||||
*/
|
*/
|
||||||
public JsonResult closeSession(String userOpenId, String kfAccount,
|
public JsonResult closeKfSession(String userOpenId, String kfAccount,
|
||||||
String text) throws WeixinException {
|
String text) throws WeixinException {
|
||||||
return customApi.closeSession(userOpenId, kfAccount, text);
|
return customApi.closeKfSession(userOpenId, kfAccount, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -567,8 +584,8 @@ public class WeixinProxy {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.88.B7.E7.9A.84.E4.BC.9A.E8.AF.9D.E7.8A.B6.E6.80.81">获取会话状态</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.88.B7.E7.9A.84.E4.BC.9A.E8.AF.9D.E7.8A.B6.E6.80.81">获取会话状态</a>
|
||||||
*/
|
*/
|
||||||
public KfSession getSession(String userOpenId) throws WeixinException {
|
public KfSession getKfSession(String userOpenId) throws WeixinException {
|
||||||
return customApi.getSession(userOpenId);
|
return customApi.getKfSession(userOpenId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -583,9 +600,9 @@ public class WeixinProxy {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.9C.8D.E7.9A.84.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.9C.8D.E7.9A.84.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
||||||
*/
|
*/
|
||||||
public List<KfSession> getSessionList(String kfAccount)
|
public List<KfSession> getKfSessionList(String kfAccount)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
return customApi.getSessionList(kfAccount);
|
return customApi.getKfSessionList(kfAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -599,12 +616,12 @@ public class WeixinProxy {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E6.9C.AA.E6.8E.A5.E5.85.A5.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E6.9C.AA.E6.8E.A5.E5.85.A5.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
||||||
*/
|
*/
|
||||||
public List<KfSession> getSessionWaitList() throws WeixinException {
|
public List<KfSession> getKfSessionWaitList() throws WeixinException {
|
||||||
return customApi.getSessionWaitList();
|
return customApi.getKfSessionWaitList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传图文消息,一个图文消息支持1到10条图文
|
* 上传群发的图文消息,一个图文消息支持1到10条图文
|
||||||
*
|
*
|
||||||
* @param articles
|
* @param articles
|
||||||
* 图片消息
|
* 图片消息
|
||||||
@ -615,7 +632,7 @@ public class WeixinProxy {
|
|||||||
* @see com.foxinmy.weixin4j.msg.model.MpArticle
|
* @see com.foxinmy.weixin4j.msg.model.MpArticle
|
||||||
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
||||||
*/
|
*/
|
||||||
public String uploadArticle(List<MpArticle> articles)
|
public String uploadMassArticle(List<MpArticle> articles)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
return massApi.uploadArticle(articles);
|
return massApi.uploadArticle(articles);
|
||||||
}
|
}
|
||||||
@ -635,7 +652,7 @@ public class WeixinProxy {
|
|||||||
* @see com.foxinmy.weixin4j.msg.model.MpVideo
|
* @see com.foxinmy.weixin4j.msg.model.MpVideo
|
||||||
* @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#uploadMedia(File)}
|
* @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#uploadMedia(File)}
|
||||||
*/
|
*/
|
||||||
public String uploadVideo(Video video) throws WeixinException {
|
public String uploadMassVideo(Video video) throws WeixinException {
|
||||||
return massApi.uploadVideo(video);
|
return massApi.uploadVideo(video);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -958,7 +975,6 @@ public class WeixinProxy {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html#.E4.BF.AE.E6.94.B9.E5.88.86.E7.BB.84.E5.90.8D">修改分组名</a>
|
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html#.E4.BF.AE.E6.94.B9.E5.88.86.E7.BB.84.E5.90.8D">修改分组名</a>
|
||||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||||
* @see com.foxinmy.weixin4j.mp.model.Group#toModifyJson()
|
|
||||||
* @see com.foxinmy.weixin4j.mp.api.GroupApi
|
* @see com.foxinmy.weixin4j.mp.api.GroupApi
|
||||||
*/
|
*/
|
||||||
public JsonResult modifyGroup(int groupId, String name)
|
public JsonResult modifyGroup(int groupId, String name)
|
||||||
@ -1067,6 +1083,7 @@ public class WeixinProxy {
|
|||||||
* 二维码参数
|
* 二维码参数
|
||||||
* @return byte数据包
|
* @return byte数据包
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
|
* @see com.foxinmy.weixin4j.mp.model.QRParameter
|
||||||
* @see com.foxinmy.weixin4j.mp.api.QrApi
|
* @see com.foxinmy.weixin4j.mp.api.QrApi
|
||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">生成二维码</a>
|
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">生成二维码</a>
|
||||||
@ -1077,21 +1094,24 @@ public class WeixinProxy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成带参数的二维码
|
* 生成带参数的二维码
|
||||||
* <p>
|
|
||||||
* 二维码分为临时跟永久两种,扫描时触发推送带参数事件
|
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param parameter
|
* @return 二维码图片解析后的地址 开发者可根据该地址自行生成需要的二维码图片
|
||||||
* 二维码参数
|
* @throws WeixinException
|
||||||
|
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#getQRData(QRParameter)}
|
||||||
|
*/
|
||||||
|
public String getQRUrl(QRParameter parameter) throws WeixinException {
|
||||||
|
return qrApi.getQRUrl(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成带参数的二维码
|
||||||
|
*
|
||||||
* @return 硬盘存储的文件对象
|
* @return 硬盘存储的文件对象
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see <a
|
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#getQRData(QRParameter)}
|
||||||
* href="mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">二维码</a>
|
|
||||||
* @see com.foxinmy.weixin4j.mp.model.QRParameter
|
|
||||||
* @see com.foxinmy.weixin4j.mp.api.QrApi
|
|
||||||
*/
|
*/
|
||||||
public File getQR(QRParameter parameter) throws WeixinException {
|
public File getQRFile(QRParameter parameter) throws WeixinException {
|
||||||
return qrApi.getQR(parameter);
|
return qrApi.getQRFile(parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -244,7 +244,7 @@ public class CustomApi extends MpApi {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.88.9B.E5.BB.BA.E4.BC.9A.E8.AF.9D">创建会话</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.88.9B.E5.BB.BA.E4.BC.9A.E8.AF.9D">创建会话</a>
|
||||||
*/
|
*/
|
||||||
public JsonResult createSession(String userOpenId, String kfAccount,
|
public JsonResult createKfSession(String userOpenId, String kfAccount,
|
||||||
String text) throws WeixinException {
|
String text) throws WeixinException {
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
String kfsession_create_uri = getRequestUri("kfsession_create_uri");
|
String kfsession_create_uri = getRequestUri("kfsession_create_uri");
|
||||||
@ -273,7 +273,7 @@ public class CustomApi extends MpApi {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.85.B3.E9.97.AD.E4.BC.9A.E8.AF.9D">创建会话</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.85.B3.E9.97.AD.E4.BC.9A.E8.AF.9D">创建会话</a>
|
||||||
*/
|
*/
|
||||||
public JsonResult closeSession(String userOpenId, String kfAccount,
|
public JsonResult closeKfSession(String userOpenId, String kfAccount,
|
||||||
String text) throws WeixinException {
|
String text) throws WeixinException {
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
String kfsession_close_uri = getRequestUri("kfsession_close_uri");
|
String kfsession_close_uri = getRequestUri("kfsession_close_uri");
|
||||||
@ -299,7 +299,7 @@ public class CustomApi extends MpApi {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.88.B7.E7.9A.84.E4.BC.9A.E8.AF.9D.E7.8A.B6.E6.80.81">获取会话状态</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.88.B7.E7.9A.84.E4.BC.9A.E8.AF.9D.E7.8A.B6.E6.80.81">获取会话状态</a>
|
||||||
*/
|
*/
|
||||||
public KfSession getSession(String userOpenId) throws WeixinException {
|
public KfSession getKfSession(String userOpenId) throws WeixinException {
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
String kfsession_get_uri = getRequestUri("kfsession_get_uri");
|
String kfsession_get_uri = getRequestUri("kfsession_get_uri");
|
||||||
Response response = request.get(String.format(kfsession_get_uri,
|
Response response = request.get(String.format(kfsession_get_uri,
|
||||||
@ -323,7 +323,7 @@ public class CustomApi extends MpApi {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.9C.8D.E7.9A.84.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.9C.8D.E7.9A.84.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
||||||
*/
|
*/
|
||||||
public List<KfSession> getSessionList(String kfAccount)
|
public List<KfSession> getKfSessionList(String kfAccount)
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
String kfsession_list_uri = getRequestUri("kfsession_list_uri");
|
String kfsession_list_uri = getRequestUri("kfsession_list_uri");
|
||||||
@ -344,7 +344,7 @@ public class CustomApi extends MpApi {
|
|||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E6.9C.AA.E6.8E.A5.E5.85.A5.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E8.8E.B7.E5.8F.96.E6.9C.AA.E6.8E.A5.E5.85.A5.E4.BC.9A.E8.AF.9D.E5.88.97.E8.A1.A8">获取客服的会话列表</a>
|
||||||
*/
|
*/
|
||||||
public List<KfSession> getSessionWaitList() throws WeixinException {
|
public List<KfSession> getKfSessionWaitList() throws WeixinException {
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
String kfsession_wait_uri = getRequestUri("kfsession_wait_uri");
|
String kfsession_wait_uri = getRequestUri("kfsession_wait_uri");
|
||||||
Response response = request.get(String.format(kfsession_wait_uri,
|
Response response = request.get(String.format(kfsession_wait_uri,
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -423,8 +424,8 @@ public class MediaApi extends MpApi {
|
|||||||
obj.toJSONString());
|
obj.toJSONString());
|
||||||
MediaRecord mediaRecord = null;
|
MediaRecord mediaRecord = null;
|
||||||
if (mediaType == MediaType.news) {
|
if (mediaType == MediaType.news) {
|
||||||
mediaRecord = JSON.parseObject(response.getAsString(), MediaRecord.class,
|
mediaRecord = JSON.parseObject(response.getAsString(),
|
||||||
new ExtraProcessor() {
|
MediaRecord.class, new ExtraProcessor() {
|
||||||
@Override
|
@Override
|
||||||
public void processExtra(Object object, String key,
|
public void processExtra(Object object, String key,
|
||||||
Object value) {
|
Object value) {
|
||||||
@ -444,4 +445,30 @@ public class MediaApi extends MpApi {
|
|||||||
mediaRecord.setMediaType(mediaType);
|
mediaRecord.setMediaType(mediaType);
|
||||||
return mediaRecord;
|
return mediaRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部的媒体素材
|
||||||
|
*
|
||||||
|
* @param mediaType
|
||||||
|
* 媒体类型
|
||||||
|
* @return 素材列表
|
||||||
|
* @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#listMaterialMedia(MediaType, int, int)}
|
||||||
|
* @throws WeixinException
|
||||||
|
*/
|
||||||
|
public List<MediaItem> listAllMaterialMedia(MediaType mediaType)
|
||||||
|
throws WeixinException {
|
||||||
|
int offset = 0;
|
||||||
|
int count = 20;
|
||||||
|
List<MediaItem> mediaList = new ArrayList<MediaItem>();
|
||||||
|
MediaRecord mediaRecord = null;
|
||||||
|
for (;;) {
|
||||||
|
mediaRecord = listMaterialMedia(mediaType, offset, count);
|
||||||
|
mediaList.addAll(mediaRecord.getItems());
|
||||||
|
if (offset >= mediaRecord.getTotalCount()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
offset += count;
|
||||||
|
}
|
||||||
|
return mediaList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||||
import com.foxinmy.weixin4j.http.Response;
|
import com.foxinmy.weixin4j.http.Response;
|
||||||
import com.foxinmy.weixin4j.model.Token;
|
import com.foxinmy.weixin4j.model.Token;
|
||||||
@ -35,20 +36,39 @@ public class QrApi extends MpApi {
|
|||||||
*
|
*
|
||||||
* @param parameter
|
* @param parameter
|
||||||
* 二维码参数
|
* 二维码参数
|
||||||
* @return byte数据包
|
* @return 二维码图片解析后的地址 开发者可根据该地址自行生成需要的二维码图片
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see <a
|
* @see <a
|
||||||
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">生成二维码</a>
|
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">生成二维码</a>
|
||||||
*/
|
*/
|
||||||
public byte[] getQRData(QRParameter parameter) throws WeixinException {
|
public String getQRUrl(QRParameter parameter) throws WeixinException {
|
||||||
|
return doQR(parameter).getString("url");
|
||||||
|
}
|
||||||
|
|
||||||
|
private JSONObject doQR(QRParameter parameter) throws WeixinException {
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
String qr_uri = getRequestUri("qr_ticket_uri");
|
String qr_uri = getRequestUri("qr_ticket_uri");
|
||||||
Response response = request.post(
|
Response response = request.post(
|
||||||
String.format(qr_uri, token.getAccessToken()),
|
String.format(qr_uri, token.getAccessToken()),
|
||||||
parameter.getContent());
|
parameter.getContent());
|
||||||
String ticket = response.getAsJson().getString("ticket");
|
return response.getAsJson();
|
||||||
qr_uri = getRequestUri("qr_image_uri");
|
}
|
||||||
response = request.get(String.format(qr_uri, ticket));
|
|
||||||
|
/**
|
||||||
|
* 生成带参数的二维码
|
||||||
|
*
|
||||||
|
* @param parameter
|
||||||
|
* 二维码参数
|
||||||
|
* @return byte数据包
|
||||||
|
* @throws WeixinException
|
||||||
|
* @see com.foxinmy.weixin4j.mp.model.QRParameter
|
||||||
|
* @see <a
|
||||||
|
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">生成二维码</a>
|
||||||
|
*/
|
||||||
|
public byte[] getQRData(QRParameter parameter) throws WeixinException {
|
||||||
|
String ticket = doQR(parameter).getString("ticket");
|
||||||
|
String qr_uri = getRequestUri("qr_image_uri");
|
||||||
|
Response response = request.get(String.format(qr_uri, ticket));
|
||||||
|
|
||||||
return response.getBody();
|
return response.getBody();
|
||||||
}
|
}
|
||||||
@ -67,7 +87,7 @@ public class QrApi extends MpApi {
|
|||||||
* href="mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">二维码</a>
|
* href="mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">二维码</a>
|
||||||
* @see com.foxinmy.weixin4j.mp.model.QRParameter
|
* @see com.foxinmy.weixin4j.mp.model.QRParameter
|
||||||
*/
|
*/
|
||||||
public File getQR(QRParameter parameter) throws WeixinException {
|
public File getQRFile(QRParameter parameter) throws WeixinException {
|
||||||
String qr_path = ConfigUtil.getValue("qr_path");
|
String qr_path = ConfigUtil.getValue("qr_path");
|
||||||
String filename = String.format("%s_%s_%d.jpg", parameter.getQrType()
|
String filename = String.format("%s_%s_%d.jpg", parameter.getQrType()
|
||||||
.name(), parameter.getSceneValue(), parameter
|
.name(), parameter.getSceneValue(), parameter
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.foxinmy.weixin4j.exception.WeixinException;
|
|||||||
import com.foxinmy.weixin4j.http.JsonResult;
|
import com.foxinmy.weixin4j.http.JsonResult;
|
||||||
import com.foxinmy.weixin4j.mp.api.MediaApi;
|
import com.foxinmy.weixin4j.mp.api.MediaApi;
|
||||||
import com.foxinmy.weixin4j.mp.model.MediaCounter;
|
import com.foxinmy.weixin4j.mp.model.MediaCounter;
|
||||||
|
import com.foxinmy.weixin4j.mp.model.MediaItem;
|
||||||
import com.foxinmy.weixin4j.mp.model.MediaRecord;
|
import com.foxinmy.weixin4j.mp.model.MediaRecord;
|
||||||
import com.foxinmy.weixin4j.msg.model.MpArticle;
|
import com.foxinmy.weixin4j.msg.model.MpArticle;
|
||||||
import com.foxinmy.weixin4j.type.MediaType;
|
import com.foxinmy.weixin4j.type.MediaType;
|
||||||
@ -128,4 +129,10 @@ public class MediaTest extends TokenTest {
|
|||||||
20);
|
20);
|
||||||
System.err.println(mediaRecord);
|
System.err.println(mediaRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void listAllMaterialMedia() throws WeixinException {
|
||||||
|
List<MediaItem> mediaList = mediaApi.listAllMaterialMedia(MediaType.image);
|
||||||
|
System.err.println(mediaList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,19 +29,19 @@ public class QRTest extends TokenTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void temp_qr() throws WeixinException, IOException {
|
public void temp_qr() throws WeixinException, IOException {
|
||||||
File file = qrApi.getQR(QRParameter.createTemporary(1200, 1200));
|
File file = qrApi.getQRFile(QRParameter.createTemporary(1200, 1200));
|
||||||
Assert.assertTrue(file.exists());
|
Assert.assertTrue(file.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void forever_qr_int() throws WeixinException, IOException {
|
public void forever_qr_int() throws WeixinException, IOException {
|
||||||
File file = qrApi.getQR(QRParameter.createPermanenceInt(1200));
|
File file = qrApi.getQRFile(QRParameter.createPermanenceInt(1200));
|
||||||
Assert.assertTrue(file.exists());
|
Assert.assertTrue(file.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void forever_qr_str() throws WeixinException, IOException {
|
public void forever_qr_str() throws WeixinException, IOException {
|
||||||
File file = qrApi.getQR(QRParameter.createPermanenceStr("1200中文"));
|
File file = qrApi.getQRFile(QRParameter.createPermanenceStr("1200中文"));
|
||||||
Assert.assertTrue(file.exists());
|
Assert.assertTrue(file.exists());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,14 +88,14 @@ public class CustomTest extends TokenTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createSession() throws WeixinException {
|
public void createSession() throws WeixinException {
|
||||||
JsonResult result = customApi.createSession(
|
JsonResult result = customApi.createKfSession(
|
||||||
"opKwyt6IhrqPmTTZshyqH5W9gIVo", "kfAccount", "text");
|
"opKwyt6IhrqPmTTZshyqH5W9gIVo", "kfAccount", "text");
|
||||||
Assert.assertEquals(0, result.getCode());
|
Assert.assertEquals(0, result.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void closeSession() throws WeixinException {
|
public void closeSession() throws WeixinException {
|
||||||
JsonResult result = customApi.closeSession(
|
JsonResult result = customApi.closeKfSession(
|
||||||
"opKwyt6IhrqPmTTZshyqH5W9gIVo", "kfAccount", "text");
|
"opKwyt6IhrqPmTTZshyqH5W9gIVo", "kfAccount", "text");
|
||||||
Assert.assertEquals(0, result.getCode());
|
Assert.assertEquals(0, result.getCode());
|
||||||
}
|
}
|
||||||
@ -103,19 +103,19 @@ public class CustomTest extends TokenTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getSession() throws WeixinException {
|
public void getSession() throws WeixinException {
|
||||||
KfSession session = customApi
|
KfSession session = customApi
|
||||||
.getSession("oz5axuNnJim8yTYs_jzE1bWFj9eA");
|
.getKfSession("oz5axuNnJim8yTYs_jzE1bWFj9eA");
|
||||||
System.err.println(session);
|
System.err.println(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSessionList() throws WeixinException {
|
public void getSessionList() throws WeixinException {
|
||||||
List<KfSession> sessionList = customApi.getSessionList("kfAccount");
|
List<KfSession> sessionList = customApi.getKfSessionList("kfAccount");
|
||||||
System.err.println(sessionList);
|
System.err.println(sessionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSessionWaitList() throws WeixinException {
|
public void getSessionWaitList() throws WeixinException {
|
||||||
List<KfSession> sessionList = customApi.getSessionWaitList();
|
List<KfSession> sessionList = customApi.getKfSessionWaitList();
|
||||||
System.err.println(sessionList);
|
System.err.println(sessionList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,6 +74,7 @@ public class WeixinProxy {
|
|||||||
/**
|
/**
|
||||||
* TokenHolder对象
|
* TokenHolder对象
|
||||||
*
|
*
|
||||||
|
* @see com.foxinmy.weixin4j.token.TokenHolder
|
||||||
* @param tokenHolder
|
* @param tokenHolder
|
||||||
*/
|
*/
|
||||||
public WeixinProxy(TokenHolder tokenHolder) {
|
public WeixinProxy(TokenHolder tokenHolder) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user