mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 01:48:47 +08:00
fix: 兼容企业微信 userid 随机大小写返回
企业微信 getuserinfo 接口偶发返回 UserId 而非 userid,导致识别为企业外用户。 兼容 userid/UserId 两种 key,避免错误抛出 UNIDENTIFIED_PLATFORM。
This commit is contained in:
parent
c29ecbd847
commit
9fc4d2a7b6
@ -53,10 +53,16 @@ public abstract class AbstractAuthWeChatEnterpriseRequest extends AuthDefaultReq
|
|||||||
|
|
||||||
// 返回 OpenId 或其他,均代表非当前企业用户,不支持
|
// 返回 OpenId 或其他,均代表非当前企业用户,不支持
|
||||||
// https://github.com/justauth/JustAuth/issues/227 修复bug
|
// https://github.com/justauth/JustAuth/issues/227 修复bug
|
||||||
if (!object.containsKey("userid")) {
|
String userId = null;
|
||||||
|
if (object.containsKey("userid")) {
|
||||||
|
userId = object.getString("userid");
|
||||||
|
} else if (object.containsKey("UserId")) {
|
||||||
|
userId = object.getString("UserId");
|
||||||
|
}
|
||||||
|
// 如果两种 key 都不存在,则 userId 仍然为 null,此时抛出异常
|
||||||
|
if (StringUtils.isEmpty(userId)) {
|
||||||
throw new AuthException(AuthResponseStatus.UNIDENTIFIED_PLATFORM, source);
|
throw new AuthException(AuthResponseStatus.UNIDENTIFIED_PLATFORM, source);
|
||||||
}
|
}
|
||||||
String userId = object.getString("userid");
|
|
||||||
String userTicket = object.getString("user_ticket");
|
String userTicket = object.getString("user_ticket");
|
||||||
JSONObject userDetail = getUserDetail(authToken.getAccessToken(), userId, userTicket);
|
JSONObject userDetail = getUserDetail(authToken.getAccessToken(), userId, userTicket);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user