优化注释和方法名
This commit is contained in:
parent
d9226402cf
commit
7377d3df00
@ -239,10 +239,10 @@ public class WeixinProxy {
|
|||||||
* 否则抛出异常.
|
* 否则抛出异常.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
|
* @param isMaterial
|
||||||
|
* 是否永久上传
|
||||||
* @param is
|
* @param is
|
||||||
* 媒体数据流
|
* 媒体数据流
|
||||||
* @param mediaType
|
|
||||||
* 媒体文件类型:分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
|
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* 文件名
|
* 文件名
|
||||||
* @return 上传到微信服务器返回的媒体标识
|
* @return 上传到微信服务器返回的媒体标识
|
||||||
@ -336,8 +336,7 @@ public class WeixinProxy {
|
|||||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732&token=&lang=zh_CN">
|
* "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, MpArticle article)
|
public JsonResult updateMaterialArticle(String mediaId, int index, MpArticle article) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return mediaApi.updateMaterialArticle(mediaId, index, article);
|
return mediaApi.updateMaterialArticle(mediaId, index, article);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,8 +523,7 @@ public class WeixinProxy {
|
|||||||
* 客服账号登录密码
|
* 客服账号登录密码
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see com.foxinmy.weixin4j.mp.api.CustomApi
|
* @see com.foxinmy.weixin4j.mp.api.CustomApi 客服管理接口返回码</a>
|
||||||
* 客服管理接口返回码</a>
|
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">
|
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">
|
||||||
* 新增客服账号</a>
|
* 新增客服账号</a>
|
||||||
@ -1443,8 +1441,8 @@ public class WeixinProxy {
|
|||||||
* @see com.foxinmy.weixin4j.mp.api.HelperApi
|
* @see com.foxinmy.weixin4j.mp.api.HelperApi
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<String> getCallbackip() throws WeixinException {
|
public List<String> getWechatServerIp() throws WeixinException {
|
||||||
return helperApi.getCallbackip();
|
return helperApi.getWechatServerIp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -90,7 +90,7 @@ public class HelperApi extends MpApi {
|
|||||||
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140187&token=&lang=zh_CN">获取IP地址</a>
|
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140187&token=&lang=zh_CN">获取IP地址</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<String> getCallbackip() throws WeixinException {
|
public List<String> getWechatServerIp() throws WeixinException {
|
||||||
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
|
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
WeixinResponse response = weixinExecutor.post(String.format(getcallbackip_uri,
|
WeixinResponse response = weixinExecutor.post(String.format(getcallbackip_uri,
|
||||||
|
|||||||
@ -18,8 +18,8 @@ public class HelpTest extends TokenTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getcallbackip() throws WeixinException {
|
public void getWechatServerIp() throws WeixinException {
|
||||||
List<String> ipList = helperApi.getCallbackip();
|
List<String> ipList = helperApi.getWechatServerIp();
|
||||||
Assert.assertFalse(ipList.isEmpty());
|
Assert.assertFalse(ipList.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -126,8 +126,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(new WeixinTokenCreator(settings.getWeixinAccount()
|
this(new TokenHolder(
|
||||||
.getId(), settings.getWeixinAccount().getSecret()),
|
new WeixinTokenCreator(settings.getWeixinAccount().getId(), settings.getWeixinAccount().getSecret()),
|
||||||
settings.getTokenStorager0()));
|
settings.getTokenStorager0()));
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
}
|
}
|
||||||
@ -144,17 +144,15 @@ public class WeixinProxy {
|
|||||||
* @see com.foxinmy.weixin4j.qy.api.SuiteApi
|
* @see com.foxinmy.weixin4j.qy.api.SuiteApi
|
||||||
* @see WeixinSuiteProxy#getWeixinProxy(String, String)
|
* @see WeixinSuiteProxy#getWeixinProxy(String, String)
|
||||||
*/
|
*/
|
||||||
public WeixinProxy(SuitePerCodeHolder perCodeHolder,
|
public WeixinProxy(SuitePerCodeHolder perCodeHolder, TokenHolder suiteTokenHolder) {
|
||||||
TokenHolder suiteTokenHolder) {
|
this(new TokenHolder(new WeixinTokenSuiteCreator(perCodeHolder, suiteTokenHolder),
|
||||||
this(new TokenHolder(new WeixinTokenSuiteCreator(perCodeHolder,
|
perCodeHolder.getTokenStorager()));
|
||||||
suiteTokenHolder), perCodeHolder.getTokenStorager()));
|
this.settings = new Weixin4jSettings(new WeixinAccount(perCodeHolder.getAuthCorpId(), null));
|
||||||
this.settings = new Weixin4jSettings(new WeixinAccount(
|
|
||||||
perCodeHolder.getAuthCorpId(), null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注意:TokenCreator 需为 <font
|
* 注意:TokenCreator 需为
|
||||||
* color="red">WeixinTokenCreator或WeixinTokenSuiteCreator</font>
|
* <font color="red">WeixinTokenCreator或WeixinTokenSuiteCreator</font>
|
||||||
*
|
*
|
||||||
* @see com.foxinmy.weixin4j.qy.token.WeixinTokenCreator.WeixinTokenCreator
|
* @see com.foxinmy.weixin4j.qy.token.WeixinTokenCreator.WeixinTokenCreator
|
||||||
* @param tokenHolder
|
* @param tokenHolder
|
||||||
@ -199,8 +197,7 @@ public class WeixinProxy {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public TokenHolder getTicketHolder(TicketType ticketType) {
|
public TokenHolder getTicketHolder(TicketType ticketType) {
|
||||||
return new TokenHolder(new WeixinTicketCreator(getWeixinAccount()
|
return new TokenHolder(new WeixinTicketCreator(getWeixinAccount().getId(), ticketType, this.tokenHolder),
|
||||||
.getId(), ticketType, this.tokenHolder),
|
|
||||||
this.settings.getTokenStorager0());
|
this.settings.getTokenStorager0());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +212,8 @@ public class WeixinProxy {
|
|||||||
* @param message
|
* @param message
|
||||||
* 客服消息对象
|
* 客服消息对象
|
||||||
* @return 如果对应用或收件人、部门、标签任何一个无权限,则本次发送失败;如果收件人、部门或标签不存在,发送仍然执行,但返回无效的部分
|
* @return 如果对应用或收件人、部门、标签任何一个无权限,则本次发送失败;如果收件人、部门或标签不存在,发送仍然执行,但返回无效的部分
|
||||||
* </br> { "errcode": 0, "errmsg": "ok", "invaliduser": "UserID1",
|
* </br>
|
||||||
|
* { "errcode": 0, "errmsg": "ok", "invaliduser": "UserID1",
|
||||||
* "invalidparty":"PartyID1", "invalidtag":"TagID1" }
|
* "invalidparty":"PartyID1", "invalidtag":"TagID1" }
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see com.foxinmy.weixin4j.qy.api.NotifyApi
|
* @see com.foxinmy.weixin4j.qy.api.NotifyApi
|
||||||
@ -234,8 +232,7 @@ public class WeixinProxy {
|
|||||||
* @see com.foxinmy.weixin4j.tuple.MpNews
|
* @see com.foxinmy.weixin4j.tuple.MpNews
|
||||||
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
||||||
*/
|
*/
|
||||||
public IdParameter sendNotifyMessage(NotifyMessage message)
|
public IdParameter sendNotifyMessage(NotifyMessage message) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return notifyApi.sendNotifyMessage(message);
|
return notifyApi.sendNotifyMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,8 +242,9 @@ public class WeixinProxy {
|
|||||||
* @param message
|
* @param message
|
||||||
* 客服消息对象
|
* 客服消息对象
|
||||||
* @return 发送结果
|
* @return 发送结果
|
||||||
* @see <a
|
* @see <a href=
|
||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%AE%A2%E6%9C%8D%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E">客服接口说明</a>
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%AE%A2%E6%9C%8D%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E">
|
||||||
|
* 客服接口说明</a>
|
||||||
* @see com.foxinmy.weixin4j.qy.api.NotifyApi
|
* @see com.foxinmy.weixin4j.qy.api.NotifyApi
|
||||||
* @see com.foxinmy.weixin4j.tuple.Text
|
* @see com.foxinmy.weixin4j.tuple.Text
|
||||||
* @see com.foxinmy.weixin4j.tuple.Image
|
* @see com.foxinmy.weixin4j.tuple.Image
|
||||||
@ -256,8 +254,7 @@ public class WeixinProxy {
|
|||||||
* @see com.foxinmy.weixin4j.qy.message.CustomeMessage
|
* @see com.foxinmy.weixin4j.qy.message.CustomeMessage
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public JsonResult sendCustomeMessage(CustomeMessage message)
|
public JsonResult sendCustomeMessage(CustomeMessage message) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return notifyApi.sendCustomeMessage(message);
|
return notifyApi.sendCustomeMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,8 +266,9 @@ public class WeixinProxy {
|
|||||||
* @return 第一个元素为内部客服(internal),第二个参数为外部客服(external)
|
* @return 第一个元素为内部客服(internal),第二个参数为外部客服(external)
|
||||||
* @see com.foxinmy.weixin4j.qy.api.NotifyApi
|
* @see com.foxinmy.weixin4j.qy.api.NotifyApi
|
||||||
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
||||||
* @see <a
|
* @see <a href=
|
||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%AE%A2%E6%9C%8D%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E">客服列表</a>
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%AE%A2%E6%9C%8D%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E">
|
||||||
|
* 客服列表</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public IdParameter[] getKfList(KfType kfType) throws WeixinException {
|
public IdParameter[] getKfList(KfType kfType) throws WeixinException {
|
||||||
@ -280,10 +278,11 @@ public class WeixinProxy {
|
|||||||
/**
|
/**
|
||||||
* 自定义菜单(管理员须拥有应用的管理权限 并且应用必须设置在回调模式)
|
* 自定义菜单(管理员须拥有应用的管理权限 并且应用必须设置在回调模式)
|
||||||
*
|
*
|
||||||
* @param buttons
|
|
||||||
* 菜单列表
|
|
||||||
* @param agentid
|
* @param agentid
|
||||||
* 应用ID
|
* 应用ID
|
||||||
|
*
|
||||||
|
* @param buttons
|
||||||
|
* 菜单列表
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see com.foxinmy.weixin4j.qy.api.MenuApi
|
* @see com.foxinmy.weixin4j.qy.api.MenuApi
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
@ -291,9 +290,8 @@ public class WeixinProxy {
|
|||||||
* 创建自定义菜单</a>
|
* 创建自定义菜单</a>
|
||||||
* @see com.foxinmy.weixin4j.model.Button
|
* @see com.foxinmy.weixin4j.model.Button
|
||||||
*/
|
*/
|
||||||
public JsonResult createMenu(List<Button> buttons, int agentid)
|
public JsonResult createMenu(int agentid, List<Button> buttons) throws WeixinException {
|
||||||
throws WeixinException {
|
return menuApi.createMenu(agentid, buttons);
|
||||||
return menuApi.createMenu(buttons, agentid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -337,14 +335,14 @@ public class WeixinProxy {
|
|||||||
* 图片数据
|
* 图片数据
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* 文件名
|
* 文件名
|
||||||
* @see <a
|
* @see <a href=
|
||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E5%9B%BE%E6%96%87%E6%B6%88%E6%81%AF%E5%86%85%E7%9A%84%E5%9B%BE%E7%89%87">上传图文消息内的图片</a>
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E5%9B%BE%E6%96%87%E6%B6%88%E6%81%AF%E5%86%85%E7%9A%84%E5%9B%BE%E7%89%87">
|
||||||
|
* 上传图文消息内的图片</a>
|
||||||
* @return 图片url
|
* @return 图片url
|
||||||
* @see com.foxinmy.weixin4j.qy.api.MediaApi
|
* @see com.foxinmy.weixin4j.qy.api.MediaApi
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String uploadImage(InputStream is, String fileName)
|
public String uploadImage(InputStream is, String fileName) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return mediaApi.uploadImage(is, fileName);
|
return mediaApi.uploadImage(is, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,8 +370,7 @@ public class WeixinProxy {
|
|||||||
* 上传永久素材文件说明</a>
|
* 上传永久素材文件说明</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public MediaUploadResult uploadMedia(int agentid, InputStream is,
|
public MediaUploadResult uploadMedia(int agentid, InputStream is, String fileName) throws WeixinException {
|
||||||
String fileName) throws WeixinException {
|
|
||||||
return mediaApi.uploadMedia(agentid, is, fileName);
|
return mediaApi.uploadMedia(agentid, is, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,8 +392,7 @@ public class WeixinProxy {
|
|||||||
* 获取永久媒体说明</a>
|
* 获取永久媒体说明</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public MediaDownloadResult downloadMedia(int agentid, String mediaId)
|
public MediaDownloadResult downloadMedia(int agentid, String mediaId) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return mediaApi.downloadMedia(agentid, mediaId);
|
return mediaApi.downloadMedia(agentid, mediaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,8 +415,7 @@ public class WeixinProxy {
|
|||||||
* 上传永久媒体素材</a>
|
* 上传永久媒体素材</a>
|
||||||
* @see com.foxinmy.weixin4j.tuple.MpArticle
|
* @see com.foxinmy.weixin4j.tuple.MpArticle
|
||||||
*/
|
*/
|
||||||
public String uploadMaterialArticle(int agentid, List<MpArticle> articles)
|
public String uploadMaterialArticle(int agentid, List<MpArticle> articles) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return mediaApi.uploadMaterialArticle(agentid, articles);
|
return mediaApi.uploadMaterialArticle(agentid, articles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,8 +433,7 @@ public class WeixinProxy {
|
|||||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%A0%E9%99%A4%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90">
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%A0%E9%99%A4%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90">
|
||||||
* 删除永久媒体素材</a>
|
* 删除永久媒体素材</a>
|
||||||
*/
|
*/
|
||||||
public JsonResult deleteMaterialMedia(int agentid, String mediaId)
|
public JsonResult deleteMaterialMedia(int agentid, String mediaId) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return mediaApi.deleteMaterialMedia(agentid, mediaId);
|
return mediaApi.deleteMaterialMedia(agentid, mediaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,8 +450,7 @@ public class WeixinProxy {
|
|||||||
* @see com.foxinmy.weixin4j.qy.api.MediaApi
|
* @see com.foxinmy.weixin4j.qy.api.MediaApi
|
||||||
* @see com.foxinmy.weixin4j.tuple.MpArticle
|
* @see com.foxinmy.weixin4j.tuple.MpArticle
|
||||||
*/
|
*/
|
||||||
public List<MpArticle> downloadArticle(int agentid, String mediaId)
|
public List<MpArticle> downloadArticle(int agentid, String mediaId) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return mediaApi.downloadArticle(agentid, mediaId);
|
return mediaApi.downloadArticle(agentid, mediaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,8 +471,7 @@ public class WeixinProxy {
|
|||||||
* 修改永久媒体素材</a>
|
* 修改永久媒体素材</a>
|
||||||
* @see com.foxinmy.weixin4j.tuple.MpArticle
|
* @see com.foxinmy.weixin4j.tuple.MpArticle
|
||||||
*/
|
*/
|
||||||
public String updateMaterialArticle(int agentid, String mediaId,
|
public String updateMaterialArticle(int agentid, String mediaId, List<MpArticle> articles) throws WeixinException {
|
||||||
List<MpArticle> articles) throws WeixinException {
|
|
||||||
return mediaApi.updateMaterialArticle(agentid, mediaId, articles);
|
return mediaApi.updateMaterialArticle(agentid, mediaId, articles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,8 +513,7 @@ public class WeixinProxy {
|
|||||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%B4%A0%E6%9D%90%E5%88%97%E8%A1%A8">
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%B4%A0%E6%9D%90%E5%88%97%E8%A1%A8">
|
||||||
* 获取素材列表</a>
|
* 获取素材列表</a>
|
||||||
*/
|
*/
|
||||||
public MediaRecord listMaterialMedia(int agentid, MediaType mediaType,
|
public MediaRecord listMaterialMedia(int agentid, MediaType mediaType, Pageable pageable) throws WeixinException {
|
||||||
Pageable pageable) throws WeixinException {
|
|
||||||
return mediaApi.listMaterialMedia(agentid, mediaType, pageable);
|
return mediaApi.listMaterialMedia(agentid, mediaType, pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,8 +529,7 @@ public class WeixinProxy {
|
|||||||
* @see {@link #listMaterialMedia(int,MediaType, Pageable)}
|
* @see {@link #listMaterialMedia(int,MediaType, Pageable)}
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<MediaItem> listAllMaterialMedia(int agentid, MediaType mediaType)
|
public List<MediaItem> listAllMaterialMedia(int agentid, MediaType mediaType) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return mediaApi.listAllMaterialMedia(agentid, mediaType);
|
return mediaApi.listAllMaterialMedia(agentid, mediaType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,8 +614,7 @@ public class WeixinProxy {
|
|||||||
* @return 上传后的mediaId
|
* @return 上传后的mediaId
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String batchUploadParties(List<Party> parties)
|
public String batchUploadParties(List<Party> parties) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return mediaApi.batchUploadParties(parties);
|
return mediaApi.batchUploadParties(parties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,8 +650,7 @@ public class WeixinProxy {
|
|||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public JsonResult createUser(User user, InputStream avatar)
|
public JsonResult createUser(User user, InputStream avatar) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return userApi.createUser(user, avatar);
|
return userApi.createUser(user, avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,8 +686,7 @@ public class WeixinProxy {
|
|||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public JsonResult updateUser(User user, InputStream avatar)
|
public JsonResult updateUser(User user, InputStream avatar) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return userApi.updateUser(user, avatar);
|
return userApi.updateUser(user, avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,7 +749,7 @@ public class WeixinProxy {
|
|||||||
/**
|
/**
|
||||||
* 获取部门成员
|
* 获取部门成员
|
||||||
*
|
*
|
||||||
* @param departId
|
* @param partyId
|
||||||
* 部门ID 必须
|
* 部门ID 必须
|
||||||
* @param fetchChild
|
* @param fetchChild
|
||||||
* 是否递归获取子部门下面的成员 非必须
|
* 是否递归获取子部门下面的成员 非必须
|
||||||
@ -778,23 +765,23 @@ public class WeixinProxy {
|
|||||||
* @return 成员列表
|
* @return 成员列表
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<User> listUser(int departId, boolean fetchChild,
|
public List<User> listUser(int partyId, boolean fetchChild, UserStatus userStatus, boolean findDetail)
|
||||||
UserStatus userStatus, boolean findDetail) throws WeixinException {
|
throws WeixinException {
|
||||||
return userApi.listUser(departId, fetchChild, userStatus, findDetail);
|
return userApi.listUser(partyId, fetchChild, userStatus, findDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取部门下所有状态成员(不进行递归)
|
* 获取部门下所有状态成员(不进行递归)
|
||||||
*
|
*
|
||||||
* @param departId
|
* @param partyId
|
||||||
* 部门ID
|
* 部门ID
|
||||||
* @see {@link #listUser(int, boolean,UserStatus)}
|
* @see {@link #listUser(int, boolean,UserStatus)}
|
||||||
* @see com.foxinmy.weixin4j.qy.api.UserApi
|
* @see com.foxinmy.weixin4j.qy.api.UserApi
|
||||||
* @return 成员列表
|
* @return 成员列表
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<User> listUser(int departId) throws WeixinException {
|
public List<User> listUser(int partyId) throws WeixinException {
|
||||||
return userApi.listUser(departId);
|
return userApi.listUser(partyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -825,8 +812,7 @@ public class WeixinProxy {
|
|||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public JsonResult batchDeleteUser(List<String> userIds)
|
public JsonResult batchDeleteUser(List<String> userIds) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return userApi.batchDeleteUser(userIds);
|
return userApi.batchDeleteUser(userIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,8 +830,7 @@ public class WeixinProxy {
|
|||||||
* 邀请成员关注说明</a>
|
* 邀请成员关注说明</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public InviteType inviteUser(String userId, String tips)
|
public InviteType inviteUser(String userId, String tips) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return userApi.inviteUser(userId, tips);
|
return userApi.inviteUser(userId, tips);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,8 +838,9 @@ public class WeixinProxy {
|
|||||||
* 创建标签(创建的标签属于管理组;默认为未加锁状态)
|
* 创建标签(创建的标签属于管理组;默认为未加锁状态)
|
||||||
*
|
*
|
||||||
* @param tag
|
* @param tag
|
||||||
* 标签对象;</br> 标签名称,长度为1~64个字节,标签名不可与其他标签重名;</br> 标签id,整型,
|
* 标签对象;</br>
|
||||||
* 指定此参数时新增的标签会生成对应的标签id,不指定时则以目前最大的id自增。
|
* 标签名称,长度为1~64个字节,标签名不可与其他标签重名;</br>
|
||||||
|
* 标签id,整型, 指定此参数时新增的标签会生成对应的标签id,不指定时则以目前最大的id自增。
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.9B.E5.BB.BA.E6.A0.87.E7.AD.BE">
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.9B.E5.BB.BA.E6.A0.87.E7.AD.BE">
|
||||||
* 创建标签说明</a>
|
* 创建标签说明</a>
|
||||||
@ -924,8 +910,8 @@ public class WeixinProxy {
|
|||||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
|
||||||
* 获取标签成员说明</a>
|
* 获取标签成员说明</a>
|
||||||
* @see com.foxinmy.weixin4j.qy.api.TagApi
|
* @see com.foxinmy.weixin4j.qy.api.TagApi
|
||||||
* @return 成员列表<font color="red">Contacts#getUsers</font>和部门列表<font
|
* @return 成员列表<font color="red">Contacts#getUsers</font>和部门列表
|
||||||
* color="red">Contacts#getPartyIds</font>
|
* <font color="red">Contacts#getPartyIds</font>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public Contacts getTagUsers(int tagId) throws WeixinException {
|
public Contacts getTagUsers(int tagId) throws WeixinException {
|
||||||
@ -933,8 +919,7 @@ public class WeixinProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增标签成员(标签对管理组可见且未加锁,成员属于管理组管辖范围)<br>
|
* 新增标签成员(标签对管理组可见且未加锁,成员属于管理组管辖范围)
|
||||||
* <font color="red">若部分userid非法,则在text中体现</font>
|
|
||||||
*
|
*
|
||||||
* @param tagId
|
* @param tagId
|
||||||
* 标签ID
|
* 标签ID
|
||||||
@ -947,17 +932,15 @@ public class WeixinProxy {
|
|||||||
* 新增标签成员说明</a>
|
* 新增标签成员说明</a>
|
||||||
* @see com.foxinmy.weixin4j.qy.api.TagApi
|
* @see com.foxinmy.weixin4j.qy.api.TagApi
|
||||||
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
||||||
* @return 处理结果
|
* @return 非法的userIds和partyIds
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public IdParameter addTagUsers(int tagId, List<String> userIds,
|
public IdParameter addTagUsers(int tagId, List<String> userIds, List<Integer> partyIds) throws WeixinException {
|
||||||
List<Integer> partyIds) throws WeixinException {
|
|
||||||
return tagApi.addTagUsers(tagId, userIds, partyIds);
|
return tagApi.addTagUsers(tagId, userIds, partyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除标签成员(标签对管理组可见且未加锁,成员属于管理组管辖范围)<br>
|
* 删除标签成员(标签对管理组可见且未加锁,成员属于管理组管辖范围)
|
||||||
* <font color="red">若部分userid非法,则在text中体现</font>
|
|
||||||
*
|
*
|
||||||
* @param tagId
|
* @param tagId
|
||||||
* 标签ID
|
* 标签ID
|
||||||
@ -970,11 +953,10 @@ public class WeixinProxy {
|
|||||||
* 删除标签成员说明</a>
|
* 删除标签成员说明</a>
|
||||||
* @see com.foxinmy.weixin4j.qy.api.TagApi
|
* @see com.foxinmy.weixin4j.qy.api.TagApi
|
||||||
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
||||||
* @return 处理结果
|
* @return 非法的userIds和partyIds
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public IdParameter deleteTagUsers(int tagId, List<String> userIds,
|
public IdParameter deleteTagUsers(int tagId, List<String> userIds, List<Integer> partyIds) throws WeixinException {
|
||||||
List<Integer> partyIds) throws WeixinException {
|
|
||||||
return tagApi.deleteTagUsers(tagId, userIds, partyIds);
|
return tagApi.deleteTagUsers(tagId, userIds, partyIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -988,8 +970,8 @@ public class WeixinProxy {
|
|||||||
* 获取IP地址</a>
|
* 获取IP地址</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<String> getCallbackip() throws WeixinException {
|
public List<String> getWechatServerIp() throws WeixinException {
|
||||||
return helperApi.getCallbackip();
|
return helperApi.getWechatServerIp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1059,8 +1041,7 @@ public class WeixinProxy {
|
|||||||
* 邀请成员关注</a>
|
* 邀请成员关注</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String batchInviteUser(IdParameter parameter, Callback callback,
|
public String batchInviteUser(IdParameter parameter, Callback callback, String tips) throws WeixinException {
|
||||||
String tips) throws WeixinException {
|
|
||||||
return batchApi.inviteUser(parameter, callback, tips);
|
return batchApi.inviteUser(parameter, callback, tips);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1068,7 +1049,8 @@ public class WeixinProxy {
|
|||||||
* 批量更新成员,本接口以userid为主键,增量更新企业号通讯录成员。
|
* 批量更新成员,本接口以userid为主键,增量更新企业号通讯录成员。
|
||||||
* <p>
|
* <p>
|
||||||
* 1.模板中的部门需填写部门ID,多个部门用分号分隔,部门ID必须为数字</br>
|
* 1.模板中的部门需填写部门ID,多个部门用分号分隔,部门ID必须为数字</br>
|
||||||
* 2.文件中存在、通讯录中也存在的成员,更新成员在文件中指定的字段值 </br> 3.文件中存在、通讯录中不存在的成员,执行添加操作</br>
|
* 2.文件中存在、通讯录中也存在的成员,更新成员在文件中指定的字段值 </br>
|
||||||
|
* 3.文件中存在、通讯录中不存在的成员,执行添加操作</br>
|
||||||
* 4.通讯录中存在、文件中不存在的成员,保持不变</br>
|
* 4.通讯录中存在、文件中不存在的成员,保持不变</br>
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
@ -1084,15 +1066,15 @@ public class WeixinProxy {
|
|||||||
* 批量更新成员</a>
|
* 批量更新成员</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String batchSyncUser(String mediaId, Callback callback)
|
public String batchSyncUser(String mediaId, Callback callback) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return batchApi.syncUser(mediaId, callback);
|
return batchApi.syncUser(mediaId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量覆盖成员,本接口以userid为主键,全量覆盖企业号通讯录成员,任务完成后企业号通讯录成员与提交的文件完全保持一致。
|
* 批量覆盖成员,本接口以userid为主键,全量覆盖企业号通讯录成员,任务完成后企业号通讯录成员与提交的文件完全保持一致。
|
||||||
* <p>
|
* <p>
|
||||||
* 1.模板中的部门需填写部门ID,多个部门用分号分隔,部门ID必须为数字</br> 2.文件中存在、通讯录中也存在的成员,完全以文件为准</br>
|
* 1.模板中的部门需填写部门ID,多个部门用分号分隔,部门ID必须为数字</br>
|
||||||
|
* 2.文件中存在、通讯录中也存在的成员,完全以文件为准</br>
|
||||||
* 3.文件中存在、通讯录中不存在的成员,执行添加操作</br>
|
* 3.文件中存在、通讯录中不存在的成员,执行添加操作</br>
|
||||||
* 4.通讯录中存在、文件中不存在的成员,执行删除操作。出于安全考虑,如果需要删除的成员多于50人,
|
* 4.通讯录中存在、文件中不存在的成员,执行删除操作。出于安全考虑,如果需要删除的成员多于50人,
|
||||||
* 且多于现有人数的20%以上,系统将中止导入并返回相应的错误码
|
* 且多于现有人数的20%以上,系统将中止导入并返回相应的错误码
|
||||||
@ -1110,8 +1092,7 @@ public class WeixinProxy {
|
|||||||
* 批量覆盖成员</a>
|
* 批量覆盖成员</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String batchReplaceUser(String mediaId, Callback callback)
|
public String batchReplaceUser(String mediaId, Callback callback) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return batchApi.replaceUser(mediaId, callback);
|
return batchApi.replaceUser(mediaId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1137,7 +1118,8 @@ public class WeixinProxy {
|
|||||||
/**
|
/**
|
||||||
* 批量覆盖部门,本接口以partyid为键,全量覆盖企业号通讯录组织架构,任务完成后企业号通讯录组织架构与提交的文件完全保持一致。
|
* 批量覆盖部门,本接口以partyid为键,全量覆盖企业号通讯录组织架构,任务完成后企业号通讯录组织架构与提交的文件完全保持一致。
|
||||||
* <p>
|
* <p>
|
||||||
* 1.文件中存在、通讯录中也存在的部门,执行修改操作</br> 2.文件中存在、通讯录中不存在的部门,执行添加操作</br>
|
* 1.文件中存在、通讯录中也存在的部门,执行修改操作</br>
|
||||||
|
* 2.文件中存在、通讯录中不存在的部门,执行添加操作</br>
|
||||||
* 3.文件中不存在、通讯录中存在的部门,当部门为空时,执行删除操作</br>
|
* 3.文件中不存在、通讯录中存在的部门,当部门为空时,执行删除操作</br>
|
||||||
* 4.CSV文件中,部门名称、部门ID、父部门ID为必填字段,部门ID必须为数字;排序为可选字段,置空或填0不修改排序
|
* 4.CSV文件中,部门名称、部门ID、父部门ID为必填字段,部门ID必须为数字;排序为可选字段,置空或填0不修改排序
|
||||||
* </p>
|
* </p>
|
||||||
@ -1154,8 +1136,7 @@ public class WeixinProxy {
|
|||||||
* 批量覆盖部门</a>
|
* 批量覆盖部门</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public String batchReplaceParty(String mediaId, Callback callback)
|
public String batchReplaceParty(String mediaId, Callback callback) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return batchApi.replaceParty(mediaId, callback);
|
return batchApi.replaceParty(mediaId, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1191,8 +1172,7 @@ public class WeixinProxy {
|
|||||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3">
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3">
|
||||||
* userid转换成openid</a>
|
* userid转换成openid</a>
|
||||||
*/
|
*/
|
||||||
public String[] userid2openid(String userid, int agentid)
|
public String[] userid2openid(String userid, int agentid) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return userApi.userid2openid(userid, agentid);
|
return userApi.userid2openid(userid, agentid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1266,8 +1246,7 @@ public class WeixinProxy {
|
|||||||
* 修改会话信息</a>
|
* 修改会话信息</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public JsonResult updateChat(ChatInfo chatInfo, String operator,
|
public JsonResult updateChat(ChatInfo chatInfo, String operator, List<String> addUsers, List<String> deleteUsers)
|
||||||
List<String> addUsers, List<String> deleteUsers)
|
|
||||||
throws WeixinException {
|
throws WeixinException {
|
||||||
return chatApi.updateChat(chatInfo, operator, addUsers, deleteUsers);
|
return chatApi.updateChat(chatInfo, operator, addUsers, deleteUsers);
|
||||||
}
|
}
|
||||||
@ -1286,8 +1265,7 @@ public class WeixinProxy {
|
|||||||
* 退出会话</a>
|
* 退出会话</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public JsonResult quitChat(String chatId, String operator)
|
public JsonResult quitChat(String chatId, String operator) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return chatApi.quitChat(chatId, operator);
|
return chatApi.quitChat(chatId, operator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1307,8 +1285,7 @@ public class WeixinProxy {
|
|||||||
* 清除会话未读状态</a>
|
* 清除会话未读状态</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public JsonResult clearChatNotify(String targetId, String owner,
|
public JsonResult clearChatNotify(String targetId, String owner, ChatType chatType) throws WeixinException {
|
||||||
ChatType chatType) throws WeixinException {
|
|
||||||
return chatApi.clearChatNotify(targetId, owner, chatType);
|
return chatApi.clearChatNotify(targetId, owner, chatType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1326,8 +1303,7 @@ public class WeixinProxy {
|
|||||||
* @return 列表中不存在的成员,剩余合法成员会继续执行。
|
* @return 列表中不存在的成员,剩余合法成员会继续执行。
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<String> setChatMute(List<ChatMute> chatMutes)
|
public List<String> setChatMute(List<ChatMute> chatMutes) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return chatApi.setChatMute(chatMutes);
|
return chatApi.setChatMute(chatMutes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1344,8 +1320,7 @@ public class WeixinProxy {
|
|||||||
* 发送消息</a>
|
* 发送消息</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public JsonResult sendChatMessage(ChatMessage message)
|
public JsonResult sendChatMessage(ChatMessage message) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
return chatApi.sendChatMessage(message);
|
return chatApi.sendChatMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class HelperApi extends QyApi {
|
|||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%9B%9E%E8%B0%83%E6%A8%A1%E5%BC%8F#.E8.8E.B7.E5.8F.96.E5.BE.AE.E4.BF.A1.E6.9C.8D.E5.8A.A1.E5.99.A8.E7.9A.84ip.E6.AE.B5">获取IP地址</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%9B%9E%E8%B0%83%E6%A8%A1%E5%BC%8F#.E8.8E.B7.E5.8F.96.E5.BE.AE.E4.BF.A1.E6.9C.8D.E5.8A.A1.E5.99.A8.E7.9A.84ip.E6.AE.B5">获取IP地址</a>
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<String> getCallbackip() throws WeixinException {
|
public List<String> getWechatServerIp() throws WeixinException {
|
||||||
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
|
String getcallbackip_uri = getRequestUri("getcallbackip_uri");
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
WeixinResponse response = weixinExecutor.get(String.format(getcallbackip_uri,
|
WeixinResponse response = weixinExecutor.get(String.format(getcallbackip_uri,
|
||||||
|
|||||||
@ -38,34 +38,32 @@ public class MenuApi extends QyApi {
|
|||||||
/**
|
/**
|
||||||
* 自定义菜单(管理员须拥有应用的管理权限 并且应用必须设置在回调模式)
|
* 自定义菜单(管理员须拥有应用的管理权限 并且应用必须设置在回调模式)
|
||||||
*
|
*
|
||||||
* @param buttons
|
|
||||||
* 菜单列表
|
|
||||||
* @param agentid
|
* @param agentid
|
||||||
* 应用ID
|
* 应用ID
|
||||||
|
*
|
||||||
|
* @param buttons
|
||||||
|
* 菜单列表
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see <a
|
* @see <a href=
|
||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%9B%E5%BB%BA%E5%BA%94%E7%94%A8%E8%8F%9C%E5%8D%95">创建自定义菜单</a>
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%9B%E5%BB%BA%E5%BA%94%E7%94%A8%E8%8F%9C%E5%8D%95">
|
||||||
|
* 创建自定义菜单</a>
|
||||||
* @see com.foxinmy.weixin4j.model.Button
|
* @see com.foxinmy.weixin4j.model.Button
|
||||||
*/
|
*/
|
||||||
public JsonResult createMenu(List<Button> buttons, int agentid)
|
public JsonResult createMenu(int agentid, List<Button> buttons) throws WeixinException {
|
||||||
throws WeixinException {
|
|
||||||
String menu_create_uri = getRequestUri("menu_create_uri");
|
String menu_create_uri = getRequestUri("menu_create_uri");
|
||||||
Token token = tokenHolder.getToken();
|
Token token = tokenHolder.getToken();
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
obj.put("button", buttons);
|
obj.put("button", buttons);
|
||||||
WeixinResponse response = weixinExecutor
|
WeixinResponse response = weixinExecutor.post(String.format(menu_create_uri, token.getAccessToken(), agentid),
|
||||||
.post(String.format(menu_create_uri, token.getAccessToken(),
|
JSON.toJSONString(obj, new NameFilter() {
|
||||||
agentid), JSON.toJSONString(obj, new NameFilter() {
|
|
||||||
@Override
|
@Override
|
||||||
public String process(Object object, String name,
|
public String process(Object object, String name, Object value) {
|
||||||
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
|
} else if (ButtonType.media_id == buttonType || ButtonType.view_limited == buttonType) {
|
||||||
|| ButtonType.view_limited == buttonType) {
|
|
||||||
return "media_id";
|
return "media_id";
|
||||||
} else {
|
} else {
|
||||||
return "key";
|
return "key";
|
||||||
@ -86,18 +84,17 @@ public class MenuApi extends QyApi {
|
|||||||
* 应用ID
|
* 应用ID
|
||||||
* @return 菜单集合
|
* @return 菜单集合
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see <a
|
* @see <a href=
|
||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E8%8F%9C%E5%8D%95%E5%88%97%E8%A1%A8">查询菜单</a>
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E8%8F%9C%E5%8D%95%E5%88%97%E8%A1%A8">
|
||||||
|
* 查询菜单</a>
|
||||||
* @see com.foxinmy.weixin4j.model.Button
|
* @see com.foxinmy.weixin4j.model.Button
|
||||||
*/
|
*/
|
||||||
public List<Button> getMenu(int agentid) throws WeixinException {
|
public List<Button> getMenu(int agentid) 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,
|
WeixinResponse response = weixinExecutor.get(String.format(menu_get_uri, token.getAccessToken(), agentid));
|
||||||
token.getAccessToken(), agentid));
|
|
||||||
|
|
||||||
JSONArray buttons = response.getAsJson().getJSONObject("menu")
|
JSONArray buttons = response.getAsJson().getJSONObject("menu").getJSONArray("button");
|
||||||
.getJSONArray("button");
|
|
||||||
List<Button> buttonList = new ArrayList<Button>(buttons.size());
|
List<Button> buttonList = new ArrayList<Button>(buttons.size());
|
||||||
ParseProcess processor = new ExtraProcessor() {
|
ParseProcess processor = new ExtraProcessor() {
|
||||||
@Override
|
@Override
|
||||||
@ -106,8 +103,7 @@ public class MenuApi extends QyApi {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
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,
|
buttonList.add(JSON.parseObject(buttons.getString(i), Button.class, processor));
|
||||||
processor));
|
|
||||||
}
|
}
|
||||||
return buttonList;
|
return buttonList;
|
||||||
}
|
}
|
||||||
@ -118,15 +114,15 @@ public class MenuApi extends QyApi {
|
|||||||
* @param agentid
|
* @param agentid
|
||||||
* 应用ID
|
* 应用ID
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
* @see <a
|
* @see <a href=
|
||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%A0%E9%99%A4%E8%8F%9C%E5%8D%95">删除菜单</a>
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%A0%E9%99%A4%E8%8F%9C%E5%8D%95">
|
||||||
|
* 删除菜单</a>
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
*/
|
*/
|
||||||
public JsonResult deleteMenu(int agentid) throws WeixinException {
|
public JsonResult deleteMenu(int agentid) 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(
|
WeixinResponse response = weixinExecutor.get(String.format(menu_delete_uri, token.getAccessToken(), agentid));
|
||||||
menu_delete_uri, token.getAccessToken(), agentid));
|
|
||||||
|
|
||||||
return response.getAsJsonResult();
|
return response.getAsJsonResult();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,7 +111,7 @@ public class NotifyApi extends QyApi {
|
|||||||
IdParameter.SEPARATORS)) {
|
IdParameter.SEPARATORS)) {
|
||||||
tagIds.add(Integer.parseInt(id));
|
tagIds.add(Integer.parseInt(id));
|
||||||
}
|
}
|
||||||
idParameter.setPartyIds(tagIds);
|
idParameter.setTagIds(tagIds);
|
||||||
}
|
}
|
||||||
return idParameter;
|
return idParameter;
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ public class NotifyApi extends QyApi {
|
|||||||
*
|
*
|
||||||
* @param kfType
|
* @param kfType
|
||||||
* 客服类型 为空时返回全部类型的客服
|
* 客服类型 为空时返回全部类型的客服
|
||||||
* @return 第一个元素为内部客服(internal),第二个参数为外部客服(external)
|
* @return 第一个元素为内部客服(internal),第二个元素为外部客服(external)
|
||||||
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
||||||
* @see <a
|
* @see <a
|
||||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%AE%A2%E6%9C%8D%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E">客服列表</a>
|
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%AE%A2%E6%9C%8D%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E">客服列表</a>
|
||||||
|
|||||||
@ -146,8 +146,7 @@ public class TagApi extends QyApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增标签成员(标签对管理组可见且未加锁,成员属于管理组管辖范围。)<br>
|
* 新增标签成员(标签对管理组可见且未加锁,成员属于管理组管辖范围。)
|
||||||
* <font color="red">若部分userid或partyid非法,则在text中体现</font>
|
|
||||||
*
|
*
|
||||||
* @param tagId
|
* @param tagId
|
||||||
* 标签ID
|
* 标签ID
|
||||||
@ -159,7 +158,7 @@ public class TagApi extends QyApi {
|
|||||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.A2.9E.E5.8A.A0.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.A2.9E.E5.8A.A0.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
|
||||||
* 新增标签成员说明</a>
|
* 新增标签成员说明</a>
|
||||||
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
||||||
* @return 处理结果
|
* @return 非法的userIds和partyIds
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public IdParameter addTagUsers(int tagId, List<String> userIds,
|
public IdParameter addTagUsers(int tagId, List<String> userIds,
|
||||||
@ -170,7 +169,6 @@ public class TagApi extends QyApi {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除标签成员(标签对管理组未加锁,成员属于管理组管辖范围)<br>
|
* 删除标签成员(标签对管理组未加锁,成员属于管理组管辖范围)<br>
|
||||||
* <font color="red">若部分userid或partyid非法,则在text中体现</font>
|
|
||||||
*
|
*
|
||||||
* @param tagId
|
* @param tagId
|
||||||
* 标签ID
|
* 标签ID
|
||||||
@ -182,7 +180,7 @@ public class TagApi extends QyApi {
|
|||||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.A0.E9.99.A4.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.A0.E9.99.A4.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
|
||||||
* 删除标签成员说明</a>
|
* 删除标签成员说明</a>
|
||||||
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
* @see com.foxinmy.weixin4j.qy.model.IdParameter
|
||||||
* @return 处理结果
|
* @return 非法的userIds和partyIds
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public IdParameter deleteTagUsers(int tagId, List<String> userIds,
|
public IdParameter deleteTagUsers(int tagId, List<String> userIds,
|
||||||
|
|||||||
@ -257,7 +257,7 @@ public class UserApi extends QyApi {
|
|||||||
* @return 成员列表
|
* @return 成员列表
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<User> listUser(int departId, boolean fetchChild,
|
public List<User> listUser(int partyId, boolean fetchChild,
|
||||||
UserStatus userStatus, boolean findDetail) throws WeixinException {
|
UserStatus userStatus, boolean findDetail) throws WeixinException {
|
||||||
String user_list_uri = findDetail ? getRequestUri("user_list_uri")
|
String user_list_uri = findDetail ? getRequestUri("user_list_uri")
|
||||||
: getRequestUri("user_slist_uri");
|
: getRequestUri("user_slist_uri");
|
||||||
@ -266,7 +266,7 @@ public class UserApi extends QyApi {
|
|||||||
userStatus = UserStatus.UNFOLLOW;
|
userStatus = UserStatus.UNFOLLOW;
|
||||||
}
|
}
|
||||||
WeixinResponse response = weixinExecutor.get(String.format(
|
WeixinResponse response = weixinExecutor.get(String.format(
|
||||||
user_list_uri, token.getAccessToken(), departId, fetchChild ? 1
|
user_list_uri, token.getAccessToken(), partyId, fetchChild ? 1
|
||||||
: 0, userStatus.getVal()));
|
: 0, userStatus.getVal()));
|
||||||
List<User> list = null;
|
List<User> list = null;
|
||||||
if (findDetail) {
|
if (findDetail) {
|
||||||
@ -293,14 +293,14 @@ public class UserApi extends QyApi {
|
|||||||
/**
|
/**
|
||||||
* 获取部门下所有状态成员(不进行递归)
|
* 获取部门下所有状态成员(不进行递归)
|
||||||
*
|
*
|
||||||
* @param departId
|
* @param partyId
|
||||||
* 部门ID
|
* 部门ID
|
||||||
* @see {@link #listUser(int, boolean,UserStatus)}
|
* @see {@link #listUser(int, boolean,UserStatus)}
|
||||||
* @return 成员列表
|
* @return 成员列表
|
||||||
* @throws WeixinException
|
* @throws WeixinException
|
||||||
*/
|
*/
|
||||||
public List<User> listUser(int departId) throws WeixinException {
|
public List<User> listUser(int partyId) throws WeixinException {
|
||||||
return listUser(departId, false, UserStatus.BOTH, false);
|
return listUser(partyId, false, UserStatus.BOTH, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public class HelperTest extends TokenTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void backip() throws WeixinException {
|
public void backip() throws WeixinException {
|
||||||
List<String> ips = helperApi.getCallbackip();
|
List<String> ips = helperApi.getWechatServerIp();
|
||||||
Assert.assertTrue(ips != null && !ips.isEmpty());
|
Assert.assertTrue(ips != null && !ips.isEmpty());
|
||||||
System.out.println(ips);
|
System.out.println(ips);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class MenuTest extends TokenTest {
|
|||||||
btnList.add(b);
|
btnList.add(b);
|
||||||
b = new Button("photo", "photo", ButtonType.pic_photo_or_album);
|
b = new Button("photo", "photo", ButtonType.pic_photo_or_album);
|
||||||
btnList.add(b);
|
btnList.add(b);
|
||||||
JsonResult result = menuApi.createMenu(btnList, 1);
|
JsonResult result = menuApi.createMenu(1, btnList);
|
||||||
Assert.assertEquals(0, result.getCode());
|
Assert.assertEquals(0, result.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user