update md

This commit is contained in:
jinyu 2015-10-15 23:07:54 +08:00
parent bcc94eed62
commit 85645be705
3 changed files with 85 additions and 47 deletions

View File

@ -110,6 +110,12 @@ public class WeixinProxy {
tokenStorager)); tokenStorager));
} }
/**
* 注意TokenCreator 需为 <font color="red">WeixinTokenCreator</font>
*
* @see com.foxinmy.weixin4j.mp.token.WeixinTokenCreator.WeixinTokenCreator
* @param tokenHolder
*/
public WeixinProxy(TokenHolder tokenHolder) { public WeixinProxy(TokenHolder tokenHolder) {
this.tokenHolder = tokenHolder; this.tokenHolder = tokenHolder;
this.mediaApi = new MediaApi(tokenHolder); this.mediaApi = new MediaApi(tokenHolder);

View File

@ -85,7 +85,8 @@ public class WeixinProxy {
* token存储策略 * token存储策略
*/ */
public WeixinProxy(TokenStorager tokenStorager) { public WeixinProxy(TokenStorager tokenStorager) {
this(QyApi.DEFAULT_WEIXIN_ACCOUNT.getId(), QyApi.DEFAULT_WEIXIN_ACCOUNT.getSecret(), tokenStorager); this(QyApi.DEFAULT_WEIXIN_ACCOUNT.getId(), QyApi.DEFAULT_WEIXIN_ACCOUNT
.getSecret(), tokenStorager);
} }
/** /**
@ -107,10 +108,18 @@ public class WeixinProxy {
* @param tokenStorager * @param tokenStorager
* 企业号token存储器 * 企业号token存储器
*/ */
public WeixinProxy(String corpid, String corpsecret, TokenStorager tokenStorager) { public WeixinProxy(String corpid, String corpsecret,
this(new TokenHolder(new WeixinTokenCreator(corpid, corpsecret), tokenStorager)); TokenStorager tokenStorager) {
this(new TokenHolder(new WeixinTokenCreator(corpid, corpsecret),
tokenStorager));
} }
/**
* 注意TokenCreator 需为 <font color="red">WeixinTokenCreator</font>
*
* @see com.foxinmy.weixin4j.mp.token.WeixinTokenCreator.WeixinTokenCreator
* @param tokenHolder
*/
public WeixinProxy(TokenHolder tokenHolder) { public WeixinProxy(TokenHolder tokenHolder) {
this.tokenHolder = tokenHolder; this.tokenHolder = tokenHolder;
this.partyApi = new PartyApi(tokenHolder); this.partyApi = new PartyApi(tokenHolder);
@ -140,8 +149,7 @@ public class WeixinProxy {
* @param message * @param message
* 客服消息对象 * 客服消息对象
* @return 如果对应用或收件人部门标签任何一个无权限则本次发送失败如果收件人部门或标签不存在发送仍然执行但返回无效的部分 * @return 如果对应用或收件人部门标签任何一个无权限则本次发送失败如果收件人部门或标签不存在发送仍然执行但返回无效的部分
* </br> * </br> { "errcode": 0, "errmsg": "ok", "invaliduser": "UserID1",
* { "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
@ -160,7 +168,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.tuple.MpNews * @see com.foxinmy.weixin4j.tuple.MpNews
* @see com.foxinmy.weixin4j.qy.message.NotifyMessage * @see com.foxinmy.weixin4j.qy.message.NotifyMessage
*/ */
public JSONObject sendNotifyMessage(NotifyMessage message) throws WeixinException { public JSONObject sendNotifyMessage(NotifyMessage message)
throws WeixinException {
return notifyApi.sendNotifyMessage(message); return notifyApi.sendNotifyMessage(message);
} }
@ -178,7 +187,8 @@ public class WeixinProxy {
* 创建自定义菜单</a> * 创建自定义菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
*/ */
public JsonResult createMenu(List<Button> btnList, int agentid) throws WeixinException { public JsonResult createMenu(List<Button> btnList, int agentid)
throws WeixinException {
return menuApi.createMenu(btnList, agentid); return menuApi.createMenu(btnList, agentid);
} }
@ -239,7 +249,8 @@ public class WeixinProxy {
* 上传永久素材文件说明</a> * 上传永久素材文件说明</a>
* @throws WeixinException * @throws WeixinException
*/ */
public MediaUploadResult uploadMedia(int agentid, InputStream is, String fileName) throws WeixinException { public MediaUploadResult uploadMedia(int agentid, InputStream is,
String fileName) throws WeixinException {
return mediaApi.uploadMedia(agentid, is, fileName); return mediaApi.uploadMedia(agentid, is, fileName);
} }
@ -256,7 +267,8 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.type.MediaType * @see com.foxinmy.weixin4j.type.MediaType
* @see {@link #downloadMedia(int,String)} * @see {@link #downloadMedia(int,String)}
*/ */
public File downloadMediaFile(int agentid, String mediaId) throws WeixinException { public File downloadMediaFile(int agentid, String mediaId)
throws WeixinException {
return mediaApi.downloadMediaFile(agentid, mediaId); return mediaApi.downloadMediaFile(agentid, mediaId);
} }
@ -278,7 +290,8 @@ public class WeixinProxy {
* 获取永久媒体说明</a> * 获取永久媒体说明</a>
* @throws WeixinException * @throws WeixinException
*/ */
public MediaDownloadResult downloadMedia(int agentid, String mediaId) throws WeixinException { public MediaDownloadResult downloadMedia(int agentid, String mediaId)
throws WeixinException {
return mediaApi.downloadMedia(agentid, mediaId); return mediaApi.downloadMedia(agentid, mediaId);
} }
@ -301,7 +314,8 @@ 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) throws WeixinException { public String uploadMaterialArticle(int agentid, List<MpArticle> articles)
throws WeixinException {
return mediaApi.uploadMaterialArticle(agentid, articles); return mediaApi.uploadMaterialArticle(agentid, articles);
} }
@ -319,7 +333,8 @@ 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) throws WeixinException { public JsonResult deleteMaterialMedia(int agentid, String mediaId)
throws WeixinException {
return mediaApi.deleteMaterialMedia(agentid, mediaId); return mediaApi.deleteMaterialMedia(agentid, mediaId);
} }
@ -336,7 +351,8 @@ 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) throws WeixinException { public List<MpArticle> downloadArticle(int agentid, String mediaId)
throws WeixinException {
return mediaApi.downloadArticle(agentid, mediaId); return mediaApi.downloadArticle(agentid, mediaId);
} }
@ -357,7 +373,8 @@ public class WeixinProxy {
* 修改永久媒体素材</a> * 修改永久媒体素材</a>
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
*/ */
public String updateMaterialArticle(int agentid, String mediaId, List<MpArticle> articles) throws WeixinException { public String updateMaterialArticle(int agentid, String mediaId,
List<MpArticle> articles) throws WeixinException {
return mediaApi.updateMaterialArticle(agentid, mediaId, articles); return mediaApi.updateMaterialArticle(agentid, mediaId, articles);
} }
@ -399,7 +416,8 @@ 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, Pageable pageable) throws WeixinException { public MediaRecord listMaterialMedia(int agentid, MediaType mediaType,
Pageable pageable) throws WeixinException {
return mediaApi.listMaterialMedia(agentid, mediaType, pageable); return mediaApi.listMaterialMedia(agentid, mediaType, pageable);
} }
@ -415,7 +433,8 @@ 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) throws WeixinException { public List<MediaItem> listAllMaterialMedia(int agentid, MediaType mediaType)
throws WeixinException {
return mediaApi.listAllMaterialMedia(agentid, mediaType); return mediaApi.listAllMaterialMedia(agentid, mediaType);
} }
@ -500,7 +519,8 @@ public class WeixinProxy {
* @return 上传后的mediaId * @return 上传后的mediaId
* @throws WeixinException * @throws WeixinException
*/ */
public String batchUploadParties(List<Party> parties) throws WeixinException { public String batchUploadParties(List<Party> parties)
throws WeixinException {
return mediaApi.batchUploadParties(parties); return mediaApi.batchUploadParties(parties);
} }
@ -536,7 +556,8 @@ public class WeixinProxy {
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult createUser(User user, InputStream avatar) throws WeixinException { public JsonResult createUser(User user, InputStream avatar)
throws WeixinException {
return userApi.createUser(user, avatar); return userApi.createUser(user, avatar);
} }
@ -572,7 +593,8 @@ public class WeixinProxy {
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult updateUser(User user, InputStream avatar) throws WeixinException { public JsonResult updateUser(User user, InputStream avatar)
throws WeixinException {
return userApi.updateUser(user, avatar); return userApi.updateUser(user, avatar);
} }
@ -654,8 +676,8 @@ public class WeixinProxy {
* @return 成员列表 * @return 成员列表
* @throws WeixinException * @throws WeixinException
*/ */
public List<User> listUser(int departId, boolean fetchChild, UserStatus userStatus, boolean findDetail) public List<User> listUser(int departId, boolean fetchChild,
throws WeixinException { UserStatus userStatus, boolean findDetail) throws WeixinException {
return userApi.listUser(departId, fetchChild, userStatus, findDetail); return userApi.listUser(departId, fetchChild, userStatus, findDetail);
} }
@ -701,7 +723,8 @@ public class WeixinProxy {
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult batchDeleteUser(List<String> userIds) throws WeixinException { public JsonResult batchDeleteUser(List<String> userIds)
throws WeixinException {
return userApi.batchDeleteUser(userIds); return userApi.batchDeleteUser(userIds);
} }
@ -719,7 +742,8 @@ public class WeixinProxy {
* 邀请成员关注说明</a> * 邀请成员关注说明</a>
* @throws WeixinException * @throws WeixinException
*/ */
public InviteType inviteUser(String userId, String tips) throws WeixinException { public InviteType inviteUser(String userId, String tips)
throws WeixinException {
return userApi.inviteUser(userId, tips); return userApi.inviteUser(userId, tips);
} }
@ -727,9 +751,8 @@ public class WeixinProxy {
* 创建标签(创建的标签属于管理组;默认为未加锁状态) * 创建标签(创建的标签属于管理组;默认为未加锁状态)
* *
* @param tag * @param tag
* 标签对象</br> * 标签对象</br> 标签名称长度为1~64个字节标签名不可与其他标签重名</br> 标签id整型
* 标签名称长度为1~64个字节标签名不可与其他标签重名</br> * 指定此参数时新增的标签会生成对应的标签id不指定时则以目前最大的id自增
* 标签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>
@ -823,7 +846,8 @@ public class WeixinProxy {
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult addTagUsers(int tagId, List<String> userIds, List<Integer> partyIds) throws WeixinException { public JsonResult addTagUsers(int tagId, List<String> userIds,
List<Integer> partyIds) throws WeixinException {
return tagApi.addTagUsers(tagId, userIds, partyIds); return tagApi.addTagUsers(tagId, userIds, partyIds);
} }
@ -844,7 +868,8 @@ public class WeixinProxy {
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult deleteTagUsers(int tagId, List<String> userIds, List<Integer> partyIds) throws WeixinException { public JsonResult deleteTagUsers(int tagId, List<String> userIds,
List<Integer> partyIds) throws WeixinException {
return tagApi.deleteTagUsers(tagId, userIds, partyIds); return tagApi.deleteTagUsers(tagId, userIds, partyIds);
} }
@ -929,7 +954,8 @@ public class WeixinProxy {
* 邀请成员关注</a> * 邀请成员关注</a>
* @throws WeixinException * @throws WeixinException
*/ */
public String batchInviteUser(IdParameter parameter, Callback callback, String tips) throws WeixinException { public String batchInviteUser(IdParameter parameter, Callback callback,
String tips) throws WeixinException {
return batchApi.inviteUser(parameter, callback, tips); return batchApi.inviteUser(parameter, callback, tips);
} }
@ -937,8 +963,7 @@ public class WeixinProxy {
* 批量更新成员,本接口以userid为主键增量更新企业号通讯录成员 * 批量更新成员,本接口以userid为主键增量更新企业号通讯录成员
* <p> * <p>
* 1.模板中的部门需填写部门ID多个部门用分号分隔部门ID必须为数字</br> * 1.模板中的部门需填写部门ID多个部门用分号分隔部门ID必须为数字</br>
* 2.文件中存在通讯录中也存在的成员更新成员在文件中指定的字段值 </br> * 2.文件中存在通讯录中也存在的成员更新成员在文件中指定的字段值 </br> 3.文件中存在通讯录中不存在的成员执行添加操作</br>
* 3.文件中存在通讯录中不存在的成员执行添加操作</br>
* 4.通讯录中存在文件中不存在的成员保持不变</br> * 4.通讯录中存在文件中不存在的成员保持不变</br>
* </p> * </p>
* *
@ -954,15 +979,15 @@ public class WeixinProxy {
* 批量更新成员</a> * 批量更新成员</a>
* @throws WeixinException * @throws WeixinException
*/ */
public String batchSyncUser(String mediaId, Callback callback) throws WeixinException { public String batchSyncUser(String mediaId, Callback callback)
throws WeixinException {
return batchApi.syncUser(mediaId, callback); return batchApi.syncUser(mediaId, callback);
} }
/** /**
* 批量覆盖成员,本接口以userid为主键全量覆盖企业号通讯录成员任务完成后企业号通讯录成员与提交的文件完全保持一致 * 批量覆盖成员,本接口以userid为主键全量覆盖企业号通讯录成员任务完成后企业号通讯录成员与提交的文件完全保持一致
* <p> * <p>
* 1.模板中的部门需填写部门ID多个部门用分号分隔部门ID必须为数字</br> * 1.模板中的部门需填写部门ID多个部门用分号分隔部门ID必须为数字</br> 2.文件中存在通讯录中也存在的成员完全以文件为准</br>
* 2.文件中存在通讯录中也存在的成员完全以文件为准</br>
* 3.文件中存在通讯录中不存在的成员执行添加操作</br> * 3.文件中存在通讯录中不存在的成员执行添加操作</br>
* 4.通讯录中存在文件中不存在的成员执行删除操作出于安全考虑如果需要删除的成员多于50人 * 4.通讯录中存在文件中不存在的成员执行删除操作出于安全考虑如果需要删除的成员多于50人
* 且多于现有人数的20%以上系统将中止导入并返回相应的错误码 * 且多于现有人数的20%以上系统将中止导入并返回相应的错误码
@ -980,7 +1005,8 @@ public class WeixinProxy {
* 批量覆盖成员</a> * 批量覆盖成员</a>
* @throws WeixinException * @throws WeixinException
*/ */
public String batchReplaceUser(String mediaId, Callback callback) throws WeixinException { public String batchReplaceUser(String mediaId, Callback callback)
throws WeixinException {
return batchApi.replaceUser(mediaId, callback); return batchApi.replaceUser(mediaId, callback);
} }
@ -1006,8 +1032,7 @@ public class WeixinProxy {
/** /**
* 批量覆盖部门,本接口以partyid为键全量覆盖企业号通讯录组织架构任务完成后企业号通讯录组织架构与提交的文件完全保持一致 * 批量覆盖部门,本接口以partyid为键全量覆盖企业号通讯录组织架构任务完成后企业号通讯录组织架构与提交的文件完全保持一致
* <p> * <p>
* 1.文件中存在通讯录中也存在的部门执行修改操作</br> * 1.文件中存在通讯录中也存在的部门执行修改操作</br> 2.文件中存在通讯录中不存在的部门执行添加操作</br>
* 2.文件中存在通讯录中不存在的部门执行添加操作</br>
* 3.文件中不存在通讯录中存在的部门当部门为空时执行删除操作</br> * 3.文件中不存在通讯录中存在的部门当部门为空时执行删除操作</br>
* 4.CSV文件中部门名称部门ID父部门ID为必填字段部门ID必须为数字排序为可选字段置空或填0不修改排序 * 4.CSV文件中部门名称部门ID父部门ID为必填字段部门ID必须为数字排序为可选字段置空或填0不修改排序
* </p> * </p>
@ -1024,7 +1049,8 @@ public class WeixinProxy {
* 批量覆盖部门</a> * 批量覆盖部门</a>
* @throws WeixinException * @throws WeixinException
*/ */
public String batchReplaceParty(String mediaId, Callback callback) throws WeixinException { public String batchReplaceParty(String mediaId, Callback callback)
throws WeixinException {
return batchApi.replaceParty(mediaId, callback); return batchApi.replaceParty(mediaId, callback);
} }
@ -1060,7 +1086,8 @@ 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) throws WeixinException { public String[] userid2openid(String userid, int agentid)
throws WeixinException {
return userApi.userid2openid(userid, agentid); return userApi.userid2openid(userid, agentid);
} }
@ -1134,7 +1161,8 @@ public class WeixinProxy {
* 修改会话信息</a> * 修改会话信息</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult updateChat(ChatInfo chatInfo, String operator, List<String> addUsers, List<String> deleteUsers) public JsonResult updateChat(ChatInfo chatInfo, String operator,
List<String> addUsers, List<String> deleteUsers)
throws WeixinException { throws WeixinException {
return chatApi.updateChat(chatInfo, operator, addUsers, deleteUsers); return chatApi.updateChat(chatInfo, operator, addUsers, deleteUsers);
} }
@ -1153,7 +1181,8 @@ public class WeixinProxy {
* 退出会话</a> * 退出会话</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult quitChat(String chatId, String operator) throws WeixinException { public JsonResult quitChat(String chatId, String operator)
throws WeixinException {
return chatApi.quitChat(chatId, operator); return chatApi.quitChat(chatId, operator);
} }
@ -1173,7 +1202,8 @@ public class WeixinProxy {
* 清除会话未读状态</a> * 清除会话未读状态</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult clearChatNotify(String targetId, String owner, ChatType chatType) throws WeixinException { public JsonResult clearChatNotify(String targetId, String owner,
ChatType chatType) throws WeixinException {
return chatApi.clearChatNotify(targetId, owner, chatType); return chatApi.clearChatNotify(targetId, owner, chatType);
} }
@ -1191,7 +1221,8 @@ public class WeixinProxy {
* @return 列表中不存在的成员剩余合法成员会继续执行 * @return 列表中不存在的成员剩余合法成员会继续执行
* @throws WeixinException * @throws WeixinException
*/ */
public List<String> setChatMute(List<ChatMute> chatMutes) throws WeixinException { public List<String> setChatMute(List<ChatMute> chatMutes)
throws WeixinException {
return chatApi.setChatMute(chatMutes); return chatApi.setChatMute(chatMutes);
} }
@ -1208,9 +1239,10 @@ public class WeixinProxy {
* 发送消息</a> * 发送消息</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult sendChatMessage(ChatMessage message) throws WeixinException { public JsonResult sendChatMessage(ChatMessage message)
throws WeixinException {
return chatApi.sendChatMessage(message); return chatApi.sendChatMessage(message);
} }
public final static String VERSION = "1.6.1"; public final static String VERSION = "1.6.2";
} }

View File

@ -91,5 +91,5 @@ public class WeixinSuiteProxy {
return this.suiteMap.get(suiteId); return this.suiteMap.get(suiteId);
} }
public final static String VERSION = "1.6.1"; public final static String VERSION = "1.6.2";
} }