Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取配置了客户联系功能的成员列表,数据为空会报错 #1528

Closed
lyqwhmh2015 opened this issue Apr 23, 2020 · 4 comments
Closed

Comments

@lyqwhmh2015
Copy link

lyqwhmh2015 commented Apr 23, 2020

简要描述
获取配置了客户联系功能的成员列表返回空数据会报错

模块版本情况
WxJava 模块名: weixin-java-cp
WxJava 版本号: 3.7.0
详细描述
获取配置了客户联系功能的成员列表
https://work.weixin.qq.com/api/doc/90001/90143/92576
该接口如果数据为空会直接报错,业务本身存在员工没有外部联系人的情况。这个能解决吗?
目前只是简单try catch 处理,可是还是会有错误日志头疼

        // 查询用户客户列表
List<String> externalUserIdList = Lists.newArrayList();
try {
    externalUserIdList = wxCpService.getExternalContactService().listExternalContacts(userid);
} catch (WxErrorException e) {
    WxError error = e.getError();
    //  not external contact,无客户返回空值不处理
    if (error.getErrorCode() != 84061) {
        throw e;
    }
}

日志

2020-04-23 18:35:33.421 ERROR 1310192 --- [io-9302-exec-13] m.c.w.cp.api.impl.BaseWxCpServiceImpl :
【请求地址】: https://qyapi.weixin.qq.com/cgi-bin/externalcontact/list?userid=LvBiZi&access_token=li5d5hPDmCYS1B2zKwFOnKMSwRZBebI4YvlMSQN1oBAoCOOxqZN3IdlY4YE7dJVTPIQfNw8o6vNivblUI-40BxX5aCkiClDvNo4x9FVGZeozh0tU_Jdmr3eKARA9BUpE89tR6qxqF7LghDcjh0YcHLN6yznjYDAM8cAbvKn3GLWYLQMYYPy2NSVw4M2WemB66qZxTJ2WB0XMiANDeuXNJA
【请求参数】:null
【错误信息】:错误代码:84061, 错误信息:not external contact, hint: [1587638134_59_10c59a36f1cb3c6706ad8e04d0a15d7a], from ip: 115.205.95.244, more info at https://open.work.weixin.qq.com/devtool/query?e=84061,微信原始报文:{"errcode":84061,"errmsg":"not external contact, hint: [1587638134_59_10c59a36f1cb3c6706ad8e04d0a15d7a], from ip: 115.205.95.244, more info at https://open.work.weixin.qq.com/devtool/query?e=84061","external_userid":[]}
@einsitang
Copy link
Member

建议此处可以特殊处理84061转为空数组输出

@binarywang
Copy link
Member

可以考虑优化一下,谢谢提出此问题

@binarywang
Copy link
Member

楼主把接口搞错了。
按你所示代码和日志,应该是这个接口:https://work.weixin.qq.com/api/doc/90001/90143/92264

@binarywang
Copy link
Member

3.7.8.B版本已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants