From 97dff44b3e6b587ab785cf8ed42796f1535cfded Mon Sep 17 00:00:00 2001 From: Daniel Qian Date: Sat, 24 Jan 2015 15:27:14 +0800 Subject: [PATCH] =?UTF-8?q?issue=20#78=20=E5=88=A0=E9=99=A4=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=94=AF=E6=8C=81=E6=89=B9=E9=87=8F=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/me/chanjar/weixin/cp/api/WxCpService.java | 11 +++++++++++ .../me/chanjar/weixin/cp/api/WxCpServiceImpl.java | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java index e48678f81..3c84bec84 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java @@ -249,6 +249,17 @@ public interface WxCpService { */ void userDelete(String userid) throws WxErrorException; + /** + *
+   * 批量删除成员
+   *
+   * 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
+   * 
+ * @param userids 员工UserID列表。对应管理端的帐号 + * @throws WxErrorException + */ + void userDelete(String[] userids) throws WxErrorException; + /** * 获取用户 * diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java index 7722f9e8f..3f14a53c8 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java @@ -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;