From a8a5359c9ffca7bd8867ebd2cf904647915258dc Mon Sep 17 00:00:00 2001 From: cocoa Date: Fri, 21 Oct 2022 17:49:10 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20#2799=20[=20=E4=BC=81=E4=B8=9A=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E3=80=91=E4=BF=AE=E5=A4=8D=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E8=B0=83=E7=94=A8getUserId=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=97=B6=E7=BC=BA=E5=B0=91access=5Ftoken=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../me/chanjar/weixin/cp/tp/service/WxCpTpUserService.java | 3 ++- .../weixin/cp/tp/service/impl/WxCpTpUserServiceImpl.java | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpUserService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpUserService.java index dcda4bae4..0f2fc5dd9 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpUserService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpUserService.java @@ -162,10 +162,11 @@ public interface WxCpTpUserService { * * * @param mobile 手机号码。长度为5~32个字节 + * @param corpId – the corp id * @return userid mobile对应的成员userid * @throws WxErrorException . */ - String getUserId(String mobile) throws WxErrorException; + String getUserId(String mobile, String corpId) throws WxErrorException; /** * 获取外部联系人详情. diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpUserServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpUserServiceImpl.java index 6cbca3bd0..d99262746 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpUserServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpUserServiceImpl.java @@ -186,10 +186,11 @@ public class WxCpTpUserServiceImpl implements WxCpTpUserService { } @Override - public String getUserId(String mobile) throws WxErrorException { + public String getUserId(String mobile, String corpId) throws WxErrorException { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("mobile", mobile); - String url = mainService.getWxCpTpConfigStorage().getApiUrl(GET_USER_ID); + String url = mainService.getWxCpTpConfigStorage().getApiUrl(GET_USER_ID) + + "?access_token=" + mainService.getWxCpTpConfigStorage().getAccessToken(corpId); String responseContent = this.mainService.post(url, jsonObject.toString()); JsonObject tmpJsonElement = GsonParser.parse(responseContent); return tmpJsonElement.getAsJsonObject().get("userid").getAsString();