Skip to content

Fix/accesss token #2843

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

Merged
merged 3 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
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();
Expand Down