修正方法上@see注解的文档链接,新增群发消息状态查看、预览接口,新增多客服的账号新增、删除、更新、上传头像接口
This commit is contained in:
@@ -123,4 +123,12 @@ weixin.properties说明
|
||||
|
||||
* 2014-12-12
|
||||
|
||||
+ 新增设置`模板消息所处行业`、`获取模板消息ID`接口
|
||||
+ 新增设置`模板消息所处行业`、`获取模板消息ID`接口
|
||||
|
||||
* 2014-12-16
|
||||
|
||||
+ 调整方法上@see注解的文档说明接口url
|
||||
|
||||
+ 新增群发消息预览、状态查询接口
|
||||
|
||||
+ 新增多客服添加账号、更新账号、上传头像、删除账号接口
|
||||
+196
-41
@@ -40,6 +40,7 @@ import com.foxinmy.weixin4j.mp.payment.v2.Order;
|
||||
import com.foxinmy.weixin4j.mp.type.BillType;
|
||||
import com.foxinmy.weixin4j.mp.type.IdQuery;
|
||||
import com.foxinmy.weixin4j.mp.type.IndustryType;
|
||||
import com.foxinmy.weixin4j.mp.type.Lang;
|
||||
import com.foxinmy.weixin4j.msg.model.Base;
|
||||
import com.foxinmy.weixin4j.msg.model.MpArticle;
|
||||
import com.foxinmy.weixin4j.msg.model.Video;
|
||||
@@ -92,7 +93,8 @@ public class WeixinProxy {
|
||||
/**
|
||||
* WeixinAccount对象
|
||||
*
|
||||
* @param weixinAccount 微信账户
|
||||
* @param weixinAccount
|
||||
* 微信账户
|
||||
*/
|
||||
public WeixinProxy(WeixinMpAccount weixinAccount) {
|
||||
this(new FileTokenHolder(weixinAccount));
|
||||
@@ -164,7 +166,7 @@ public class WeixinProxy {
|
||||
* 媒体类型
|
||||
* @return 上传到微信服务器返回的媒体标识
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E4%B8%8B%E8%BD%BD%E5%A4%9A%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6">上传下载说明</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html">上传下载说明</a>
|
||||
* @see com.foxinmy.weixin4j.mp.api.MediaApi
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@@ -187,7 +189,7 @@ public class WeixinProxy {
|
||||
* @throws WeixinException
|
||||
* @throws IOException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E4%B8%8B%E8%BD%BD%E5%A4%9A%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6">上传下载说明</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html">上传下载说明</a>
|
||||
* @see com.foxinmy.weixin4j.type.MediaType
|
||||
* @see com.foxinmy.weixin4j.mp.api.MediaApi
|
||||
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#downloadMedia(String)}
|
||||
@@ -205,6 +207,8 @@ public class WeixinProxy {
|
||||
* @return 二进制数据包
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.api.MediaApi
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html">上传下载说明</a>
|
||||
*/
|
||||
public byte[] downloadMedia(String mediaId) throws WeixinException {
|
||||
return mediaApi.downloadMedia(mediaId);
|
||||
@@ -217,7 +221,7 @@ public class WeixinProxy {
|
||||
* 客服消息对象
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%8F%91%E9%80%81%E5%AE%A2%E6%9C%8D%E6%B6%88%E6%81%AF">发送客服消息</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html">发送客服消息</a>
|
||||
* @see com.foxinmy.weixin4j.msg.model.Text
|
||||
* @see com.foxinmy.weixin4j.msg.model.Image
|
||||
* @see com.foxinmy.weixin4j.msg.model.Voice
|
||||
@@ -247,7 +251,7 @@ public class WeixinProxy {
|
||||
* @see com.foxinmy.weixin4j.mp.api.CustomApi
|
||||
* @see <a href="http://dkf.qq.com/document-1_1.html">查询客服聊天记录</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%AE%A2%E6%9C%8D%E8%81%8A%E5%A4%A9%E8%AE%B0%E5%BD%95">查询客服聊天记录</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/19/7c129ec71ddfa60923ea9334557e8b23.html">查询客服聊天记录</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<CustomRecord> getCustomRecord(String openId, Date starttime,
|
||||
@@ -266,7 +270,11 @@ public class WeixinProxy {
|
||||
* @see com.foxinmy.weixin4j.mp.model.KfAccount
|
||||
* @see com.foxinmy.weixin4j.mp.api.CustomApi
|
||||
* @see <a href="http://dkf.qq.com/document-3_1.html">获取客服基本信息</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.9C.8D.E5.9F.BA.E6.9C.AC.E4.BF.A1.E6.81.AF">获取客服基本信息</a>
|
||||
* @see <a href="http://dkf.qq.com/document-3_2.html">获取在线客服接待信息</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E8.8E.B7.E5.8F.96.E5.9C.A8.E7.BA.BF.E5.AE.A2.E6.9C.8D.E6.8E.A5.E5.BE.85.E4.BF.A1.E6.81.AF">获取在线客服接待信息</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<KfAccount> getKfAccountList(boolean isOnline)
|
||||
@@ -274,6 +282,90 @@ public class WeixinProxy {
|
||||
return customApi.getKfAccountList(isOnline);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增客服账号
|
||||
*
|
||||
* @param id
|
||||
* 完整客服账号,格式为:账号前缀@公众号微信号,账号前缀最多10个字符,必须是英文或者数字字符。如果没有公众号微信号,
|
||||
* 请前往微信公众平台设置。
|
||||
* @param name
|
||||
* 客服昵称,最长6个汉字或12个英文字符
|
||||
* @param pwd
|
||||
* 客服账号登录密码
|
||||
* @return 处理结果
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.api.CustomApi
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E5.AE.A2.E6.9C.8D.E7.AE.A1.E7.90.86.E6.8E.A5.E5.8F.A3.E8.BF.94.E5.9B.9E.E7.A0.81.E8.AF.B4.E6.98.8E">客服管理接口返回码</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E6.B7.BB.E5.8A.A0.E5.AE.A2.E6.9C.8D.E8.B4.A6.E5.8F.B7">新增客服账号</a>
|
||||
*/
|
||||
public JsonResult addAccount(String id, String name, String pwd)
|
||||
throws WeixinException {
|
||||
return customApi.addAccount(id, name, pwd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新客服账号
|
||||
*
|
||||
* @param id
|
||||
* 完整客服账号,格式为:账号前缀@公众号微信号,账号前缀最多10个字符,必须是英文或者数字字符。如果没有公众号微信号,
|
||||
* 请前往微信公众平台设置。
|
||||
* @param name
|
||||
* 客服昵称,最长6个汉字或12个英文字符
|
||||
* @param pwd
|
||||
* 客服账号登录密码
|
||||
* @return 处理结果
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.api.CustomApi
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E5.AE.A2.E6.9C.8D.E7.AE.A1.E7.90.86.E6.8E.A5.E5.8F.A3.E8.BF.94.E5.9B.9E.E7.A0.81.E8.AF.B4.E6.98.8E">客服管理接口返回码</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E8.AE.BE.E7.BD.AE.E5.AE.A2.E6.9C.8D.E4.BF.A1.E6.81.AF">新增客服账号</a>
|
||||
*/
|
||||
public JsonResult updateAccount(String id, String name, String pwd)
|
||||
throws WeixinException {
|
||||
return customApi.updateAccount(id, name, pwd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传客服头像
|
||||
*
|
||||
* @param id
|
||||
* 完整客服账号,格式为:账号前缀@公众号微信号
|
||||
* @param headimg
|
||||
* 头像图片文件必须是jpg格式,推荐使用640*640大小的图片以达到最佳效果
|
||||
* @return 处理结果
|
||||
* @throws WeixinException
|
||||
* @throws IOException
|
||||
* @see com.foxinmy.weixin4j.mp.api.CustomApi
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E5.AE.A2.E6.9C.8D.E7.AE.A1.E7.90.86.E6.8E.A5.E5.8F.A3.E8.BF.94.E5.9B.9E.E7.A0.81.E8.AF.B4.E6.98.8E">客服管理接口返回码</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E4.B8.8A.E4.BC.A0.E5.AE.A2.E6.9C.8D.E5.A4.B4.E5.83.8F">上传客服头像</a>
|
||||
*/
|
||||
public JsonResult uploadAccountHeadimg(String id, File headimg)
|
||||
throws WeixinException, IOException {
|
||||
return customApi.uploadAccountHeadimg(id, headimg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客服账号
|
||||
*
|
||||
* @param id
|
||||
* 完整客服账号,格式为:账号前缀@公众号微信号
|
||||
* @return 处理结果
|
||||
* @see com.foxinmy.weixin4j.mp.api.CustomApi
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E5.AE.A2.E6.9C.8D.E7.AE.A1.E7.90.86.E6.8E.A5.E5.8F.A3.E8.BF.94.E5.9B.9E.E7.A0.81.E8.AF.B4.E6.98.8E">客服管理接口返回码</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E5.88.A0.E9.99.A4.E5.AE.A2.E6.9C.8D.E8.B4.A6.E5.8F.B7">删除客服账号</a>
|
||||
*/
|
||||
public JsonResult deleteAccount(String id) throws WeixinException {
|
||||
return customApi.deleteAccount(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图文消息,一个图文消息支持1到10条图文
|
||||
*
|
||||
@@ -282,9 +374,7 @@ public class WeixinProxy {
|
||||
* @return 媒体ID
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%BE%A4%E5%8F%91%E6%8E%A5%E5%8F%A3">高级群发</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%BE%A4%E5%8F%91%E6%8E%A5%E5%8F%A3#.E4.B8.8A.E4.BC.A0.E5.9B.BE.E6.96.87.E6.B6.88.E6.81.AF.E7.B4.A0.E6.9D.90">上传图文消息</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E4.B8.8A.E4.BC.A0.E5.9B.BE.E6.96.87.E6.B6.88.E6.81.AF.E7.B4.A0.E6.9D.90.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">上传图文素材</a>
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpArticle
|
||||
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
||||
*/
|
||||
@@ -302,7 +392,7 @@ public class WeixinProxy {
|
||||
* @throws WeixinException
|
||||
*
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%BE%A4%E5%8F%91%E6%8E%A5%E5%8F%A3">高级群发</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html">高级群发</a>
|
||||
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
||||
* @see com.foxinmy.weixin4j.msg.model.Video
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpVideo
|
||||
@@ -328,6 +418,8 @@ public class WeixinProxy {
|
||||
* @see com.foxinmy.weixin4j.msg.model.Voice
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpVideo
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpNews
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.A0.B9.E6.8D.AE.E5.88.86.E7.BB.84.E8.BF.9B.E8.A1.8C.E7.BE.A4.E5.8F.91.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">根据分组群发</a>
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#uploadMedia(File)}
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.GroupApi#getGroupByOpenId(String)}
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.GroupApi#getGroups()}
|
||||
@@ -345,6 +437,8 @@ public class WeixinProxy {
|
||||
* 分组ID
|
||||
* @return 群发后的消息ID
|
||||
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#massByGroupId(Base,int)}
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.A0.B9.E6.8D.AE.E5.88.86.E7.BB.84.E8.BF.9B.E8.A1.8C.E7.BE.A4.E5.8F.91.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">根据分组群发</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public String massArticleByGroupId(List<MpArticle> articles, int groupId)
|
||||
@@ -368,6 +462,8 @@ public class WeixinProxy {
|
||||
* @see com.foxinmy.weixin4j.msg.model.Voice
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpVideo
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpNews
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.A0.B9.E6.8D.AEOpenID.E5.88.97.E8.A1.A8.E7.BE.A4.E5.8F.91.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8D.E5.8F.AF.E7.94.A8.EF.BC.8C.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.8F.AF.E7.94.A8.E3.80.91">根据openid群发</a>
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#uploadMedia(File)}
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.UserApi#getUser(String)}
|
||||
*/
|
||||
@@ -384,6 +480,8 @@ public class WeixinProxy {
|
||||
* @param openIds
|
||||
* openId列表
|
||||
* @return 群发后的消息ID
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.A0.B9.E6.8D.AEOpenID.E5.88.97.E8.A1.A8.E7.BE.A4.E5.8F.91.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8D.E5.8F.AF.E7.94.A8.EF.BC.8C.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.8F.AF.E7.94.A8.E3.80.91">根据openid群发</a>
|
||||
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#massByOpenIds(Base,String...)}
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@@ -402,25 +500,59 @@ public class WeixinProxy {
|
||||
* 发送出去的消息ID
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%BE%A4%E5%8F%91%E6%8E%A5%E5%8F%A3#.E5.88.A0.E9.99.A4.E7.BE.A4.E5.8F.91">删除群发</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E5.88.A0.E9.99.A4.E7.BE.A4.E5.8F.91.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">删除群发</a>
|
||||
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
||||
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#massByGroupId(Base, int)}
|
||||
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#massByOpenIds(Base, String...)
|
||||
|
||||
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#massByOpenIds(Base, String...)
|
||||
|
||||
*/
|
||||
public JsonResult deleteMassNews(String msgid) throws WeixinException {
|
||||
return massApi.deleteMassNews(msgid);
|
||||
}
|
||||
|
||||
* 获取token
|
||||
/**
|
||||
* 预览群发消息<br/>
|
||||
* 开发者可通过该接口发送消息给指定用户,在手机端查看消息的样式和排版
|
||||
*
|
||||
* @param openId
|
||||
* 接收用户的ID
|
||||
* @param box
|
||||
* 消息体
|
||||
* @return 处理结果
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E9.A2.84.E8.A7.88.E6.8E.A5.E5.8F.A3.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">预览群发消息</a>
|
||||
*/
|
||||
public JsonResult previewMassNews(String openId, Base box)
|
||||
throws WeixinException {
|
||||
return massApi.previewMassNews(openId, box);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询群发发送状态
|
||||
*
|
||||
* @param msgId
|
||||
* 消息ID
|
||||
* @return 消息发送状态
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.api.MassApi
|
||||
* @see {@link com.foxinmy.weixin4j.msg.event.MassEventMessage#getStatusDesc(String)}
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.9F.A5.E8.AF.A2.E7.BE.A4.E5.8F.91.E6.B6.88.E6.81.AF.E5.8F.91.E9.80.81.E7.8A.B6.E6.80.81.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">查询群发状态</a>
|
||||
*/
|
||||
public String getMassNews(String msgId) throws WeixinException {
|
||||
return massApi.getMassNews(msgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* oauth授权code换取token
|
||||
*
|
||||
* @param code
|
||||
* 用户授权后返回的code
|
||||
* @return token对象
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E7%BD%91%E9%A1%B5%E6%8E%88%E6%9D%83%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF#.E7.AC.AC.E4.BA.8C.E6.AD.A5.EF.BC.9A.E9.80.9A.E8.BF.87code.E6.8D.A2.E5.8F.96.E7.BD.91.E9.A1.B5.E6.8E.88.E6.9D.83access_token">获取用户token</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html">获取用户token</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.OauthToken
|
||||
* @see com.foxinmy.weixin4j.mp.api.UserApi
|
||||
@@ -429,14 +561,14 @@ public class WeixinProxy {
|
||||
return userApi.getOauthToken(code);
|
||||
}
|
||||
|
||||
* 获取用户信息
|
||||
/**
|
||||
* ouath获取用户信息
|
||||
*
|
||||
* @param token
|
||||
* 授权票据
|
||||
* @return 用户对象
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E7%BD%91%E9%A1%B5%E6%8E%88%E6%9D%83%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF#.E7.AC.AC.E5.9B.9B.E6.AD.A5.EF.BC.9A.E6.8B.89.E5.8F.96.E7.94.A8.E6.88.B7.E4.BF.A1.E6.81.AF.28.E9.9C.80scope.E4.B8.BA_snsapi_userinfo.29">拉取用户信息</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html">拉取用户信息</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.User
|
||||
* @see com.foxinmy.weixin4j.mp.model.OauthToken
|
||||
@@ -445,6 +577,23 @@ public class WeixinProxy {
|
||||
public User getUser(OauthToken token) throws WeixinException {
|
||||
return userApi.getUser(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param openId
|
||||
* 用户对应的ID
|
||||
* @return 用户对象
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html">获取用户信息</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.User
|
||||
* @see com.foxinmy.weixin4j.mp.api.UserApi
|
||||
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#getUser(String,Lang)}
|
||||
*/
|
||||
public User getUser(String openId) throws WeixinException {
|
||||
return userApi.getUser(openId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
@@ -454,26 +603,29 @@ public class WeixinProxy {
|
||||
* </p>
|
||||
*
|
||||
* @param openId
|
||||
* 用户对应的ID
|
||||
* @param lang
|
||||
* 国家地区语言版本
|
||||
* @return 用户对象
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF">获取用户信息</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html">获取用户信息</a>
|
||||
* @see com.foxinmy.weixin4j.mp.type.Lang
|
||||
* @see com.foxinmy.weixin4j.mp.model.User
|
||||
* @see com.foxinmy.weixin4j.mp.api.UserApi
|
||||
public User getUser(String openId) throws WeixinException {
|
||||
return userApi.getUser(openId);
|
||||
*/
|
||||
public User getUser(String openId, Lang lang) throws WeixinException {
|
||||
return userApi.getUser(openId, lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户一定数量(10000)的关注者列表
|
||||
*
|
||||
* 下一次拉取数据的openid
|
||||
* @param nextOpenId
|
||||
* 第一个拉取的OPENID,不填默认从头开始拉取
|
||||
* @return 关注信息
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%85%B3%E6%B3%A8%E8%80%85%E5%88%97%E8%A1%A8">获取关注者列表</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/3/17e6919a39c1c53555185907acf70093.html">获取关注者列表</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Following
|
||||
* @see com.foxinmy.weixin4j.mp.api.UserApi
|
||||
@@ -491,7 +643,7 @@ public class WeixinProxy {
|
||||
*
|
||||
* @return 用户对象集合
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%85%B3%E6%B3%A8%E8%80%85%E5%88%97%E8%A1%A8">获取关注者列表</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/3/17e6919a39c1c53555185907acf70093.html">获取关注者列表</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Following
|
||||
* @see com.foxinmy.weixin4j.mp.api.UserApi
|
||||
@@ -509,7 +661,7 @@ public class WeixinProxy {
|
||||
* @param remark
|
||||
* 备注名
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%AE%BE%E7%BD%AE%E7%94%A8%E6%88%B7%E5%A4%87%E6%B3%A8%E5%90%8D%E6%8E%A5%E5%8F%A3">设置用户备注名</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/10/bf8f4e3074e1cf91eb6518b6d08d223e.html">设置用户备注名</a>
|
||||
* @see com.foxinmy.weixin4j.mp.api.UserApi
|
||||
*/
|
||||
@@ -525,7 +677,7 @@ public class WeixinProxy {
|
||||
* 组名称
|
||||
* @return group对象
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3#.E5.88.9B.E5.BB.BA.E5.88.86.E7.BB.84">创建分组</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html#.E5.88.9B.E5.BB.BA.E5.88.86.E7.BB.84">创建分组</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group#toCreateJson()
|
||||
@@ -540,7 +692,7 @@ public class WeixinProxy {
|
||||
*
|
||||
* @return 组集合
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3#.E6.9F.A5.E8.AF.A2.E6.89.80.E6.9C.89.E5.88.86.E7.BB.84">查询所有分组</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html#.E6.9F.A5.E8.AF.A2.E6.89.80.E6.9C.89.E5.88.86.E7.BB.84">查询所有分组</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||
* @see com.foxinmy.weixin4j.mp.api.GroupApi
|
||||
@@ -556,7 +708,7 @@ public class WeixinProxy {
|
||||
* 用户对应的ID
|
||||
* @return 组ID
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3#.E6.9F.A5.E8.AF.A2.E7.94.A8.E6.88.B7.E6.89.80.E5.9C.A8.E5.88.86.E7.BB.84">查询用户所在分组</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html#.E6.9F.A5.E8.AF.A2.E7.94.A8.E6.88.B7.E6.89.80.E5.9C.A8.E5.88.86.E7.BB.84">查询用户所在分组</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||
* @see com.foxinmy.weixin4j.mp.api.GroupApi
|
||||
@@ -573,7 +725,7 @@ public class WeixinProxy {
|
||||
* @param name
|
||||
* 组名称
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3#.E4.BF.AE.E6.94.B9.E5.88.86.E7.BB.84.E5.90.8D">修改分组名</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>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group#toModifyJson()
|
||||
@@ -592,7 +744,7 @@ public class WeixinProxy {
|
||||
* @param groupId
|
||||
* 组ID
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3#.E7.A7.BB.E5.8A.A8.E7.94.A8.E6.88.B7.E5.88.86.E7.BB.84">移动分组</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html#.E7.A7.BB.E5.8A.A8.E7.94.A8.E6.88.B7.E5.88.86.E7.BB.84">移动分组</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||
* @see com.foxinmy.weixin4j.mp.api.GroupApi
|
||||
@@ -607,7 +759,7 @@ public class WeixinProxy {
|
||||
*
|
||||
* @param btnList
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8F%9C%E5%8D%95%E5%88%9B%E5%BB%BA%E6%8E%A5%E5%8F%A3">创建自定义菜单</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.html">创建自定义菜单</a>
|
||||
* @see com.foxinmy.weixin4j.model.Button
|
||||
* @see com.foxinmy.weixin4j.type.ButtonType
|
||||
@@ -622,7 +774,7 @@ public class WeixinProxy {
|
||||
*
|
||||
* @return 菜单集合
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8F%9C%E5%8D%95%E6%9F%A5%E8%AF%A2%E6%8E%A5%E5%8F%A3">查询菜单</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/16/ff9b7b85220e1396ffa16794a9d95adc.html">查询菜单</a>
|
||||
* @see com.foxinmy.weixin4j.model.Button
|
||||
* @see com.foxinmy.weixin4j.mp.api.MenuApi
|
||||
@@ -635,7 +787,7 @@ public class WeixinProxy {
|
||||
* 删除菜单
|
||||
*
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8F%9C%E5%8D%95%E5%88%A0%E9%99%A4%E6%8E%A5%E5%8F%A3">删除菜单</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/16/8ed41ba931e4845844ad6d1eeb8060c8.html">删除菜单</a>
|
||||
* @see com.foxinmy.weixin4j.model.Button
|
||||
* @see com.foxinmy.weixin4j.mp.api.MenuApi
|
||||
@@ -650,6 +802,8 @@ public class WeixinProxy {
|
||||
* @param parameter
|
||||
* @return byte数据包
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.api.QrApi
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">生成二维码</a>
|
||||
*/
|
||||
public byte[] getQRData(QRParameter parameter) throws WeixinException {
|
||||
@@ -666,6 +820,8 @@ public class WeixinProxy {
|
||||
* @return byte数据包
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.api.QrApi
|
||||
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#getQR(QRParameter)}
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">生成二维码</a>
|
||||
*/
|
||||
public byte[] getQRData(int sceneId, int expireSeconds)
|
||||
@@ -684,7 +840,7 @@ public class WeixinProxy {
|
||||
* @return 硬盘存储的文件对象
|
||||
* @throws WeixinException
|
||||
* @throws IOException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E7%94%9F%E6%88%90%E5%B8%A6%E5%8F%82%E6%95%B0%E7%9A%84%E4%BA%8C%E7%BB%B4%E7%A0%81">二维码</a>
|
||||
* @see <a
|
||||
* href="mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">二维码</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.QRParameter
|
||||
* @see com.foxinmy.weixin4j.mp.api.QrApi
|
||||
@@ -702,10 +858,8 @@ public class WeixinProxy {
|
||||
* @return 操作结果
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.type.IndustryType
|
||||
* @see <a href="http://mp.weixin.qq.com/wiki/17/304
|
||||
* c1885ea66dbedf7dc170d84999a9d
|
||||
* .html#.E8.AE.BE.E7.BD.AE.E6.89.80.E5.B1
|
||||
* .9E.E8.A1.8C.E4.B8.9A">设置所处行业</a>
|
||||
* @see com.foxinmy.weixin4j.mp.api.TmplApi
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html#.E8.AE.BE.E7.BD.AE.E6.89.80.E5.B1.9E.E8.A1.8C.E4.B8.9A">设置所处行业</a>
|
||||
*/
|
||||
public JsonResult setTmplIndustry(IndustryType... industryType)
|
||||
@@ -730,11 +884,12 @@ public class WeixinProxy {
|
||||
|
||||
/**
|
||||
* 发送模板消息
|
||||
* @param tplMessage 模板消息主体
|
||||
*
|
||||
* @param tplMessage
|
||||
* 模板消息主体
|
||||
* @return 发送结果
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E6%A8%A1%E6%9D%BF%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3">模板消息</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html#.E5.8F.91.E9.80.81.E6.A8.A1.E6.9D.BF.E6.B6.88.E6.81.AF">模板消息</a>
|
||||
* @see com.foxinmy.weixin4j.mp.message.TemplateMessage
|
||||
* @seee com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage
|
||||
@@ -751,7 +906,7 @@ public class WeixinProxy {
|
||||
* @param url
|
||||
* @return 短链接
|
||||
* @throws WeixinException
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%95%BF%E9%93%BE%E6%8E%A5%E8%BD%AC%E7%9F%AD%E9%93%BE%E6%8E%A5%E6%8E%A5%E5%8F%A3">长链接转短链接</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/10/165c9b15eddcfbd8699ac12b0bd89ae6.html">长链接转短链接</a>
|
||||
* @see com.foxinmy.weixin4j.mp.api.HelperApi
|
||||
*/
|
||||
@@ -956,7 +1111,7 @@ public class WeixinProxy {
|
||||
* @return 语义理解结果
|
||||
* @see com.foxinmy.weixin4j.mp.model.SemQuery
|
||||
* @see com.foxinmy.weixin4j.mp.model.SemResult
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%AF%AD%E4%B9%89%E7%90%86%E8%A7%A3">语义理解</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/0/0ce78b3c9524811fee34aba3e33f3448.html">语义理解</a>
|
||||
* @see com.foxinmy.weixin4j.mp.api.HelperApi
|
||||
* @throws WeixinException
|
||||
@@ -969,7 +1124,7 @@ public class WeixinProxy {
|
||||
* 获取微信服务器IP地址
|
||||
*
|
||||
* @return IP地址
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%BE%AE%E4%BF%A1%E6%9C%8D%E5%8A%A1%E5%99%A8IP%E5%9C%B0%E5%9D%80">获取IP地址</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html">获取IP地址</a>
|
||||
* @see com.foxinmy.weixin4j.mp.api.HelperApi
|
||||
* @throws WeixinException
|
||||
|
||||
+126
-1
@@ -1,16 +1,25 @@
|
||||
package com.foxinmy.weixin4j.mp.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.http.entity.mime.content.ByteArrayBody;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.http.JsonResult;
|
||||
import com.foxinmy.weixin4j.http.PartParameter;
|
||||
import com.foxinmy.weixin4j.http.Response;
|
||||
import com.foxinmy.weixin4j.model.Token;
|
||||
import com.foxinmy.weixin4j.mp.model.CustomRecord;
|
||||
import com.foxinmy.weixin4j.mp.model.KfAccount;
|
||||
import com.foxinmy.weixin4j.token.TokenHolder;
|
||||
import com.foxinmy.weixin4j.util.IOUtil;
|
||||
|
||||
/**
|
||||
* 多客服API
|
||||
@@ -46,7 +55,7 @@ public class CustomApi extends MpApi {
|
||||
* @see com.foxinmy.weixin4j.mp.model.CustomRecord
|
||||
* @see <a href="http://dkf.qq.com/document-1_1.html">查询客服聊天记录</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%AE%A2%E6%9C%8D%E8%81%8A%E5%A4%A9%E8%AE%B0%E5%BD%95">查询客服聊天记录</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/19/7c129ec71ddfa60923ea9334557e8b23.html">查询客服聊天记录</a>
|
||||
*/
|
||||
public List<CustomRecord> getCustomRecord(String openId, Date starttime,
|
||||
Date endtime, int pagesize, int pageindex) throws WeixinException {
|
||||
@@ -75,7 +84,11 @@ public class CustomApi extends MpApi {
|
||||
* @return 多客服信息列表
|
||||
* @see com.foxinmy.weixin4j.mp.model.KfAccount
|
||||
* @see <a href="http://dkf.qq.com/document-3_1.html">获取客服基本信息</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E8.8E.B7.E5.8F.96.E5.AE.A2.E6.9C.8D.E5.9F.BA.E6.9C.AC.E4.BF.A1.E6.81.AF">获取客服基本信息</a>
|
||||
* @see <a href="http://dkf.qq.com/document-3_2.html">获取在线客服接待信息</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E8.8E.B7.E5.8F.96.E5.9C.A8.E7.BA.BF.E5.AE.A2.E6.9C.8D.E6.8E.A5.E5.BE.85.E4.BF.A1.E6.81.AF">获取在线客服接待信息</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<KfAccount> getKfAccountList(boolean isOnline)
|
||||
@@ -95,4 +108,116 @@ public class CustomApi extends MpApi {
|
||||
}
|
||||
return JSON.parseArray(text, KfAccount.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增客服账号
|
||||
*
|
||||
* @param id
|
||||
* 完整客服账号,格式为:账号前缀@公众号微信号,账号前缀最多10个字符,必须是英文或者数字字符。如果没有公众号微信号,
|
||||
* 请前往微信公众平台设置。
|
||||
* @param name
|
||||
* 客服昵称,最长6个汉字或12个英文字符
|
||||
* @param pwd
|
||||
* 客服账号登录密码
|
||||
* @return 处理结果
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E5.AE.A2.E6.9C.8D.E7.AE.A1.E7.90.86.E6.8E.A5.E5.8F.A3.E8.BF.94.E5.9B.9E.E7.A0.81.E8.AF.B4.E6.98.8E">客服管理接口返回码</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E6.B7.BB.E5.8A.A0.E5.AE.A2.E6.9C.8D.E8.B4.A6.E5.8F.B7">新增客服账号</a>
|
||||
*/
|
||||
public JsonResult addAccount(String id, String name, String pwd)
|
||||
throws WeixinException {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("kf_account", id);
|
||||
obj.put("nickname", name);
|
||||
obj.put("password", DigestUtils.md5Hex(pwd));
|
||||
String custom_add_uri = getRequestUri("custom_add_uri");
|
||||
Token token = tokenHolder.getToken();
|
||||
Response response = request.post(
|
||||
String.format(custom_add_uri, token.getAccessToken()),
|
||||
obj.toJSONString());
|
||||
return response.getAsJsonResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新客服账号
|
||||
*
|
||||
* @param id
|
||||
* 完整客服账号,格式为:账号前缀@公众号微信号,账号前缀最多10个字符,必须是英文或者数字字符。如果没有公众号微信号,
|
||||
* 请前往微信公众平台设置。
|
||||
* @param name
|
||||
* 客服昵称,最长6个汉字或12个英文字符
|
||||
* @param pwd
|
||||
* 客服账号登录密码
|
||||
* @return 处理结果
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E5.AE.A2.E6.9C.8D.E7.AE.A1.E7.90.86.E6.8E.A5.E5.8F.A3.E8.BF.94.E5.9B.9E.E7.A0.81.E8.AF.B4.E6.98.8E">客服管理接口返回码</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E8.AE.BE.E7.BD.AE.E5.AE.A2.E6.9C.8D.E4.BF.A1.E6.81.AF">新增客服账号</a>
|
||||
*/
|
||||
public JsonResult updateAccount(String id, String name, String pwd)
|
||||
throws WeixinException {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("kf_account", id);
|
||||
obj.put("nickname", name);
|
||||
obj.put("password", DigestUtils.md5Hex(pwd));
|
||||
String custom_update_uri = getRequestUri("custom_update_uri");
|
||||
Token token = tokenHolder.getToken();
|
||||
Response response = request.post(
|
||||
String.format(custom_update_uri, token.getAccessToken()),
|
||||
obj.toJSONString());
|
||||
return response.getAsJsonResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传客服头像
|
||||
*
|
||||
* @param id
|
||||
* 完整客服账号,格式为:账号前缀@公众号微信号
|
||||
* @param headimg
|
||||
* 头像图片文件必须是jpg格式,推荐使用640*640大小的图片以达到最佳效果
|
||||
* @return 处理结果
|
||||
* @throws WeixinException
|
||||
* @throws IOException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E5.AE.A2.E6.9C.8D.E7.AE.A1.E7.90.86.E6.8E.A5.E5.8F.A3.E8.BF.94.E5.9B.9E.E7.A0.81.E8.AF.B4.E6.98.8E">客服管理接口返回码</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E4.B8.8A.E4.BC.A0.E5.AE.A2.E6.9C.8D.E5.A4.B4.E5.83.8F">上传客服头像</a>
|
||||
*/
|
||||
public JsonResult uploadAccountHeadimg(String id, File headimg)
|
||||
throws WeixinException, IOException {
|
||||
Token token = tokenHolder.getToken();
|
||||
String custom_uploadheadimg_uri = getRequestUri("custom_uploadheadimg_uri");
|
||||
byte[] bytes = IOUtil.toByteArray(new FileInputStream(headimg));
|
||||
Response response = request.post(
|
||||
String.format(custom_uploadheadimg_uri, token.getAccessToken(),
|
||||
id),
|
||||
new PartParameter("media", new ByteArrayBody(bytes, headimg
|
||||
.getName())));
|
||||
|
||||
return response.getAsJsonResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客服账号
|
||||
*
|
||||
* @param id
|
||||
* 完整客服账号,格式为:账号前缀@公众号微信号
|
||||
* @return 处理结果
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E5.AE.A2.E6.9C.8D.E7.AE.A1.E7.90.86.E6.8E.A5.E5.8F.A3.E8.BF.94.E5.9B.9E.E7.A0.81.E8.AF.B4.E6.98.8E">客服管理接口返回码</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html#.E5.88.A0.E9.99.A4.E5.AE.A2.E6.9C.8D.E8.B4.A6.E5.8F.B7">删除客服账号</a>
|
||||
*/
|
||||
public JsonResult deleteAccount(String id) throws WeixinException {
|
||||
Token token = tokenHolder.getToken();
|
||||
String custom_delete_uri = getRequestUri("custom_delete_uri");
|
||||
Response response = request.get(String.format(custom_delete_uri,
|
||||
token.getAccessToken(), id));
|
||||
|
||||
return response.getAsJsonResult();
|
||||
}
|
||||
}
|
||||
@@ -17,13 +17,14 @@ import com.foxinmy.weixin4j.token.TokenHolder;
|
||||
* @author jy.hu
|
||||
* @date 2014年9月25日
|
||||
* @since JDK 1.7
|
||||
* @see <a href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%
|
||||
* BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3">分组接口</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html">分组接口</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||
*/
|
||||
public class GroupApi extends MpApi {
|
||||
|
||||
|
||||
private final TokenHolder tokenHolder;
|
||||
|
||||
public GroupApi(TokenHolder tokenHolder) {
|
||||
this.tokenHolder = tokenHolder;
|
||||
}
|
||||
@@ -36,7 +37,7 @@ public class GroupApi extends MpApi {
|
||||
* @return group对象
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3#.E5.88.9B.E5.BB.BA.E5.88.86.E7.BB.84">创建分组</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html#.E5.88.9B.E5.BB.BA.E5.88.86.E7.BB.84">创建分组</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group#toCreateJson()
|
||||
*/
|
||||
@@ -57,7 +58,7 @@ public class GroupApi extends MpApi {
|
||||
* @return 组集合
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3#.E6.9F.A5.E8.AF.A2.E6.89.80.E6.9C.89.E5.88.86.E7.BB.84">查询所有分组</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html#.E6.9F.A5.E8.AF.A2.E6.89.80.E6.9C.89.E5.88.86.E7.BB.844">查询所有分组</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||
*/
|
||||
public List<Group> getGroups() throws WeixinException {
|
||||
@@ -78,7 +79,7 @@ public class GroupApi extends MpApi {
|
||||
* @return 组ID
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3#.E6.9F.A5.E8.AF.A2.E7.94.A8.E6.88.B7.E6.89.80.E5.9C.A8.E5.88.86.E7.BB.84">查询用户所在分组</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html#.E6.9F.A5.E8.AF.A2.E7.94.A8.E6.88.B7.E6.89.80.E5.9C.A8.E5.88.86.E7.BB.84">查询用户所在分组</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||
*/
|
||||
public int getGroupByOpenId(String openId) throws WeixinException {
|
||||
@@ -100,7 +101,7 @@ public class GroupApi extends MpApi {
|
||||
* 组名称
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3#.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#toModifyJson()
|
||||
*/
|
||||
@@ -125,7 +126,7 @@ public class GroupApi extends MpApi {
|
||||
* 组ID
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3#.E7.A7.BB.E5.8A.A8.E7.94.A8.E6.88.B7.E5.88.86.E7.BB.84">移动分组</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/13/be5272dc4930300ba561d927aead2569.html#.E7.A7.BB.E5.8A.A8.E7.94.A8.E6.88.B7.E5.88.86.E7.BB.84">移动分组</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Group
|
||||
*/
|
||||
public JsonResult moveGroup(String openId, int groupId)
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ public class HelperApi extends MpApi {
|
||||
* @return 短链接
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%95%BF%E9%93%BE%E6%8E%A5%E8%BD%AC%E7%9F%AD%E9%93%BE%E6%8E%A5%E6%8E%A5%E5%8F%A3">长链接转短链接</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/10/165c9b15eddcfbd8699ac12b0bd89ae6.html">长链接转短链接</a>
|
||||
*/
|
||||
public String getShorturl(String url) throws WeixinException {
|
||||
String shorturl_uri = getRequestUri("shorturl_uri");
|
||||
@@ -61,7 +61,7 @@ public class HelperApi extends MpApi {
|
||||
* @see com.foxinmy.weixin4j.mp.model.SemQuery
|
||||
* @see com.foxinmy.weixin4j.mp.model.SemResult
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%AF%AD%E4%B9%89%E7%90%86%E8%A7%A3">语义理解</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/0/0ce78b3c9524811fee34aba3e33f3448.html">语义理解</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public SemResult semantic(SemQuery semQuery) throws WeixinException {
|
||||
@@ -81,7 +81,7 @@ public class HelperApi extends MpApi {
|
||||
*
|
||||
* @return IP地址
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%BE%AE%E4%BF%A1%E6%9C%8D%E5%8A%A1%E5%99%A8IP%E5%9C%B0%E5%9D%80">获取IP地址</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/0/2ad4b6bfd29f30f71d39616c2a0fcedc.html">获取IP地址</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<String> getcallbackip() throws WeixinException {
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.foxinmy.weixin4j.token.TokenHolder;
|
||||
* @date 2014年9月25日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%BE%A4%E5%8F%91%E6%8E%A5%E5%8F%A3">群发接口</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html">群发接口</a>
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpArticle
|
||||
*/
|
||||
public class MassApi extends MpApi {
|
||||
@@ -46,9 +46,7 @@ public class MassApi extends MpApi {
|
||||
* @return 媒体ID
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%BE%A4%E5%8F%91%E6%8E%A5%E5%8F%A3">高级群发</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%BE%A4%E5%8F%91%E6%8E%A5%E5%8F%A3#.E4.B8.8A.E4.BC.A0.E5.9B.BE.E6.96.87.E6.B6.88.E6.81.AF.E7.B4.A0.E6.9D.90">上传图文消息</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E4.B8.8A.E4.BC.A0.E5.9B.BE.E6.96.87.E6.B6.88.E6.81.AF.E7.B4.A0.E6.9D.90.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">上传图文素材</a>
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpArticle
|
||||
*/
|
||||
public String uploadArticle(List<MpArticle> articles)
|
||||
@@ -72,7 +70,7 @@ public class MassApi extends MpApi {
|
||||
* @return 上传后的ID 可用于群发视频消息
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%BE%A4%E5%8F%91%E6%8E%A5%E5%8F%A3">高级群发</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html">高级群发</a>
|
||||
* @see com.foxinmy.weixin4j.msg.model.Video
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpVideo
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#uploadMedia(File)}
|
||||
@@ -106,6 +104,8 @@ public class MassApi extends MpApi {
|
||||
* @see com.foxinmy.weixin4j.msg.model.Voice
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpVideo
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpNews
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.A0.B9.E6.8D.AE.E5.88.86.E7.BB.84.E8.BF.9B.E8.A1.8C.E7.BE.A4.E5.8F.91.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">根据分组群发</a>
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#uploadMedia(File)}
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.GroupApi#getGroups()}
|
||||
*/
|
||||
@@ -146,6 +146,8 @@ public class MassApi extends MpApi {
|
||||
* @param groupId
|
||||
* 分组ID
|
||||
* @return 群发后的消息ID
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.A0.B9.E6.8D.AE.E5.88.86.E7.BB.84.E8.BF.9B.E8.A1.8C.E7.BE.A4.E5.8F.91.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">根据分组群发</a>
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MassApi#massByGroupId(Base,int)}
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@@ -170,6 +172,8 @@ public class MassApi extends MpApi {
|
||||
* @see com.foxinmy.weixin4j.msg.model.Voice
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpVideo
|
||||
* @see com.foxinmy.weixin4j.msg.model.MpNews
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.A0.B9.E6.8D.AEOpenID.E5.88.97.E8.A1.A8.E7.BE.A4.E5.8F.91.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8D.E5.8F.AF.E7.94.A8.EF.BC.8C.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.8F.AF.E7.94.A8.E3.80.91">根据openid群发</a>
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#uploadMedia(File)}
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.UserApi#getUser(String)}
|
||||
*/
|
||||
@@ -209,6 +213,8 @@ public class MassApi extends MpApi {
|
||||
* @param openIds
|
||||
* openId列表
|
||||
* @return 群发后的消息ID
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.A0.B9.E6.8D.AEOpenID.E5.88.97.E8.A1.A8.E7.BE.A4.E5.8F.91.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8D.E5.8F.AF.E7.94.A8.EF.BC.8C.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.8F.AF.E7.94.A8.E3.80.91">根据openid群发</a>
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MassApi#massByOpenIds(Base,String...)}
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@@ -228,10 +234,9 @@ public class MassApi extends MpApi {
|
||||
* 发送出去的消息ID
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E9%AB%98%E7%BA%A7%E7%BE%A4%E5%8F%91%E6%8E%A5%E5%8F%A3#.E5.88.A0.E9.99.A4.E7.BE.A4.E5.8F.91">删除群发</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E5.88.A0.E9.99.A4.E7.BE.A4.E5.8F.91.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">删除群发</a>
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MassApi#massByGroupId(Base, int)}
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MassApi#massByOpenIds(Base, String...)
|
||||
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MassApi#massByOpenIds(Base, String...)
|
||||
|
||||
*/
|
||||
public JsonResult deleteMassNews(String msgid) throws WeixinException {
|
||||
@@ -244,4 +249,56 @@ public class MassApi extends MpApi {
|
||||
obj.toJSONString());
|
||||
|
||||
return response.getAsJsonResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览群发消息<br/>
|
||||
* 开发者可通过该接口发送消息给指定用户,在手机端查看消息的样式和排版
|
||||
*
|
||||
* @param openId
|
||||
* 接收用户的ID
|
||||
* @param box
|
||||
* 消息体
|
||||
* @return 处理结果
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E9.A2.84.E8.A7.88.E6.8E.A5.E5.8F.A3.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">预览群发消息</a>
|
||||
*/
|
||||
public JsonResult previewMassNews(String openId, Base box)
|
||||
throws WeixinException {
|
||||
String msgtype = box.getMediaType().name();
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("touser", openId);
|
||||
obj.put(msgtype, JSON.toJSON(box));
|
||||
obj.put("msgtype", msgtype);
|
||||
String mass_preview_uri = getRequestUri("mass_preview_uri");
|
||||
Token token = tokenHolder.getToken();
|
||||
Response response = request.post(
|
||||
String.format(mass_preview_uri, token.getAccessToken()),
|
||||
obj.toJSONString());
|
||||
|
||||
return response.getAsJsonResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询群发发送状态
|
||||
*
|
||||
* @param msgId
|
||||
* 消息ID
|
||||
* @return 消息发送状态
|
||||
* @throws WeixinException
|
||||
* @see {@link com.foxinmy.weixin4j.msg.event.MassEventMessage#getStatusDesc(String)}
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E6.9F.A5.E8.AF.A2.E7.BE.A4.E5.8F.91.E6.B6.88.E6.81.AF.E5.8F.91.E9.80.81.E7.8A.B6.E6.80.81.E3.80.90.E8.AE.A2.E9.98.85.E5.8F.B7.E4.B8.8E.E6.9C.8D.E5.8A.A1.E5.8F.B7.E8.AE.A4.E8.AF.81.E5.90.8E.E5.9D.87.E5.8F.AF.E7.94.A8.E3.80.91">查询群发状态</a>
|
||||
*/
|
||||
public String getMassNews(String msgId) throws WeixinException {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("msg_id", msgId);
|
||||
String mass_get_uri = getRequestUri("mass_get_uri");
|
||||
Token token = tokenHolder.getToken();
|
||||
Response response = request.post(
|
||||
String.format(mass_get_uri, token.getAccessToken()),
|
||||
obj.toJSONString());
|
||||
|
||||
return response.getAsJson().getString("msg_status");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.foxinmy.weixin4j.util.IOUtil;
|
||||
* @date 2014年9月25日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E4%B8%8B%E8%BD%BD%E5%A4%9A%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6">上传多媒体文件</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html">上传多媒体文件</a>
|
||||
* @see com.foxinmy.weixin4j.type.MediaType
|
||||
*/
|
||||
public class MediaApi extends MpApi {
|
||||
@@ -90,7 +90,7 @@ public class MediaApi extends MpApi {
|
||||
* 媒体类型
|
||||
* @return 上传到微信服务器返回的媒体标识
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E4%B8%8B%E8%BD%BD%E5%A4%9A%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6">上传下载说明</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html">上传下载说明</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public String uploadMedia(String fileName, byte[] bytes, String mediaType)
|
||||
@@ -118,7 +118,7 @@ public class MediaApi extends MpApi {
|
||||
* @throws WeixinException
|
||||
* @throws IOException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E4%B8%8B%E8%BD%BD%E5%A4%9A%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6">上传下载说明</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html">上传下载说明</a>
|
||||
* @see com.foxinmy.weixin4j.type.MediaType
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#downloadMedia(String)}
|
||||
*/
|
||||
@@ -146,7 +146,7 @@ public class MediaApi extends MpApi {
|
||||
* @return 二进制数据包
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E4%B8%8B%E8%BD%BD%E5%A4%9A%E5%AA%92%E4%BD%93%E6%96%87%E4%BB%B6">上传下载说明</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html">上传下载说明</a>
|
||||
*/
|
||||
public byte[] downloadMedia(String mediaId) throws WeixinException {
|
||||
Token token = tokenHolder.getToken();
|
||||
|
||||
@@ -34,7 +34,7 @@ public class MenuApi extends MpApi {
|
||||
* @param btnList
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8F%9C%E5%8D%95%E5%88%9B%E5%BB%BA%E6%8E%A5%E5%8F%A3">创建自定义菜单</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.html">创建自定义菜单</a>
|
||||
* @see com.foxinmy.weixin4j.model.Button
|
||||
*/
|
||||
public JsonResult createMenu(List<Button> btnList) throws WeixinException {
|
||||
@@ -55,7 +55,7 @@ public class MenuApi extends MpApi {
|
||||
* @return 菜单集合
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8F%9C%E5%8D%95%E6%9F%A5%E8%AF%A2%E6%8E%A5%E5%8F%A3">查询菜单</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/16/ff9b7b85220e1396ffa16794a9d95adc.html">查询菜单</a>
|
||||
* @see com.foxinmy.weixin4j.model.Button
|
||||
*/
|
||||
public List<Button> getMenu() throws WeixinException {
|
||||
@@ -74,7 +74,7 @@ public class MenuApi extends MpApi {
|
||||
*
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8F%9C%E5%8D%95%E5%88%A0%E9%99%A4%E6%8E%A5%E5%8F%A3">删除菜单</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/16/8ed41ba931e4845844ad6d1eeb8060c8.html">删除菜单</a>
|
||||
* @return 处理结果
|
||||
*/
|
||||
public JsonResult deleteMenu() throws WeixinException {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import com.foxinmy.weixin4j.token.TokenHolder;
|
||||
* @date 2014年9月26日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%8F%91%E9%80%81%E5%AE%A2%E6%9C%8D%E6%B6%88%E6%81%AF">客服消息</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html">客服消息</a>
|
||||
* @see com.foxinmy.weixin4j.mp.message.NotifyMessage
|
||||
*/
|
||||
public class NotifyApi extends MpApi {
|
||||
@@ -34,7 +34,7 @@ public class NotifyApi extends MpApi {
|
||||
* 客服消息对象
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%8F%91%E9%80%81%E5%AE%A2%E6%9C%8D%E6%B6%88%E6%81%AF">发送客服消息</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/7/12a5a320ae96fecdf0e15cb06123de9f.html">发送客服消息</a>
|
||||
* @see com.foxinmy.weixin4j.msg.model.Text
|
||||
* @see com.foxinmy.weixin4j.msg.model.Image
|
||||
* @see com.foxinmy.weixin4j.msg.model.Voice
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.foxinmy.weixin4j.util.ConfigUtil;
|
||||
* @date 2014年9月25日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E7%94%9F%E6%88%90%E5%B8%A6%E5%8F%82%E6%95%B0%E7%9A%84%E4%BA%8C%E7%BB%B4%E7%A0%81">二维码支持</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">二维码支持</a>
|
||||
*/
|
||||
public class QrApi extends MpApi {
|
||||
|
||||
@@ -37,6 +37,8 @@ public class QrApi extends MpApi {
|
||||
* 二维码参数
|
||||
* @return byte数据包
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">生成二维码</a>
|
||||
*/
|
||||
public byte[] getQRData(QRParameter parameter) throws WeixinException {
|
||||
Token token = tokenHolder.getToken();
|
||||
@@ -61,6 +63,8 @@ public class QrApi extends MpApi {
|
||||
* @return byte数据包
|
||||
* @throws WeixinException
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.QrApi#getQR(QRParameter)}
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">生成二维码</a>
|
||||
*/
|
||||
public byte[] getQRData(int sceneId, int expireSeconds)
|
||||
throws WeixinException {
|
||||
@@ -80,7 +84,7 @@ public class QrApi extends MpApi {
|
||||
* @throws WeixinException
|
||||
* @throws IOException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E7%94%9F%E6%88%90%E5%B8%A6%E5%8F%82%E6%95%B0%E7%9A%84%E4%BA%8C%E7%BB%B4%E7%A0%81">二维码</a>
|
||||
* href="mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">二维码</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.QRParameter
|
||||
*/
|
||||
public File getQR(QRParameter parameter) throws WeixinException,
|
||||
|
||||
@@ -35,10 +35,8 @@ public class TmplApi extends MpApi {
|
||||
* @return 操作结果
|
||||
* @throws WeixinException
|
||||
* @see com.foxinmy.weixin4j.mp.type.IndustryType
|
||||
* @see <a href="http://mp.weixin.qq.com/wiki/17/304
|
||||
* c1885ea66dbedf7dc170d84999a9d
|
||||
* .html#.E8.AE.BE.E7.BD.AE.E6.89.80.E5.B1
|
||||
* .9E.E8.A1.8C.E4.B8.9A">设置所处行业</a>
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html#.E8.AE.BE.E7.BD.AE.E6.89.80.E5.B1.9E.E8.A1.8C.E4.B8.9A">设置所处行业</a>
|
||||
*/
|
||||
public JsonResult setTmplIndustry(IndustryType... industryType)
|
||||
throws WeixinException {
|
||||
@@ -84,7 +82,7 @@ public class TmplApi extends MpApi {
|
||||
* @return 发送结果
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E6%A8%A1%E6%9D%BF%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3">模板消息</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html#.E5.8F.91.E9.80.81.E6.A8.A1.E6.9D.BF.E6.B6.88.E6.81.AF">模板消息</a>
|
||||
* @see com.foxinmy.weixin4j.mp.message.TemplateMessage
|
||||
* @seee com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage
|
||||
*/
|
||||
|
||||
+31
-11
@@ -14,6 +14,7 @@ import com.foxinmy.weixin4j.model.WeixinAccount;
|
||||
import com.foxinmy.weixin4j.mp.model.Following;
|
||||
import com.foxinmy.weixin4j.mp.model.OauthToken;
|
||||
import com.foxinmy.weixin4j.mp.model.User;
|
||||
import com.foxinmy.weixin4j.mp.type.Lang;
|
||||
import com.foxinmy.weixin4j.token.TokenHolder;
|
||||
|
||||
/**
|
||||
@@ -34,14 +35,14 @@ public class UserApi extends MpApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
* oauth授权code获取token
|
||||
*
|
||||
* @param code
|
||||
* 用户授权后返回的code
|
||||
* @return token对象
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E7%BD%91%E9%A1%B5%E6%8E%88%E6%9D%83%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF#.E7.AC.AC.E4.BA.8C.E6.AD.A5.EF.BC.9A.E9.80.9A.E8.BF.87code.E6.8D.A2.E5.8F.96.E7.BD.91.E9.A1.B5.E6.8E.88.E6.9D.83access_token">获取用户token</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html">获取用户token</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.OauthToken
|
||||
*/
|
||||
public OauthToken getOauthToken(String code) throws WeixinException {
|
||||
@@ -55,17 +56,17 @@ public class UserApi extends MpApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* oauth获取用户信息
|
||||
*
|
||||
* @param token
|
||||
* 授权票据
|
||||
* @return 用户对象
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E7%BD%91%E9%A1%B5%E6%8E%88%E6%9D%83%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF#.E7.AC.AC.E5.9B.9B.E6.AD.A5.EF.BC.9A.E6.8B.89.E5.8F.96.E7.94.A8.E6.88.B7.E4.BF.A1.E6.81.AF.28.E9.9C.80scope.E4.B8.BA_snsapi_userinfo.29">拉取用户信息</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html">拉取用户信息</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.User
|
||||
* @see com.foxinmy.weixin4j.mp.model.OauthToken
|
||||
* {@link com.foxinmy.weixin4j.mp.api.UserApi#getOauthToken(String)}
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.UserApi#getOauthToken(String)}
|
||||
*/
|
||||
public User getUser(OauthToken token) throws WeixinException {
|
||||
String user_info_uri = getRequestUri("sns_user_info_uri");
|
||||
@@ -76,6 +77,22 @@ public class UserApi extends MpApi {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param openId
|
||||
* 用户对应的ID
|
||||
* @return 用户对象
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html">获取用户信息</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.User
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.UserApi#getUser(String,Lang)}
|
||||
*/
|
||||
public User getUser(String openId) throws WeixinException {
|
||||
return getUser(openId, Lang.zh_CN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* <p>
|
||||
@@ -85,17 +102,20 @@ public class UserApi extends MpApi {
|
||||
*
|
||||
* @param openId
|
||||
* 用户对应的ID
|
||||
* @param lang
|
||||
* 国家地区语言版本
|
||||
* @return 用户对象
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF">获取用户信息</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html">获取用户信息</a>
|
||||
* @see com.foxinmy.weixin4j.mp.type.Lang
|
||||
* @see com.foxinmy.weixin4j.mp.model.User
|
||||
*/
|
||||
public User getUser(String openId) throws WeixinException {
|
||||
public User getUser(String openId, Lang lang) throws WeixinException {
|
||||
String user_info_uri = getRequestUri("api_user_info_uri");
|
||||
Token token = tokenHolder.getToken();
|
||||
Response response = request.get(String.format(user_info_uri,
|
||||
token.getAccessToken(), openId));
|
||||
token.getAccessToken(), openId, lang.name()));
|
||||
|
||||
return response.getAsObject(new TypeReference<User>() {
|
||||
});
|
||||
@@ -109,7 +129,7 @@ public class UserApi extends MpApi {
|
||||
* @return 关注信息
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%85%B3%E6%B3%A8%E8%80%85%E5%88%97%E8%A1%A8">获取关注者列表</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/3/17e6919a39c1c53555185907acf70093.html">获取关注者列表</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Following
|
||||
*/
|
||||
public Following getFollowing(String nextOpenId) throws WeixinException {
|
||||
@@ -144,7 +164,7 @@ public class UserApi extends MpApi {
|
||||
* @return 用户对象集合
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%85%B3%E6%B3%A8%E8%80%85%E5%88%97%E8%A1%A8">获取关注者列表</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/3/17e6919a39c1c53555185907acf70093.html">获取关注者列表</a>
|
||||
* @see com.foxinmy.weixin4j.mp.model.Following
|
||||
* @see com.foxinmy.weixin4j.mp.api.UserApi#getFollowing(String)
|
||||
*/
|
||||
@@ -172,7 +192,7 @@ public class UserApi extends MpApi {
|
||||
* 备注名
|
||||
* @throws WeixinException
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%AE%BE%E7%BD%AE%E7%94%A8%E6%88%B7%E5%A4%87%E6%B3%A8%E5%90%8D%E6%8E%A5%E5%8F%A3">设置用户备注名</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/10/bf8f4e3074e1cf91eb6518b6d08d223e.html">设置用户备注名</a>
|
||||
*/
|
||||
public JsonResult remarkUserName(String openId, String remark)
|
||||
throws WeixinException {
|
||||
|
||||
+15
-4
@@ -1,8 +1,7 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# api\u9996\u9875
|
||||
# \u5fae\u4fe1\u516c\u4f17\u5e73\u53f0\u6587\u6863\u8bf4\u660e
|
||||
# http://mp.weixin.qq.com/wiki/index.php
|
||||
# \u63a5\u53e3\u8c03\u7528\u8bf4\u660e
|
||||
# http://mp.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E5%8F%A3%E9%A2%91%E7%8E%87%E9%99%90%E5%88%B6%E8%AF%B4%E6%98%8E
|
||||
# http://mp.weixin.qq.com/wiki/0/2e2239fa5f49388d5b5136ecc8e0e440.html
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
api_base_url=https://api.weixin.qq.com
|
||||
@@ -21,7 +20,7 @@ sns_user_token_uri=https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&se
|
||||
sns_user_info_uri=https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s&lang=zh_CN
|
||||
|
||||
# \u76f4\u63a5\u83b7\u53d6\u7528\u6237\u4fe1\u606f
|
||||
api_user_info_uri={api_cgi_url}/user/info?access_token=%s&openid=%s&lang=zh_CN
|
||||
api_user_info_uri={api_cgi_url}/user/info?access_token=%s&openid=%s&lang=%s
|
||||
# \u83b7\u53d6token
|
||||
api_token_uri={api_cgi_url}/token?grant_type=client_credential&appid=%s&secret=%s
|
||||
# \u83b7\u53d6\u4e8c\u7ef4\u7801
|
||||
@@ -61,10 +60,22 @@ mass_group_uri={api_cgi_url}/message/mass/sendall?access_token=%s
|
||||
mass_openid_uri={api_cgi_url}/message/mass/send?access_token=%s
|
||||
# \u5220\u9664\u7fa4\u53d1
|
||||
mass_delete_uri={api_cgi_url}/message/mass/delete?access_token=%s
|
||||
# \u7fa4\u53d1\u9884\u89c8
|
||||
mass_preview_uri={api_cgi_url}/message/mass/preview?access_token=%s
|
||||
# \u67e5\u8be2\u7fa4\u53d1\u72b6\u6001
|
||||
mass_get_uri={api_cgi_url}/message/mass/get?access_token=%s
|
||||
# \u5ba2\u670d\u804a\u5929\u8bb0\u5f55
|
||||
custom_record_uri={api_cgi_url}/customservice/getrecord?access_token=%s
|
||||
# \u5ba2\u670d\u57fa\u672c\u4fe1\u606f
|
||||
getkflist_uri={api_cgi_url}/customservice/getkflist?access_token=%s
|
||||
# \u65b0\u589e\u591a\u5ba2\u670d\u8d26\u53f7
|
||||
custom_add_uri={api_base_url}/customservice/kfaccount/add?access_token=%s
|
||||
# \u66f4\u65b0\u591a\u5ba2\u670d\u8d26\u53f7
|
||||
custom_update_uri={api_base_url}/customservice/kfaccount/update?access_token=%s
|
||||
# \u4e0a\u4f20\u5ba2\u670d\u5934\u50cf
|
||||
custom_uploadheadimg_uri={api_base_url}/customservice/kfacount/uploadheadimg?access_token=%s&kf_account=%s
|
||||
# \u5220\u9664\u5ba2\u670d\u8d26\u53f7
|
||||
custom_delete_uri={api_base_url}/customservice/kfaccount/del?access_token=%s&kf_account=%s
|
||||
# \u5728\u7ebf\u5ba2\u670d\u57fa\u672c\u4fe1\u606f
|
||||
getonlinekflist_uri={api_cgi_url}/customservice/getonlinekflist?access_token=%s
|
||||
# \u957f\u94fe\u63a5\u8f6c\u77ed\u94fe\u63a5
|
||||
|
||||
-2
@@ -12,8 +12,6 @@ import com.foxinmy.weixin4j.mp.type.CustomRecordOperCode;
|
||||
* @author jy
|
||||
* @date 2014年6月28日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%AE%A2%E6%9C%8D%E8%81%8A%E5%A4%A9%E8%AE%B0%E5%BD%95">客服聊天记录</a>
|
||||
*/
|
||||
public class CustomRecord implements Serializable {
|
||||
|
||||
|
||||
@@ -11,9 +11,6 @@ import com.alibaba.fastjson.annotation.JSONField;
|
||||
* @author jy.hu
|
||||
* @date 2014年4月4日
|
||||
* @since JDK 1.7
|
||||
* @see <a href=
|
||||
* "http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%85%B3%E6%B3%A8%E8%80%85%E5%88%97%E8%A1%A8"
|
||||
* >关注信息</a>
|
||||
*/
|
||||
public class Following implements Serializable {
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ import java.io.Serializable;
|
||||
* @author jy.hu
|
||||
* @date 2014年4月4日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E5%88%86%E7%BB%84%E7%AE%A1%E7%90%86%E6%8E%A5%E5%8F%A3">分组</a>
|
||||
*/
|
||||
public class Group implements Serializable {
|
||||
|
||||
|
||||
+10
@@ -25,6 +25,8 @@ public class KfAccount implements Serializable {
|
||||
private String nickName;// 客服昵称
|
||||
@JSONField(name = "kf_id")
|
||||
private String id;// 客服工号
|
||||
@JSONField(name = "kf_headimg")
|
||||
private String headImg; //客服头像
|
||||
|
||||
// 以下字段是调用在线客服状态返回的字段
|
||||
private KfOnlineStatus status; // 客服在线状态 1:pc在线,2:手机在线 若pc和手机同时在线则为 1+2=3
|
||||
@@ -57,6 +59,14 @@ public class KfAccount implements Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getHeadImg() {
|
||||
return headImg;
|
||||
}
|
||||
|
||||
public void setHeadImg(String headImg) {
|
||||
this.headImg = headImg;
|
||||
}
|
||||
|
||||
public KfOnlineStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
-2
@@ -17,8 +17,6 @@ import com.foxinmy.weixin4j.mp.type.QRType;
|
||||
* @since JDK 1.7
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.type.QRType
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E7%94%9F%E6%88%90%E5%B8%A6%E5%8F%82%E6%95%B0%E7%9A%84%E4%BA%8C%E7%BB%B4%E7%A0%81">生成带参数的二维码</a>
|
||||
*/
|
||||
public class QRParameter implements Serializable {
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import com.foxinmy.weixin4j.http.JsonResult;
|
||||
* @date 2014年11月7日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%AF%AD%E4%B9%89%E7%90%86%E8%A7%A3">语义理解</a>
|
||||
* href="http://mp.weixin.qq.com/wiki/0/0ce78b3c9524811fee34aba3e33f3448.html">语义理解</a>
|
||||
*/
|
||||
public class SemResult extends JsonResult {
|
||||
|
||||
|
||||
@@ -17,12 +17,10 @@ import com.foxinmy.weixin4j.mp.type.Lang;
|
||||
* @author jy.hu
|
||||
* @date 2014年4月8日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%94%A8%E6%88%B7%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF">获取用户基本资料</a>
|
||||
*/
|
||||
public class User implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1638176217299286265L;
|
||||
|
||||
private String openid; // 用户的唯一标识
|
||||
private String nickname; // 用户昵称
|
||||
|
||||
+30
@@ -1,13 +1,17 @@
|
||||
package com.foxinmy.weixin4j.mp.test.msg;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.http.JsonResult;
|
||||
import com.foxinmy.weixin4j.mp.api.CustomApi;
|
||||
import com.foxinmy.weixin4j.mp.model.CustomRecord;
|
||||
import com.foxinmy.weixin4j.mp.model.KfAccount;
|
||||
@@ -54,4 +58,30 @@ public class CustomTest extends TokenTest {
|
||||
kfList = customApi.getKfAccountList(true);
|
||||
System.out.println(kfList);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addAccount() throws WeixinException {
|
||||
JsonResult result = customApi.addAccount("temp1@canyidianzhang", "temp",
|
||||
"123456");
|
||||
Assert.assertEquals(0, result.getCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateAccount() throws WeixinException {
|
||||
JsonResult result = customApi.updateAccount("temp1@canyidianzhang", "temp",
|
||||
"123456");
|
||||
Assert.assertEquals(0, result.getCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uploadAccountHeadimg() throws WeixinException, IOException {
|
||||
JsonResult result = customApi.uploadAccountHeadimg("temp1@canyidianzhang", new File("/Users/jy/Music/简谱/风动草.jpg"));
|
||||
Assert.assertEquals(0, result.getCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteAccount() throws WeixinException, IOException {
|
||||
JsonResult result = customApi.deleteAccount("temp@canyidianzhang");
|
||||
Assert.assertEquals(0, result.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
+21
-5
@@ -14,8 +14,10 @@ import com.foxinmy.weixin4j.http.JsonResult;
|
||||
import com.foxinmy.weixin4j.mp.api.MassApi;
|
||||
import com.foxinmy.weixin4j.mp.api.MediaApi;
|
||||
import com.foxinmy.weixin4j.mp.test.TokenTest;
|
||||
import com.foxinmy.weixin4j.msg.event.MassEventMessage;
|
||||
import com.foxinmy.weixin4j.msg.model.Image;
|
||||
import com.foxinmy.weixin4j.msg.model.MpArticle;
|
||||
import com.foxinmy.weixin4j.msg.model.Text;
|
||||
import com.foxinmy.weixin4j.msg.model.Video;
|
||||
import com.foxinmy.weixin4j.type.MediaType;
|
||||
|
||||
@@ -55,15 +57,15 @@ public class MassMsgTest extends TokenTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void massByGroup() throws WeixinException {
|
||||
String massId = massApi.massByGroupId(new Image("mediaId"), 0);
|
||||
Assert.assertTrue(massId != null);
|
||||
public void massByGroupId() throws WeixinException {
|
||||
String msgId = massApi.massByGroupId(new Image("mediaId"), 0);
|
||||
Assert.assertTrue(msgId != null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void massByOpenIds() throws WeixinException {
|
||||
String massId = massApi.massByOpenIds(new Image("mediaId"), "openIds");
|
||||
Assert.assertTrue(massId != null);
|
||||
String msgId = massApi.massByOpenIds(new Text("HI"), "oyFLst1bqtuTcxK-ojF8hOGtLQao");
|
||||
Assert.assertTrue(msgId != null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -92,4 +94,18 @@ public class MassMsgTest extends TokenTest {
|
||||
JsonResult result = massApi.deleteMassNews("34182");
|
||||
Assert.assertEquals(0, result.getCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void previewMass() throws WeixinException {
|
||||
JsonResult result = massApi.previewMassNews("oyFLst1bqtuTcxK-ojF8hOGtLQao", new Text("test"));
|
||||
Assert.assertEquals("0", result.getCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMassNews() throws WeixinException {
|
||||
String status = massApi.getMassNews("82358");
|
||||
System.out.println(status);
|
||||
System.out.println(MassEventMessage.getStatusDesc(status));
|
||||
Assert.assertNotNull(status);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user