修正注释上的link错误

This commit is contained in:
jinyu 2016-03-29 22:34:13 +08:00
parent 62b39c6f41
commit daeb01a14b
8 changed files with 168 additions and 132 deletions

View File

@ -135,8 +135,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.util.Weixin4jSettings * @see com.foxinmy.weixin4j.util.Weixin4jSettings
*/ */
public WeixinProxy(Weixin4jSettings settings) { public WeixinProxy(Weixin4jSettings settings) {
this(new TokenHolder( this(new TokenHolder(new WeixinTokenCreator(settings.getWeixinAccount()
new WeixinTokenCreator(settings.getWeixinAccount().getId(), settings.getWeixinAccount().getSecret()), .getId(), settings.getWeixinAccount().getSecret()),
settings.getTokenStorager0())); settings.getTokenStorager0()));
this.settings = settings; this.settings = settings;
} }
@ -188,7 +188,8 @@ public class WeixinProxy {
* @return * @return
*/ */
public TokenHolder getTicketHolder(TicketType ticketType) { public TokenHolder getTicketHolder(TicketType ticketType) {
return new TokenHolder(new WeixinTicketCreator(getWeixinAccount().getId(), ticketType, this.tokenHolder), return new TokenHolder(new WeixinTicketCreator(getWeixinAccount()
.getId(), ticketType, this.tokenHolder),
this.settings.getTokenStorager0()); this.settings.getTokenStorager0());
} }
@ -204,7 +205,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.api.MediaApi * @see com.foxinmy.weixin4j.mp.api.MediaApi
* @throws WeixinException * @throws WeixinException
*/ */
public String uploadImage(InputStream is, String fileName) throws WeixinException { public String uploadImage(InputStream is, String fileName)
throws WeixinException {
return mediaApi.uploadImage(is, fileName); return mediaApi.uploadImage(is, fileName);
} }
@ -223,18 +225,17 @@ public class WeixinProxy {
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.mp.api.MediaApi * @see com.foxinmy.weixin4j.mp.api.MediaApi
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
* 高级群发</a> * 高级群发</a>
* @see com.foxinmy.weixin4j.tuple.MpVideo * @see com.foxinmy.weixin4j.tuple.MpVideo
*/ */
public MpVideo uploadVideo(InputStream is, String fileName, String title, String description) public MpVideo uploadVideo(InputStream is, String fileName, String title,
throws WeixinException { String description) throws WeixinException {
return mediaApi.uploadVideo(is, fileName, title, description); return mediaApi.uploadVideo(is, fileName, title, description);
} }
/** /**
* 上传媒体文件 </br> * 上传媒体文件 </br> <font color="red">此接口只包含图片语音缩略图视频(临时)四种媒体类型的上传</font>
* <font color="red">此接口只包含图片语音缩略图视频(临时)四种媒体类型的上传</font>
* <p> * <p>
* 正常情况下返回{"type":"TYPE","media_id":"MEDIA_ID","created_at":123456789}, * 正常情况下返回{"type":"TYPE","media_id":"MEDIA_ID","created_at":123456789},
* 否则抛出异常. * 否则抛出异常.
@ -248,17 +249,18 @@ public class WeixinProxy {
* 文件名 * 文件名
* @return 上传到微信服务器返回的媒体标识 * @return 上传到微信服务器返回的媒体标识
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/5/963fc70b80dc75483a271298a76a8d59.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738726&token=&lang=zh_CN">
* 上传临时素材</a> * 上传临时素材</a>
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">
* 上传永久素材</a> * 上传永久素材</a>
* @see com.foxinmy.weixin4j.model.MediaUploadResult * @see com.foxinmy.weixin4j.model.MediaUploadResult
* @see com.foxinmy.weixin4j.type.MediaType * @see com.foxinmy.weixin4j.type.MediaType
* @see com.foxinmy.weixin4j.mp.api.MediaApi * @see com.foxinmy.weixin4j.mp.api.MediaApi
* @throws WeixinException * @throws WeixinException
*/ */
public MediaUploadResult uploadMedia(boolean isMaterial, InputStream is, String fileName) throws WeixinException { public MediaUploadResult uploadMedia(boolean isMaterial, InputStream is,
String fileName) throws WeixinException {
return mediaApi.uploadMedia(isMaterial, is, fileName); return mediaApi.uploadMedia(isMaterial, is, fileName);
} }
@ -273,11 +275,13 @@ public class WeixinProxy {
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.mp.api.MediaApi * @see com.foxinmy.weixin4j.mp.api.MediaApi
* @see com.foxinmy.weixin4j.model.MediaDownloadResult * @see com.foxinmy.weixin4j.model.MediaDownloadResult
* @see <a href= * @see <a
* "http://mp.weixin.qq.com/wiki/10/78b15308b053286e2a66b33f0f0f5fb6.html"> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738727&token=&lang=zh_CN">下载临时媒体素材</a>
* 上传下载说明</a> * @see <a
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738730&token=&lang=zh_CN">下载永久媒体素材</a>
*/ */
public MediaDownloadResult downloadMedia(String mediaId, boolean isMaterial) throws WeixinException { public MediaDownloadResult downloadMedia(String mediaId, boolean isMaterial)
throws WeixinException {
return mediaApi.downloadMedia(mediaId, isMaterial); return mediaApi.downloadMedia(mediaId, isMaterial);
} }
@ -295,10 +299,11 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.api.MediaApi * @see com.foxinmy.weixin4j.mp.api.MediaApi
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">
* 上传永久媒体素材</a> * 上传永久媒体素材</a>
*/ */
public String uploadMaterialArticle(List<MpArticle> articles) throws WeixinException { public String uploadMaterialArticle(List<MpArticle> articles)
throws WeixinException {
return mediaApi.uploadMaterialArticle(articles); return mediaApi.uploadMaterialArticle(articles);
} }
@ -313,7 +318,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
* @see com.foxinmy.weixin4j.mp.api.MediaApi * @see com.foxinmy.weixin4j.mp.api.MediaApi
*/ */
public List<MpArticle> downloadArticle(String mediaId) throws WeixinException { public List<MpArticle> downloadArticle(String mediaId)
throws WeixinException {
return mediaApi.downloadArticle(mediaId); return mediaApi.downloadArticle(mediaId);
} }
@ -331,11 +337,11 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.api.MediaApi * @see com.foxinmy.weixin4j.mp.api.MediaApi
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/4/19a59cba020d506e767360ca1be29450.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732&token=&lang=zh_CN">
* 更新永久图文素材</a> * 更新永久图文素材</a>
*/ */
public JsonResult updateMaterialArticle(String mediaId, int index, List<MpArticle> articles) public JsonResult updateMaterialArticle(String mediaId, int index,
throws WeixinException { List<MpArticle> articles) throws WeixinException {
return mediaApi.updateMaterialArticle(mediaId, index, articles); return mediaApi.updateMaterialArticle(mediaId, index, articles);
} }
@ -348,10 +354,11 @@ public class WeixinProxy {
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.mp.api.MediaApi * @see com.foxinmy.weixin4j.mp.api.MediaApi
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/5/e66f61c303db51a6c0f90f46b15af5f5.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738731&token=&lang=zh_CN">
* 删除永久媒体素材</a> * 删除永久媒体素材</a>
*/ */
public JsonResult deleteMaterialMedia(String mediaId) throws WeixinException { public JsonResult deleteMaterialMedia(String mediaId)
throws WeixinException {
return mediaApi.deleteMaterialMedia(mediaId); return mediaApi.deleteMaterialMedia(mediaId);
} }
@ -368,25 +375,24 @@ public class WeixinProxy {
* 视频描述 * 视频描述
* @return 上传到微信服务器返回的媒体标识 * @return 上传到微信服务器返回的媒体标识
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">
* 上传永久媒体素材</a> * 上传永久媒体素材</a>
* @see com.foxinmy.weixin4j.mp.api.MediaApi * @see com.foxinmy.weixin4j.mp.api.MediaApi
* @throws WeixinException * @throws WeixinException
*/ */
public String uploadMaterialVideo(InputStream is, String fileName, String title, String introduction) public String uploadMaterialVideo(InputStream is, String fileName,
throws WeixinException { String title, String introduction) throws WeixinException {
return mediaApi.uploadMaterialVideo(is, fileName, title, introduction); return mediaApi.uploadMaterialVideo(is, fileName, title, introduction);
} }
/** /**
* 获取永久媒体素材的总数</br> * 获取永久媒体素材的总数</br> .图片和图文消息素材包括单图文和多图文的总数上限为5000其他素材的总数上限为1000
* .图片和图文消息素材包括单图文和多图文的总数上限为5000其他素材的总数上限为1000
* *
* @return 总数对象 * @return 总数对象
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.mp.model.MediaCounter * @see com.foxinmy.weixin4j.mp.model.MediaCounter
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/16/8cc64f8c189674b421bee3ed403993b8.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738733&token=&lang=zh_CN">
* 获取素材总数</a> * 获取素材总数</a>
* @see com.foxinmy.weixin4j.mp.api.MediaApi * @see com.foxinmy.weixin4j.mp.api.MediaApi
*/ */
@ -410,10 +416,11 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.model.Pageable * @see com.foxinmy.weixin4j.model.Pageable
* @see com.foxinmy.weixin4j.model.Pagedata * @see com.foxinmy.weixin4j.model.Pagedata
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/12/2108cd7aafff7f388f41f37efa710204.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738734&token=&lang=zh_CN">
* 获取素材列表</a> * 获取素材列表</a>
*/ */
public MediaRecord listMaterialMedia(MediaType mediaType, Pageable pageable) throws WeixinException { public MediaRecord listMaterialMedia(MediaType mediaType, Pageable pageable)
throws WeixinException {
return mediaApi.listMaterialMedia(mediaType, pageable); return mediaApi.listMaterialMedia(mediaType, pageable);
} }
@ -427,7 +434,8 @@ public class WeixinProxy {
* @see {@link #listMaterialMedia(MediaType, Pageable)} * @see {@link #listMaterialMedia(MediaType, Pageable)}
* @throws WeixinException * @throws WeixinException
*/ */
public List<MediaItem> listAllMaterialMedia(MediaType mediaType) throws WeixinException { public List<MediaItem> listAllMaterialMedia(MediaType mediaType)
throws WeixinException {
return mediaApi.listAllMaterialMedia(mediaType); return mediaApi.listAllMaterialMedia(mediaType);
} }
@ -454,7 +462,7 @@ public class WeixinProxy {
* @throws WeixinException * @throws WeixinException
* @return 处理结果 * @return 处理结果
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html#.E5.AE.A2.E6.9C.8D.E6.8E.A5.E5.8F.A3-.E5.8F.91.E6.B6.88.E6.81.AF"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140547&token=&lang=zh_CN">
* 发送客服消息</a> * 发送客服消息</a>
* @see com.foxinmy.weixin4j.tuple.Text * @see com.foxinmy.weixin4j.tuple.Text
* @see com.foxinmy.weixin4j.tuple.Image * @see com.foxinmy.weixin4j.tuple.Image
@ -464,7 +472,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.tuple.News * @see com.foxinmy.weixin4j.tuple.News
* @see com.foxinmy.weixin4j.mp.api.NotifyApi * @see com.foxinmy.weixin4j.mp.api.NotifyApi
*/ */
public JsonResult sendNotify(NotifyMessage notify, String kfAccount) throws WeixinException { public JsonResult sendNotify(NotifyMessage notify, String kfAccount)
throws WeixinException {
return notifyApi.sendNotify(notify, kfAccount); return notifyApi.sendNotify(notify, kfAccount);
} }
@ -485,7 +494,8 @@ public class WeixinProxy {
* 查询客服聊天记录</a> * 查询客服聊天记录</a>
* @throws WeixinException * @throws WeixinException
*/ */
public List<KfChatRecord> getCustomRecord(Date startTime, Date endTime, Pageable pageable) throws WeixinException { public List<KfChatRecord> getCustomRecord(Date startTime, Date endTime,
Pageable pageable) throws WeixinException {
return customApi.getKfChatRecord(startTime, endTime, pageable); return customApi.getKfChatRecord(startTime, endTime, pageable);
} }
@ -508,7 +518,8 @@ public class WeixinProxy {
* 获取在线客服接待信息</a> * 获取在线客服接待信息</a>
* @throws WeixinException * @throws WeixinException
*/ */
public List<KfAccount> listKfAccount(boolean isOnline) throws WeixinException { public List<KfAccount> listKfAccount(boolean isOnline)
throws WeixinException {
return customApi.listKfAccount(isOnline); return customApi.listKfAccount(isOnline);
} }
@ -532,7 +543,8 @@ public class WeixinProxy {
* "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"> * "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> * 新增客服账号</a>
*/ */
public JsonResult createKfAccount(String id, String name, String pwd) throws WeixinException { public JsonResult createKfAccount(String id, String name, String pwd)
throws WeixinException {
return customApi.createKfAccount(id, name, pwd); return customApi.createKfAccount(id, name, pwd);
} }
@ -556,10 +568,11 @@ public class WeixinProxy {
* "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"> * "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> * 新增客服账号</a>
*/ */
public JsonResult updateKfAccount(String id, String name, String pwd) throws WeixinException { public JsonResult updateKfAccount(String id, String name, String pwd)
throws WeixinException {
return customApi.updateKfAccount(id, name, pwd); return customApi.updateKfAccount(id, name, pwd);
} }
/** /**
* 邀请绑定客服帐号 * 邀请绑定客服帐号
* 新添加的客服帐号是不能直接使用的只有客服人员用微信号绑定了客服账号后方可登录Web客服进行操作此接口发起一个绑定邀请到客服人员微信号 * 新添加的客服帐号是不能直接使用的只有客服人员用微信号绑定了客服账号后方可登录Web客服进行操作此接口发起一个绑定邀请到客服人员微信号
@ -600,7 +613,8 @@ public class WeixinProxy {
* "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"> * "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> * 上传客服头像</a>
*/ */
public JsonResult uploadKfAvatar(String accountId, InputStream is, String fileName) throws WeixinException { public JsonResult uploadKfAvatar(String accountId, InputStream is,
String fileName) throws WeixinException {
return customApi.uploadKfAvatar(accountId, is, fileName); return customApi.uploadKfAvatar(accountId, is, fileName);
} }
@ -643,7 +657,8 @@ public class WeixinProxy {
* "http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.88.9B.E5.BB.BA.E4.BC.9A.E8.AF.9D"> * "http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.88.9B.E5.BB.BA.E4.BC.9A.E8.AF.9D">
* 创建会话</a> * 创建会话</a>
*/ */
public JsonResult createKfSession(String userOpenId, String kfAccount, String text) throws WeixinException { public JsonResult createKfSession(String userOpenId, String kfAccount,
String text) throws WeixinException {
return customApi.createKfSession(userOpenId, kfAccount, text); return customApi.createKfSession(userOpenId, kfAccount, text);
} }
@ -663,7 +678,8 @@ public class WeixinProxy {
* "http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.85.B3.E9.97.AD.E4.BC.9A.E8.AF.9D"> * "http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E5.85.B3.E9.97.AD.E4.BC.9A.E8.AF.9D">
* 创建会话</a> * 创建会话</a>
*/ */
public JsonResult closeKfSession(String userOpenId, String kfAccount, String text) throws WeixinException { public JsonResult closeKfSession(String userOpenId, String kfAccount,
String text) throws WeixinException {
return customApi.closeKfSession(userOpenId, kfAccount, text); return customApi.closeKfSession(userOpenId, kfAccount, text);
} }
@ -697,13 +713,14 @@ public class WeixinProxy {
* "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"> * "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> * 获取客服的会话列表</a>
*/ */
public List<KfSession> listKfSession(String kfAccount) throws WeixinException { public List<KfSession> listKfSession(String kfAccount)
throws WeixinException {
return customApi.listKfSession(kfAccount); return customApi.listKfSession(kfAccount);
} }
/** /**
* 获取未接入会话列表:获取当前正在等待队列中的会话列表此接口最多返回最早进入队列的100个未接入会话</br> * 获取未接入会话列表:获取当前正在等待队列中的会话列表此接口最多返回最早进入队列的100个未接入会话</br> <font
* <font color="red">缺陷没有count字段</font> * color="red">缺陷没有count字段</font>
* *
* @return 会话列表 * @return 会话列表
* @throws WeixinException * @throws WeixinException
@ -730,7 +747,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
* @see com.foxinmy.weixin4j.mp.api.MassApi * @see com.foxinmy.weixin4j.mp.api.MassApi
*/ */
public String uploadMassArticle(List<MpArticle> articles) throws WeixinException { public String uploadMassArticle(List<MpArticle> articles)
throws WeixinException {
return massApi.uploadArticle(articles); return massApi.uploadArticle(articles);
} }
@ -763,7 +781,8 @@ public class WeixinProxy {
* "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"> * "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> * 根据分组群发</a>
*/ */
public String[] massByGroupId(MassTuple tuple, boolean isToAll, int groupId) throws WeixinException { public String[] massByGroupId(MassTuple tuple, boolean isToAll, int groupId)
throws WeixinException {
return massApi.massByGroupId(tuple, isToAll, groupId); return massApi.massByGroupId(tuple, isToAll, groupId);
} }
@ -782,7 +801,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
* @throws WeixinException * @throws WeixinException
*/ */
public String[] massArticleByGroupId(List<MpArticle> articles, int groupId) throws WeixinException { public String[] massArticleByGroupId(List<MpArticle> articles, int groupId)
throws WeixinException {
return massApi.massArticleByGroupId(articles, groupId); return massApi.massArticleByGroupId(articles, groupId);
} }
@ -814,7 +834,8 @@ public class WeixinProxy {
* @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#uploadMedia(File)} * @see {@link com.foxinmy.weixin4j.mp.api.MediaApi#uploadMedia(File)}
* @see {@link com.foxinmy.weixin4j.mp.api.UserApi#getUser(String)} * @see {@link com.foxinmy.weixin4j.mp.api.UserApi#getUser(String)}
*/ */
public String[] massByOpenIds(MassTuple tuple, String... openIds) throws WeixinException { public String[] massByOpenIds(MassTuple tuple, String... openIds)
throws WeixinException {
return massApi.massByOpenIds(tuple, openIds); return massApi.massByOpenIds(tuple, openIds);
} }
@ -833,7 +854,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
* @throws WeixinException * @throws WeixinException
*/ */
public String[] massArticleByOpenIds(List<MpArticle> articles, String... openIds) throws WeixinException { public String[] massArticleByOpenIds(List<MpArticle> articles,
String... openIds) throws WeixinException {
return massApi.massArticleByOpenIds(articles, openIds); return massApi.massArticleByOpenIds(articles, openIds);
} }
@ -859,8 +881,7 @@ public class WeixinProxy {
} }
/** /**
* 预览群发消息</br> * 预览群发消息</br> 开发者可通过该接口发送消息给指定用户在手机端查看消息的样式和排版
* 开发者可通过该接口发送消息给指定用户在手机端查看消息的样式和排版
* *
* @param toUser * @param toUser
* 接收用户的openID * 接收用户的openID
@ -876,7 +897,8 @@ public class WeixinProxy {
* "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"> * "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> * 预览群发消息</a>
*/ */
public JsonResult previewMassNews(String toUser, String toWxName, MassTuple tuple) throws WeixinException { public JsonResult previewMassNews(String toUser, String toWxName,
MassTuple tuple) throws WeixinException {
return massApi.previewMassNews(toUser, toWxName, tuple); return massApi.previewMassNews(toUser, toWxName, tuple);
} }
@ -972,7 +994,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.api.UserApi * @see com.foxinmy.weixin4j.mp.api.UserApi
* @throws WeixinException * @throws WeixinException
*/ */
public List<User> getUsers(Lang lang, String... openIds) throws WeixinException { public List<User> getUsers(Lang lang, String... openIds)
throws WeixinException {
return userApi.getUsers(lang, openIds); return userApi.getUsers(lang, openIds);
} }
@ -1010,7 +1033,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.api.UserApi * @see com.foxinmy.weixin4j.mp.api.UserApi
* @see com.foxinmy.weixin4j.mp.model.Following * @see com.foxinmy.weixin4j.mp.model.Following
*/ */
public Following getFollowingOpenIds(String nextOpenId) throws WeixinException { public Following getFollowingOpenIds(String nextOpenId)
throws WeixinException {
return userApi.getFollowingOpenIds(nextOpenId); return userApi.getFollowingOpenIds(nextOpenId);
} }
@ -1070,7 +1094,8 @@ public class WeixinProxy {
* 设置用户备注名</a> * 设置用户备注名</a>
* @see com.foxinmy.weixin4j.mp.api.UserApi * @see com.foxinmy.weixin4j.mp.api.UserApi
*/ */
public JsonResult remarkUserName(String openId, String remark) throws WeixinException { public JsonResult remarkUserName(String openId, String remark)
throws WeixinException {
return userApi.remarkUserName(openId, remark); return userApi.remarkUserName(openId, remark);
} }
@ -1138,7 +1163,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.model.Group * @see com.foxinmy.weixin4j.mp.model.Group
* @see com.foxinmy.weixin4j.mp.api.GroupApi * @see com.foxinmy.weixin4j.mp.api.GroupApi
*/ */
public JsonResult modifyGroup(int groupId, String name) throws WeixinException { public JsonResult modifyGroup(int groupId, String name)
throws WeixinException {
return groupApi.modifyGroup(groupId, name); return groupApi.modifyGroup(groupId, name);
} }
@ -1156,7 +1182,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.model.Group * @see com.foxinmy.weixin4j.mp.model.Group
* @see com.foxinmy.weixin4j.mp.api.GroupApi * @see com.foxinmy.weixin4j.mp.api.GroupApi
*/ */
public JsonResult moveGroup(int groupId, String openId) throws WeixinException { public JsonResult moveGroup(int groupId, String openId)
throws WeixinException {
return groupApi.moveGroup(groupId, openId); return groupApi.moveGroup(groupId, openId);
} }
@ -1174,7 +1201,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.model.Group * @see com.foxinmy.weixin4j.mp.model.Group
* @see com.foxinmy.weixin4j.mp.api.GroupApi * @see com.foxinmy.weixin4j.mp.api.GroupApi
*/ */
public JsonResult moveGroup(int groupId, String... openIds) throws WeixinException { public JsonResult moveGroup(int groupId, String... openIds)
throws WeixinException {
return groupApi.moveGroup(groupId, openIds); return groupApi.moveGroup(groupId, openIds);
} }
@ -1201,7 +1229,7 @@ public class WeixinProxy {
* 菜单列表 * 菜单列表
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141013&token=&lang=zh_CN">
* 创建自定义菜单</a> * 创建自定义菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
* @see com.foxinmy.weixin4j.type.ButtonType * @see com.foxinmy.weixin4j.type.ButtonType
@ -1217,7 +1245,7 @@ public class WeixinProxy {
* @return 菜单集合 * @return 菜单集合
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/16/ff9b7b85220e1396ffa16794a9d95adc.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141014&token=&lang=zh_CN">
* 查询菜单</a> * 查询菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
* @see com.foxinmy.weixin4j.mp.api.MenuApi * @see com.foxinmy.weixin4j.mp.api.MenuApi
@ -1232,10 +1260,10 @@ public class WeixinProxy {
* @return 菜单集合 * @return 菜单集合
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/16/ff9b7b85220e1396ffa16794a9d95adc.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141014&token=&lang=zh_CN">
* 查询菜单</a> * 普通菜单</a>
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
* 个性化菜单</a> * 个性化菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
* @see com.foxinmy.weixin4j.mp.model.Menu * @see com.foxinmy.weixin4j.mp.model.Menu
@ -1250,7 +1278,7 @@ public class WeixinProxy {
* *
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/16/8ed41ba931e4845844ad6d1eeb8060c8.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141015&token=&lang=zh_CN">
* 删除菜单</a> * 删除菜单</a>
* @see com.foxinmy.weixin4j.mp.api.MenuApi * @see com.foxinmy.weixin4j.mp.api.MenuApi
* @return 处理结果 * @return 处理结果
@ -1269,12 +1297,13 @@ public class WeixinProxy {
* @return 菜单ID * @return 菜单ID
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html#.E5.88.9B.E5.BB.BA.E4.B8.AA.E6.80.A7.E5.8C.96.E8.8F.9C.E5.8D.95"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
* 创建个性化菜单</a> * 创建个性化菜单</a>
* @see com.foxinmy.weixin4j.mp.api.MenuApi * @see com.foxinmy.weixin4j.mp.api.MenuApi
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
*/ */
public String createCustomMenu(List<Button> buttons, MenuMatchRule matchRule) throws WeixinException { public String createCustomMenu(List<Button> buttons, MenuMatchRule matchRule)
throws WeixinException {
return menuApi.createCustomMenu(buttons, matchRule); return menuApi.createCustomMenu(buttons, matchRule);
} }
@ -1283,7 +1312,7 @@ public class WeixinProxy {
* *
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html#.E5.88.A0.E9.99.A4.E4.B8.AA.E6.80.A7.E5.8C.96.E8.8F.9C.E5.8D.95"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
* 删除个性化菜单</a> * 删除个性化菜单</a>
* @see com.foxinmy.weixin4j.mp.api.MenuApi * @see com.foxinmy.weixin4j.mp.api.MenuApi
* @return 处理结果 * @return 处理结果
@ -1298,7 +1327,7 @@ public class WeixinProxy {
* @param userId * @param userId
* 可以是粉丝的OpenID也可以是粉丝的微信号 * 可以是粉丝的OpenID也可以是粉丝的微信号
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html#.E6.B5.8B.E8.AF.95.E4.B8.AA.E6.80.A7.E5.8C.96.E8.8F.9C.E5.8D.95.E5.8C.B9.E9.85.8D.E7.BB.93.E6.9E.9C"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
* 测试个性化菜单</a> * 测试个性化菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
* @see com.foxinmy.weixin4j.mp.api.MenuApi * @see com.foxinmy.weixin4j.mp.api.MenuApi
@ -1320,7 +1349,7 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.model.QRParameter * @see com.foxinmy.weixin4j.mp.model.QRParameter
* @see com.foxinmy.weixin4j.mp.api.QrApi * @see com.foxinmy.weixin4j.mp.api.QrApi
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542&token=&lang=zh_CN">
* 生成二维码</a> * 生成二维码</a>
*/ */
public QRResult createQR(QRParameter parameter) throws WeixinException { public QRResult createQR(QRParameter parameter) throws WeixinException {
@ -1340,7 +1369,8 @@ public class WeixinProxy {
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN">
* 设置所处行业</a> * 设置所处行业</a>
*/ */
public JsonResult setTmplIndustry(IndustryType... industryTypes) throws WeixinException { public JsonResult setTmplIndustry(IndustryType... industryTypes)
throws WeixinException {
return tmplApi.setTmplIndustry(industryTypes); return tmplApi.setTmplIndustry(industryTypes);
} }
@ -1407,7 +1437,8 @@ public class WeixinProxy {
* @seee com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage * @seee com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage
* @see com.foxinmy.weixin4j.mp.api.TmplApi * @see com.foxinmy.weixin4j.mp.api.TmplApi
*/ */
public JsonResult sendTmplMessage(TemplateMessage tplMessage) throws WeixinException { public JsonResult sendTmplMessage(TemplateMessage tplMessage)
throws WeixinException {
return tmplApi.sendTmplMessage(tplMessage); return tmplApi.sendTmplMessage(tplMessage);
} }
@ -1525,7 +1556,8 @@ public class WeixinProxy {
* 接口分析</a> * 接口分析</a>
* @throws WeixinException * @throws WeixinException
*/ */
public List<?> datacube(DatacubeType datacubeType, Date beginDate, Date endDate) throws WeixinException { public List<?> datacube(DatacubeType datacubeType, Date beginDate,
Date endDate) throws WeixinException {
return dataApi.datacube(datacubeType, beginDate, endDate); return dataApi.datacube(datacubeType, beginDate, endDate);
} }
@ -1542,7 +1574,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.api.DataApi * @see com.foxinmy.weixin4j.mp.api.DataApi
* @throws WeixinException * @throws WeixinException
*/ */
public List<?> datacube(DatacubeType datacubeType, Date beginDate, int offset) throws WeixinException { public List<?> datacube(DatacubeType datacubeType, Date beginDate,
int offset) throws WeixinException {
return dataApi.datacube(datacubeType, beginDate, offset); return dataApi.datacube(datacubeType, beginDate, offset);
} }
@ -1559,7 +1592,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.api.DataApi * @see com.foxinmy.weixin4j.mp.api.DataApi
* @throws WeixinException * @throws WeixinException
*/ */
public List<?> datacube(DatacubeType datacubeType, int offset, Date endDate) throws WeixinException { public List<?> datacube(DatacubeType datacubeType, int offset, Date endDate)
throws WeixinException {
return dataApi.datacube(datacubeType, offset, endDate); return dataApi.datacube(datacubeType, offset, endDate);
} }
@ -1574,7 +1608,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.mp.api.DataApi * @see com.foxinmy.weixin4j.mp.api.DataApi
* @throws WeixinException * @throws WeixinException
*/ */
public List<?> datacube(DatacubeType datacubeType, Date date) throws WeixinException { public List<?> datacube(DatacubeType datacubeType, Date date)
throws WeixinException {
return dataApi.datacube(datacubeType, date); return dataApi.datacube(datacubeType, date);
} }

View File

@ -33,9 +33,6 @@ import com.foxinmy.weixin4j.util.StringUtil;
* @date 2014年11月16日 * @date 2014年11月16日
* @since JDK 1.6 * @since JDK 1.6
* @see <a href="http://dkf.qq.com">多客服说明</a> * @see <a href="http://dkf.qq.com">多客服说明</a>
* @see<a
* href="http://mp.weixin.qq.com/wiki/9/6fff6f191ef92c126b043ada035cc935.html"
* >多客服说明</a>
*/ */
public class CustomApi extends MpApi { public class CustomApi extends MpApi {
@ -237,10 +234,11 @@ public class CustomApi extends MpApi {
} }
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
String kf_avatar_uri = getRequestUri("kf_avatar_uri"); String kf_avatar_uri = getRequestUri("kf_avatar_uri");
WeixinResponse response = weixinExecutor.post(String.format( WeixinResponse response = weixinExecutor
kf_avatar_uri, token.getAccessToken(), accountId), .post(String.format(kf_avatar_uri, token.getAccessToken(),
new FormBodyPart("media", new InputStreamBody(is, accountId),
ContentType.IMAGE_JPG.getMimeType(), fileName))); new FormBodyPart("media", new InputStreamBody(is,
ContentType.IMAGE_JPG.getMimeType(), fileName)));
return response.getAsJsonResult(); return response.getAsJsonResult();
} }

View File

@ -24,8 +24,6 @@ import com.foxinmy.weixin4j.util.StringUtil;
* @author jy.hu * @author jy.hu
* @date 2014年9月25日 * @date 2014年9月25日
* @since JDK 1.6 * @since JDK 1.6
* @see <a
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html">群发接口</a>
*/ */
public class MassApi extends MpApi { public class MassApi extends MpApi {

View File

@ -53,7 +53,6 @@ import com.foxinmy.weixin4j.util.WeixinErrorUtil;
* @author jy.hu * @author jy.hu
* @date 2014年9月25日 * @date 2014年9月25日
* @since JDK 1.6 * @since JDK 1.6
* @see com.foxinmy.weixin4j.type.MediaType
*/ */
public class MediaApi extends MpApi { public class MediaApi extends MpApi {
@ -105,7 +104,7 @@ public class MediaApi extends MpApi {
* @return 群发视频消息对象 * @return 群发视频消息对象
* @throws WeixinException * @throws WeixinException
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html">高级群发</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">高级群发</a>
* @see com.foxinmy.weixin4j.tuple.MpVideo * @see com.foxinmy.weixin4j.tuple.MpVideo
*/ */
public MpVideo uploadVideo(InputStream is, String fileName, String title, public MpVideo uploadVideo(InputStream is, String fileName, String title,
@ -141,9 +140,9 @@ public class MediaApi extends MpApi {
* 文件名 * 文件名
* @return 上传到微信服务器返回的媒体标识 * @return 上传到微信服务器返回的媒体标识
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/5/963fc70b80dc75483a271298a76a8d59.html">上传临时素材</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738726&token=&lang=zh_CN">上传临时素材</a>
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html">上传永久素材</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">上传永久素材</a>
* @see com.foxinmy.weixin4j.model.MediaUploadResult * @see com.foxinmy.weixin4j.model.MediaUploadResult
* @see com.foxinmy.weixin4j.type.MediaType * @see com.foxinmy.weixin4j.type.MediaType
* @throws WeixinException * @throws WeixinException
@ -234,9 +233,9 @@ public class MediaApi extends MpApi {
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.model.MediaDownloadResult * @see com.foxinmy.weixin4j.model.MediaDownloadResult
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/11/07b6b76a6b6e8848e855a435d5e34a5f.html">下载临时媒体素材</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738727&token=&lang=zh_CN">下载临时媒体素材</a>
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html">下载永久媒体素材</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738730&token=&lang=zh_CN">下载永久媒体素材</a>
*/ */
public MediaDownloadResult downloadMedia(String mediaId, boolean isMaterial) public MediaDownloadResult downloadMedia(String mediaId, boolean isMaterial)
throws WeixinException { throws WeixinException {
@ -305,7 +304,7 @@ public class MediaApi extends MpApi {
* @return 上传到微信服务器返回的媒体标识 * @return 上传到微信服务器返回的媒体标识
* @throws WeixinException * @throws WeixinException
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html">上传永久媒体素材</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">上传永久媒体素材</a>
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
*/ */
public String uploadMaterialArticle(List<MpArticle> articles) public String uploadMaterialArticle(List<MpArticle> articles)
@ -353,7 +352,7 @@ public class MediaApi extends MpApi {
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/4/19a59cba020d506e767360ca1be29450.html">更新永久图文素材</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732&token=&lang=zh_CN">更新永久图文素材</a>
*/ */
public JsonResult updateMaterialArticle(String mediaId, int index, public JsonResult updateMaterialArticle(String mediaId, int index,
List<MpArticle> articles) throws WeixinException { List<MpArticle> articles) throws WeixinException {
@ -378,7 +377,7 @@ public class MediaApi extends MpApi {
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/5/e66f61c303db51a6c0f90f46b15af5f5.html">删除永久媒体素材</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738731&token=&lang=zh_CN">删除永久媒体素材</a>
*/ */
public JsonResult deleteMaterialMedia(String mediaId) public JsonResult deleteMaterialMedia(String mediaId)
throws WeixinException { throws WeixinException {
@ -406,7 +405,7 @@ public class MediaApi extends MpApi {
* 视频描述 * 视频描述
* @return 上传到微信服务器返回的媒体标识 * @return 上传到微信服务器返回的媒体标识
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html">上传永久媒体素材</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">上传永久媒体素材</a>
* @throws WeixinException * @throws WeixinException
*/ */
public String uploadMaterialVideo(InputStream is, String fileName, public String uploadMaterialVideo(InputStream is, String fileName,
@ -451,7 +450,7 @@ public class MediaApi extends MpApi {
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.model.MediaCounter * @see com.foxinmy.weixin4j.model.MediaCounter
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/16/8cc64f8c189674b421bee3ed403993b8.html">获取素材总数</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738733&token=&lang=zh_CN">获取素材总数</a>
*/ */
public MediaCounter countMaterialMedia() throws WeixinException { public MediaCounter countMaterialMedia() throws WeixinException {
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
@ -478,7 +477,7 @@ public class MediaApi extends MpApi {
* @see com.foxinmy.weixin4j.model.Pageable * @see com.foxinmy.weixin4j.model.Pageable
* @see com.foxinmy.weixin4j.model.Pagedata * @see com.foxinmy.weixin4j.model.Pagedata
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/12/2108cd7aafff7f388f41f37efa710204.html">获取素材列表</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738734&token=&lang=zh_CN">获取素材列表</a>
*/ */
public MediaRecord listMaterialMedia(MediaType mediaType, Pageable pageable) public MediaRecord listMaterialMedia(MediaType mediaType, Pageable pageable)
throws WeixinException { throws WeixinException {

View File

@ -27,8 +27,6 @@ import com.foxinmy.weixin4j.type.ButtonType;
* @author jy.hu * @author jy.hu
* @date 2014年9月25日 * @date 2014年9月25日
* @since JDK 1.6 * @since JDK 1.6
* @see com.foxinmy.weixin4j.model.Button
* @see http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html
*/ */
public class MenuApi extends MpApi { public class MenuApi extends MpApi {
@ -45,7 +43,7 @@ public class MenuApi extends MpApi {
* 菜单列表 * 菜单列表
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/13/43de8269be54a0a6f64413e4dfa94f39.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141013&token=&lang=zh_CN">
* 创建自定义菜单</a> * 创建自定义菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
* @return 处理结果 * @return 处理结果
@ -57,17 +55,21 @@ public class MenuApi extends MpApi {
return createMenu0(menu_create_uri, obj).getAsJsonResult(); return createMenu0(menu_create_uri, obj).getAsJsonResult();
} }
private WeixinResponse createMenu0(String url, JSONObject data) throws WeixinException { private WeixinResponse createMenu0(String url, JSONObject data)
return weixinExecutor.post(String.format(url, tokenHolder.getAccessToken()), throws WeixinException {
return weixinExecutor.post(
String.format(url, tokenHolder.getAccessToken()),
JSON.toJSONString(data, new NameFilter() { JSON.toJSONString(data, new NameFilter() {
@Override @Override
public String process(Object object, String name, Object value) { public String process(Object object, String name,
Object value) {
if (object instanceof Button && name.equals("content")) { if (object instanceof Button && name.equals("content")) {
ButtonType buttonType = ((Button) object).getType(); ButtonType buttonType = ((Button) object).getType();
if (buttonType != null) { if (buttonType != null) {
if (ButtonType.view == buttonType) { if (ButtonType.view == buttonType) {
return "url"; return "url";
} else if (ButtonType.media_id == buttonType || ButtonType.view_limited == buttonType) { } else if (ButtonType.media_id == buttonType
|| ButtonType.view_limited == buttonType) {
return "media_id"; return "media_id";
} else { } else {
return "key"; return "key";
@ -85,7 +87,7 @@ public class MenuApi extends MpApi {
* *
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/16/ff9b7b85220e1396ffa16794a9d95adc.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141014&token=&lang=zh_CN">
* 查询菜单</a> * 查询菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
* @return 菜单集合 * @return 菜单集合
@ -97,7 +99,8 @@ public class MenuApi extends MpApi {
private JSONObject getMenu0() throws WeixinException { private JSONObject getMenu0() throws WeixinException {
String menu_get_uri = getRequestUri("menu_get_uri"); String menu_get_uri = getRequestUri("menu_get_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.get(String.format(menu_get_uri, token.getAccessToken())); WeixinResponse response = weixinExecutor.get(String.format(
menu_get_uri, token.getAccessToken()));
return response.getAsJson(); return response.getAsJson();
} }
@ -106,10 +109,10 @@ public class MenuApi extends MpApi {
* *
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/16/ff9b7b85220e1396ffa16794a9d95adc.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141014&token=&lang=zh_CN">
* 查询菜单</a> * 普通菜单</a>
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
* 个性化菜单</a> * 个性化菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
* @see com.foxinmy.weixin4j.mp.model.Menu * @see com.foxinmy.weixin4j.mp.model.Menu
@ -120,14 +123,16 @@ public class MenuApi extends MpApi {
List<Menu> menus = new ArrayList<Menu>(); List<Menu> menus = new ArrayList<Menu>();
// 普通菜单 // 普通菜单
JSONObject menuObj = response.getJSONObject("menu"); JSONObject menuObj = response.getJSONObject("menu");
menus.add(new Menu(menuObj.getString("menuid"), buttonsConvertor(menuObj), null)); menus.add(new Menu(menuObj.getString("menuid"),
buttonsConvertor(menuObj), null));
// 个性化菜单 // 个性化菜单
JSONArray menuObjs = response.getJSONArray("conditionalmenu"); JSONArray menuObjs = response.getJSONArray("conditionalmenu");
if (menuObjs != null && !menuObjs.isEmpty()) { if (menuObjs != null && !menuObjs.isEmpty()) {
for (int i = 0; i < menuObjs.size(); i++) { for (int i = 0; i < menuObjs.size(); i++) {
menuObj = menuObjs.getJSONObject(i); menuObj = menuObjs.getJSONObject(i);
menus.add(new Menu(menuObj.getString("menuid"), buttonsConvertor(menuObj), menus.add(new Menu(menuObj.getString("menuid"),
menuObj.getObject("matchrule", MenuMatchRule.class))); buttonsConvertor(menuObj), menuObj.getObject(
"matchrule", MenuMatchRule.class)));
} }
} }
return menus; return menus;
@ -139,14 +144,15 @@ public class MenuApi extends MpApi {
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/16/8ed41ba931e4845844ad6d1eeb8060c8.html"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141015&token=&lang=zh_CN">
* 删除菜单</a> * 删除菜单</a>
* @return 处理结果 * @return 处理结果
*/ */
public JsonResult deleteMenu() throws WeixinException { public JsonResult deleteMenu() throws WeixinException {
String menu_delete_uri = getRequestUri("menu_delete_uri"); String menu_delete_uri = getRequestUri("menu_delete_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.get(String.format(menu_delete_uri, token.getAccessToken())); WeixinResponse response = weixinExecutor.get(String.format(
menu_delete_uri, token.getAccessToken()));
return response.getAsJsonResult(); return response.getAsJsonResult();
} }
@ -160,17 +166,19 @@ public class MenuApi extends MpApi {
* 匹配规则 至少要有一个匹配信息是不为空 * 匹配规则 至少要有一个匹配信息是不为空
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html#.E5.88.9B.E5.BB.BA.E4.B8.AA.E6.80.A7.E5.8C.96.E8.8F.9C.E5.8D.95"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
* 创建个性化菜单</a> * 创建个性化菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
* @return 菜单ID * @return 菜单ID
*/ */
public String createCustomMenu(List<Button> buttons, MenuMatchRule matchRule) throws WeixinException { public String createCustomMenu(List<Button> buttons, MenuMatchRule matchRule)
throws WeixinException {
String menu_create_uri = getRequestUri("menu_custom_create_uri"); String menu_create_uri = getRequestUri("menu_custom_create_uri");
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("button", buttons); obj.put("button", buttons);
obj.put("matchrule", matchRule.getRule()); obj.put("matchrule", matchRule.getRule());
return createMenu0(menu_create_uri, obj).getAsJson().getString("menuid"); return createMenu0(menu_create_uri, obj).getAsJson()
.getString("menuid");
} }
/** /**
@ -178,7 +186,7 @@ public class MenuApi extends MpApi {
* *
* @throws WeixinException * @throws WeixinException
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html#.E5.88.A0.E9.99.A4.E4.B8.AA.E6.80.A7.E5.8C.96.E8.8F.9C.E5.8D.95"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
* 删除个性化菜单</a> * 删除个性化菜单</a>
* @return 处理结果 * @return 处理结果
*/ */
@ -187,7 +195,8 @@ public class MenuApi extends MpApi {
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("menuid", menuId); obj.put("menuid", menuId);
WeixinResponse response = weixinExecutor.post(String.format(menu_delete_uri, token.getAccessToken()), WeixinResponse response = weixinExecutor.post(
String.format(menu_delete_uri, token.getAccessToken()),
obj.toJSONString()); obj.toJSONString());
return response.getAsJsonResult(); return response.getAsJsonResult();
@ -200,7 +209,7 @@ public class MenuApi extends MpApi {
* 可以是粉丝的OpenID也可以是粉丝的微信号 * 可以是粉丝的OpenID也可以是粉丝的微信号
* @return 匹配到的菜单配置 * @return 匹配到的菜单配置
* @see <a href= * @see <a href=
* "http://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html#.E6.B5.8B.E8.AF.95.E4.B8.AA.E6.80.A7.E5.8C.96.E8.8F.9C.E5.8D.95.E5.8C.B9.E9.85.8D.E7.BB.93.E6.9E.9C"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
* 测试个性化菜单</a> * 测试个性化菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
* @throws WeixinException * @throws WeixinException
@ -210,7 +219,8 @@ public class MenuApi extends MpApi {
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("user_id", userId); obj.put("user_id", userId);
WeixinResponse response = weixinExecutor.post(String.format(menu_trymatch_uri, token.getAccessToken()), WeixinResponse response = weixinExecutor.post(
String.format(menu_trymatch_uri, token.getAccessToken()),
obj.toJSONString()); obj.toJSONString());
return buttonsConvertor(response.getAsJson().getJSONObject("menu")); return buttonsConvertor(response.getAsJson().getJSONObject("menu"));
@ -227,7 +237,8 @@ public class MenuApi extends MpApi {
JSONArray buttons = menu.getJSONArray("button"); JSONArray buttons = menu.getJSONArray("button");
List<Button> buttonList = new ArrayList<Button>(buttons.size()); List<Button> buttonList = new ArrayList<Button>(buttons.size());
for (int i = 0; i < buttons.size(); i++) { for (int i = 0; i < buttons.size(); i++) {
buttonList.add(JSON.parseObject(buttons.getString(i), Button.class, buttonProcess)); buttonList.add(JSON.parseObject(buttons.getString(i), Button.class,
buttonProcess));
} }
return buttonList; return buttonList;
} }

View File

@ -17,9 +17,6 @@ import com.foxinmy.weixin4j.util.StringUtil;
* @author jy.hu * @author jy.hu
* @date 2014年9月26日 * @date 2014年9月26日
* @since JDK 1.6 * @since JDK 1.6
* @see <a
* href="http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html#.E5.AE.A2.E6.9C.8D.E6.8E.A5.E5.8F.A3-.E5.8F.91.E6.B6.88.E6.81.AF">客服消息</a>
* @see com.foxinmy.weixin4j.mp.message.NotifyMessage
*/ */
public class NotifyApi extends MpApi { public class NotifyApi extends MpApi {
@ -52,7 +49,7 @@ public class NotifyApi extends MpApi {
* @throws WeixinException * @throws WeixinException
* @return 处理结果 * @return 处理结果
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html#.E5.AE.A2.E6.9C.8D.E6.8E.A5.E5.8F.A3-.E5.8F.91.E6.B6.88.E6.81.AF">发送客服消息</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140547&token=&lang=zh_CN">发送客服消息</a>
* @see com.foxinmy.weixin4j.tuple.Text * @see com.foxinmy.weixin4j.tuple.Text
* @see com.foxinmy.weixin4j.tuple.Image * @see com.foxinmy.weixin4j.tuple.Image
* @see com.foxinmy.weixin4j.tuple.Voice * @see com.foxinmy.weixin4j.tuple.Voice

View File

@ -162,7 +162,7 @@ public class OauthApi extends MpApi {
* @return 用户对象 * @return 用户对象
* @throws WeixinException * @throws WeixinException
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html">授权获取用户信息</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842&token=&lang=zh_CN">授权获取用户信息</a>
* @see com.foxinmy.weixin4j.mp.model.User * @see com.foxinmy.weixin4j.mp.model.User
* @see com.foxinmy.weixin4j.mp.model.OauthToken * @see com.foxinmy.weixin4j.mp.model.OauthToken
* @see {@link #getOauthToken(String)} * @see {@link #getOauthToken(String)}
@ -184,7 +184,7 @@ public class OauthApi extends MpApi {
* @return 用户对象 * @return 用户对象
* @throws WeixinException * @throws WeixinException
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html">授权获取用户信息</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842&token=&lang=zh_CN">授权获取用户信息</a>
* @see com.foxinmy.weixin4j.mp.model.User * @see com.foxinmy.weixin4j.mp.model.User
*/ */
public User getUser(String oauthToken, String openid, Lang lang) public User getUser(String oauthToken, String openid, Lang lang)

View File

@ -18,8 +18,6 @@ import com.foxinmy.weixin4j.util.IOUtil;
* @author jy.hu * @author jy.hu
* @date 2014年9月25日 * @date 2014年9月25日
* @since JDK 1.6 * @since JDK 1.6
* @see <a
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">二维码支持</a>
*/ */
public class QrApi extends MpApi { public class QrApi extends MpApi {
@ -39,7 +37,7 @@ public class QrApi extends MpApi {
* @see com.foxinmy.weixin4j.mp.model.QRResult * @see com.foxinmy.weixin4j.mp.model.QRResult
* @see com.foxinmy.weixin4j.mp.model.QRParameter * @see com.foxinmy.weixin4j.mp.model.QRParameter
* @see <a * @see <a
* href="http://mp.weixin.qq.com/wiki/18/28fc21e7ed87bec960651f0ce873ef8a.html">生成二维码</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542&token=&lang=zh_CN">生成二维码</a>
*/ */
public QRResult createQR(QRParameter parameter) throws WeixinException { public QRResult createQR(QRParameter parameter) throws WeixinException {
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();