Skip to content
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

企业微信扫码登录后,接口成功,但是模型字段全部为null #3423

Open
JustryDeng opened this issue Nov 27, 2024 · 6 comments

Comments

@JustryDeng
Copy link

JustryDeng commented Nov 27, 2024

简要描述

企业微信扫码登录,微信测返回成功的json数据后,weixin-java-cp组件未成功解析该json数据,导致返回全为null

模块版本情况

  • WxJava 模块名: weixin-java-cp
  • WxJava 版本号:4.6.0

详细描述

代码

WxCpOauth2UserInfo qyWchatUserInfo = wxCpService.getOauth2Service()
                    .getAuthUserInfo(code);
log.info("qyWchatUserInfo -> {}", qyWchatUserInfo);

输出的日志

2024-11-27 17:21:41.952 DEBUG demo-sys [ed8079c1e119be092c9758355e1c53ad] http-nio-9999-exec-8 me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl:343
【请求地址】: https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?code=-gIW5mK2Cquo1jwW36xK3DdBskeHUCf7-1su3mFC1bw&access_token=m53A1JbK0xL6xRKVhjDRRVr-bRO3BLdQdU_H66QtQOf3f
35GOM9oonqQaZBoSzPffs-0vrspPbertgPA9nb1LSmcOwJVAptdaPZbcdFun7zQ3lxT3bahVoKu7Gze-AQyQckJXo0WH7G4mjhFzYo99c8SJ5xSnNLArkHcMou0UeyeF67kmynw8tDHAjp0hCoi95r0RFJg2nUAi1-sCPi9uw
【请求参数】:null
【响应数据】:{"userid":"qy01c9daec2345ee009b742cd9db","errcode":0,"errmsg":"ok"}

2024-11-27 17:21:41.953 INFO  demo-sys [ed8079c1e119be092c9758355e1c53ad] http-nio-9999-exec-8 c.u.f.i.sys.service.impl.SysLoginServiceImpl:286 qyWchatUserInfo -> WxCpOa
uth2UserInfo(openId=null, deviceId=null, userId=null, userTicket=null, expiresIn=null, externalUserId=null, parentUserId=null, studentUserId=null)
@binarywang binarywang modified the milestones: 4.6.8, 4.7.0, 4.6.9 Dec 1, 2024
@binarywang
Copy link
Owner

【响应数据】:{"userid":"qy01c9daec2345ee009b742cd9db","errcode":0,"errmsg":"ok"}

这个是原始响应吗?

@JustryDeng
Copy link
Author

JustryDeng commented Dec 4, 2024

【响应数据】:{"userid":"qy01c9daec2345ee009b742cd9db","errcode":0,"errmsg":"ok"}

这个是原始响应吗?

是的。 userid的值qy01c9daec2345ee009b742cd9db是我在原值里随机改了几个字母,其余的都没变。

@binarywang
Copy link
Owner

【响应数据】:{"userid":"qy01c9daec2345ee009b742cd9db","errcode":0,"errmsg":"ok"}
这个是原始响应吗?

是的。 userid的值qy01c9daec2345ee009b742cd9db是我在原值里随机改了几个字母,其余的都没变。

原始里都没有,你让我们的SDK上哪里获取啊

@JustryDeng
Copy link
Author

【响应数据】:{"userid":"qy01c9daec2345ee009b742cd9db","errcode":0,"errmsg":"ok"}
这个是原始响应吗?

是的。 userid的值qy01c9daec2345ee009b742cd9db是我在原值里随机改了几个字母,其余的都没变。

原始里都没有,你让我们的SDK上哪里获取啊

是我没表达清楚,官方原始返回值是有的:

  • 微信官方原始的返回值是: {"userid":"11111111111111","errcode":0,"errmsg":"ok"},
  • 我贴在这里的是 {"userid":"11211112211111","errcode":0,"errmsg":"ok"}

@JustryDeng
Copy link
Author

我是要获取userid, 可以看到原始的是返回了userid的,但是我调用WxCpOauth2UserInfo 的getUserId方法,获取到的是null

@binarywang
Copy link
Owner

#3208 这个问题应该在新版本里做了修复的

@binarywang binarywang removed this from the 4.6.9 milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants