Skip to content

Commit 44a9557

Browse files
authored
🐛 #3508 【企业微信】获取企业用户信息接口修复用户信息大小写导致的问题
1 parent 2bf3141 commit 44a9557

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import me.chanjar.weixin.cp.bean.workbench.WxCpSecondVerificationInfo;
1414
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
1515

16+
import java.util.Optional;
17+
1618
import static me.chanjar.weixin.common.api.WxConsts.OAuth2Scope.*;
1719
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.OAuth2.*;
1820

@@ -74,9 +76,9 @@ public WxCpOauth2UserInfo getUserInfo(Integer agentId, String code) throws WxErr
7476
JsonObject jo = GsonParser.parse(responseText);
7577

7678
return WxCpOauth2UserInfo.builder()
77-
.userId(GsonHelper.getString(jo, "UserId"))
79+
.userId(Optional.ofNullable(GsonHelper.getString(jo, "UserId")).orElse(GsonHelper.getString(jo, "userid")))
7880
.deviceId(GsonHelper.getString(jo, "DeviceId"))
79-
.openId(GsonHelper.getString(jo, "OpenId"))
81+
.openId(Optional.ofNullable(GsonHelper.getString(jo, "OpenId")).orElse(GsonHelper.getString(jo, "openid")))
8082
.userTicket(GsonHelper.getString(jo, "user_ticket"))
8183
.expiresIn(GsonHelper.getString(jo, "expires_in"))
8284
.externalUserId(GsonHelper.getString(jo, "external_userid"))

0 commit comments

Comments
 (0)