Skip to content

Commit

Permalink
fix [ 企业微信第三方服务调用getUserId接口时缺少 access_token. issues binarywang#2799 ]
Browse files Browse the repository at this point in the history
  • Loading branch information
沈军 committed Oct 18, 2022
1 parent b6ad48d commit 64b4856
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,11 @@ public interface WxCpTpUserService {
* </pre>
*
* @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;

/**
* 获取外部联系人详情.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ public String openid2UserId(String openid) throws WxErrorException {
}

@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);
url += "&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();
Expand Down

0 comments on commit 64b4856

Please sign in to comment.