#541 企业号增加实现管理标签的(获取标签成员)接口

* 定义《企业号应用》的bean

* 增加《获取企业号应用》接口实现

* 增加获取测试企业号应用信息测试类

* tag service增加获取标签成员方法
http://qydev.weixin.qq.com/wiki/index.php?title=管理标签
This commit is contained in:
huansinho
2018-04-16 11:53:35 +08:00
committed by Binary Wang
parent 558f4e7880
commit 74faa2a03e
4 changed files with 110 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package me.chanjar.weixin.cp.api;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.cp.bean.WxCpTag;
import me.chanjar.weixin.cp.bean.WxCpTagAddOrRemoveUsersResult;
import me.chanjar.weixin.cp.bean.WxCpTagGetResult;
import me.chanjar.weixin.cp.bean.WxCpUser;
import java.util.List;
@@ -63,4 +64,16 @@ public interface WxCpTagService {
* @param userIds 用户id列表
*/
WxCpTagAddOrRemoveUsersResult removeUsersFromTag(String tagId, List<String> userIds) throws WxErrorException;
/**
* 获取标签成员
* 对应: http://qydev.weixin.qq.com/wiki/index.php?title=管理标签 中的get接口
*
* @param tagId
* @return
* @throws WxErrorException
*/
WxCpTagGetResult get(String tagId) throws WxErrorException;
}

View File

@@ -7,6 +7,7 @@ import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.api.WxCpTagService;
import me.chanjar.weixin.cp.bean.WxCpTag;
import me.chanjar.weixin.cp.bean.WxCpTagAddOrRemoveUsersResult;
import me.chanjar.weixin.cp.bean.WxCpTagGetResult;
import me.chanjar.weixin.cp.bean.WxCpUser;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
@@ -113,4 +114,18 @@ public class WxCpTagServiceImpl implements WxCpTagService {
return WxCpTagAddOrRemoveUsersResult.fromJson(this.mainService.post(url, jsonObject.toString()));
}
@Override
public WxCpTagGetResult get(String tagId) throws WxErrorException {
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/get";
if (tagId != null) {
url += "?tagId=" + tagId;
} else {
throw new IllegalArgumentException("缺少tagId参数");
}
String responseContent = this.mainService.get(url, null);
return WxCpTagGetResult.fromJson(responseContent);
}
}