:art:【企业微信】获取客服账号列表接口增加分页支持
Co-authored-by: jinxiaoyi <jinxiaoyi@gaohua-tech.cn>
This commit is contained in:
@@ -47,11 +47,12 @@ public interface WxCpKfService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取客服帐号列表,包括所有的客服帐号的客服ID、名称和头像。
|
* 获取客服帐号列表,包括所有的客服帐号的客服ID、名称和头像。
|
||||||
*
|
* @param offset 分页,偏移量, 默认为0
|
||||||
|
* @param limit 分页,预期请求的数据量,默认为100,取值范围 1 ~ 100
|
||||||
* @return 客服帐号列表
|
* @return 客服帐号列表
|
||||||
* @throws WxErrorException 异常
|
* @throws WxErrorException 异常
|
||||||
*/
|
*/
|
||||||
WxCpKfAccountListResp listAccount() throws WxErrorException;
|
WxCpKfAccountListResp listAccount(Integer offset,Integer limit) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业可通过此接口获取带有不同参数的客服链接,不同客服帐号对应不同的客服链接。获取后,企业可将链接嵌入到网页等场景中,
|
* 企业可通过此接口获取带有不同参数的客服链接,不同客服帐号对应不同的客服链接。获取后,企业可将链接嵌入到网页等场景中,
|
||||||
|
|||||||
@@ -49,9 +49,16 @@ public class WxCpKfServiceImpl implements WxCpKfService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxCpKfAccountListResp listAccount() throws WxErrorException {
|
public WxCpKfAccountListResp listAccount(Integer offset,Integer limit) throws WxErrorException {
|
||||||
String url = cpService.getWxCpConfigStorage().getApiUrl(ACCOUNT_LIST);
|
String url = cpService.getWxCpConfigStorage().getApiUrl(ACCOUNT_LIST);
|
||||||
String responseContent = cpService.post(url, "{}");
|
JsonObject json = new JsonObject();
|
||||||
|
if (offset != null) {
|
||||||
|
json.addProperty("offset", offset);
|
||||||
|
}
|
||||||
|
if (limit != null) {
|
||||||
|
json.addProperty("limit", limit);
|
||||||
|
}
|
||||||
|
String responseContent = cpService.post(url, json.toString());
|
||||||
return WxCpKfAccountListResp.fromJson(responseContent);
|
return WxCpKfAccountListResp.fromJson(responseContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class WxCpKfServiceImplTest {
|
|||||||
|
|
||||||
@Test(priority = 3)
|
@Test(priority = 3)
|
||||||
public void testAccountList() throws Exception {
|
public void testAccountList() throws Exception {
|
||||||
WxCpKfAccountListResp resp = this.wxService.getKfService().listAccount();
|
WxCpKfAccountListResp resp = this.wxService.getKfService().listAccount(0,10);
|
||||||
System.out.println(resp);
|
System.out.println(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user