mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-04 12:47:46 +08:00
🐛 #2799 [ 企业微信】修复第三方服务调用getUserId接口时缺少access_token的问题
This commit is contained in:
parent
9b78acd0e5
commit
a8a5359c9f
@ -162,10 +162,11 @@ public interface WxCpTpUserService {
|
|||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param mobile 手机号码。长度为5~32个字节
|
* @param mobile 手机号码。长度为5~32个字节
|
||||||
|
* @param corpId – the corp id
|
||||||
* @return userid mobile对应的成员userid
|
* @return userid mobile对应的成员userid
|
||||||
* @throws WxErrorException .
|
* @throws WxErrorException .
|
||||||
*/
|
*/
|
||||||
String getUserId(String mobile) throws WxErrorException;
|
String getUserId(String mobile, String corpId) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取外部联系人详情.
|
* 获取外部联系人详情.
|
||||||
|
@ -186,10 +186,11 @@ public class WxCpTpUserServiceImpl implements WxCpTpUserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUserId(String mobile) throws WxErrorException {
|
public String getUserId(String mobile, String corpId) throws WxErrorException {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("mobile", mobile);
|
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());
|
String responseContent = this.mainService.post(url, jsonObject.toString());
|
||||||
JsonObject tmpJsonElement = GsonParser.parse(responseContent);
|
JsonObject tmpJsonElement = GsonParser.parse(responseContent);
|
||||||
return tmpJsonElement.getAsJsonObject().get("userid").getAsString();
|
return tmpJsonElement.getAsJsonObject().get("userid").getAsString();
|
||||||
|
Loading…
Reference in New Issue
Block a user