Skip to content

Commit

Permalink
issue #78 删除接口支持批量操作
Browse files Browse the repository at this point in the history
  • Loading branch information
chanjarster committed Jan 24, 2015
1 parent b8dd366 commit 97dff44
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,17 @@ WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream i
*/
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;

/**
* 获取用户
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,18 @@ public void userDelete(String userid) throws WxErrorException {
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;
Expand Down

0 comments on commit 97dff44

Please sign in to comment.