瀏覽代碼

issue #138 tagAddUsers 接口少了一个参数

master
Daniel Qian 10 年之前
父節點
當前提交
ab916ddd71
共有 2 個檔案被更改,包括 19 行新增8 行删除
  1. +1
    -1
      weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java
  2. +18
    -7
      weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java

+ 1
- 1
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java 查看文件

@@ -399,7 +399,7 @@ public interface WxCpService {
* @param tagId
* @param userIds
*/
void tagAddUsers(String tagId, List<String> userIds) throws WxErrorException;
void tagAddUsers(String tagId, List<String> userIds, List<String> partyIds) throws WxErrorException;

/**
* <pre>


+ 18
- 7
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java 查看文件

@@ -271,7 +271,8 @@ public class WxCpServiceImpl implements WxCpService {
return WxCpGsonBuilder.INSTANCE.create()
.fromJson(
tmpJsonElement.getAsJsonObject().get("department"),
new TypeToken<List<WxCpDepart>>() { }.getType()
new TypeToken<List<WxCpDepart>>() {
}.getType()
);
}

@@ -389,7 +390,8 @@ public class WxCpServiceImpl implements WxCpService {
return WxCpGsonBuilder.INSTANCE.create()
.fromJson(
tmpJsonElement.getAsJsonObject().get("taglist"),
new TypeToken<List<WxCpTag>>() { }.getType()
new TypeToken<List<WxCpTag>>() {
}.getType()
);
}

@@ -406,15 +408,24 @@ public class WxCpServiceImpl implements WxCpService {
}

@Override
public void tagAddUsers(String tagId, List<String> userIds) throws WxErrorException {
public void tagAddUsers(String tagId, List<String> userIds, List<String> partyIds) throws WxErrorException {
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers";
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("tagid", tagId);
JsonArray jsonArray = new JsonArray();
for (String userId : userIds) {
jsonArray.add(new JsonPrimitive(userId));
if (userIds != null) {
JsonArray jsonArray = new JsonArray();
for (String userId : userIds) {
jsonArray.add(new JsonPrimitive(userId));
}
jsonObject.add("userlist", jsonArray);
}
if (partyIds != null) {
JsonArray jsonArray = new JsonArray();
for (String userId : partyIds) {
jsonArray.add(new JsonPrimitive(userId));
}
jsonObject.add("partylist", jsonArray);
}
jsonObject.add("userlist", jsonArray);
post(url, jsonObject.toString());
}



Loading…
取消
儲存