issue #78 删除接口支持批量操作

This commit is contained in:
Daniel Qian 2015-01-24 15:27:14 +08:00
parent b8dd3662cd
commit 97dff44b3e
2 changed files with 23 additions and 0 deletions

View File

@ -249,6 +249,17 @@ public interface WxCpService {
*/
void userDelete(String userid) throws WxErrorException;
/**
* <pre>
* 批量删除成员
*
* http://qydev.weixin.qq.com/wiki/index.php?title=管理成员#.E6.89.B9.E9.87.8F.E5.88.A0.E9.99.A4.E6.88.90.E5.91.98
* </pre>
* @param userids 员工UserID列表对应管理端的帐号
* @throws WxErrorException
*/
void userDelete(String[] userids) throws WxErrorException;
/**
* 获取用户
*

View File

@ -219,6 +219,18 @@ public class WxCpServiceImpl implements WxCpService {
get(url, null);
}
@Override
public void userDelete(String[] userids) throws WxErrorException {
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/batchdelete";
JsonObject jsonObject = new JsonObject();
JsonArray jsonArray = new JsonArray();
for (int i = 0; i < userids.length; i++) {
jsonArray.add(new JsonPrimitive(userids[i]));
}
jsonObject.add("useridlist", jsonArray);
post(url, jsonObject.toString());
}
@Override
public WxCpUser userGet(String userid) throws WxErrorException {
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/get?userid=" + userid;