Skip to content

Commit ab916dd

Browse files
committed
issue #138 tagAddUsers 接口少了一个参数
1 parent 29cc3f6 commit ab916dd

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream i
399399
* @param tagId
400400
* @param userIds
401401
*/
402-
void tagAddUsers(String tagId, List<String> userIds) throws WxErrorException;
402+
void tagAddUsers(String tagId, List<String> userIds, List<String> partyIds) throws WxErrorException;
403403

404404
/**
405405
* <pre>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ public List<WxCpDepart> departGet() throws WxErrorException {
271271
return WxCpGsonBuilder.INSTANCE.create()
272272
.fromJson(
273273
tmpJsonElement.getAsJsonObject().get("department"),
274-
new TypeToken<List<WxCpDepart>>() { }.getType()
274+
new TypeToken<List<WxCpDepart>>() {
275+
}.getType()
275276
);
276277
}
277278

@@ -389,7 +390,8 @@ public List<WxCpTag> tagGet() throws WxErrorException {
389390
return WxCpGsonBuilder.INSTANCE.create()
390391
.fromJson(
391392
tmpJsonElement.getAsJsonObject().get("taglist"),
392-
new TypeToken<List<WxCpTag>>() { }.getType()
393+
new TypeToken<List<WxCpTag>>() {
394+
}.getType()
393395
);
394396
}
395397

@@ -406,15 +408,24 @@ public List<WxCpUser> tagGetUsers(String tagId) throws WxErrorException {
406408
}
407409

408410
@Override
409-
public void tagAddUsers(String tagId, List<String> userIds) throws WxErrorException {
411+
public void tagAddUsers(String tagId, List<String> userIds, List<String> partyIds) throws WxErrorException {
410412
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers";
411413
JsonObject jsonObject = new JsonObject();
412414
jsonObject.addProperty("tagid", tagId);
413-
JsonArray jsonArray = new JsonArray();
414-
for (String userId : userIds) {
415-
jsonArray.add(new JsonPrimitive(userId));
415+
if (userIds != null) {
416+
JsonArray jsonArray = new JsonArray();
417+
for (String userId : userIds) {
418+
jsonArray.add(new JsonPrimitive(userId));
419+
}
420+
jsonObject.add("userlist", jsonArray);
421+
}
422+
if (partyIds != null) {
423+
JsonArray jsonArray = new JsonArray();
424+
for (String userId : partyIds) {
425+
jsonArray.add(new JsonPrimitive(userId));
426+
}
427+
jsonObject.add("partylist", jsonArray);
416428
}
417-
jsonObject.add("userlist", jsonArray);
418429
post(url, jsonObject.toString());
419430
}
420431

0 commit comments

Comments
 (0)