binarywang / weixin-java-miniapp-demo

基于Spring Boot 和 WxJava 实现的微信小程序Java后端Demo
1.32k stars 669 forks source link

在同时获取SessionKey 后直接获取用户手机号会异常 #40

Closed chenweibo closed 3 years ago

chenweibo commented 3 years ago

WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(code); WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(session.getSessionKey(), encryptedData, iv); 单独获取就不会。 可能是因为session接口还没完成就已经运行了 下面获取手机号。 现在的 微信小程序登陆基本上 获取手机号用作用户登陆。这样子合并操作 会导致 java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ 这个异常。 单独使用却不会出。 然后 这个异常的出现后 第二次请求的时候就不会出现。 可能是 第一次请求腾讯接口有相应延迟。 第二次就速度快了。就不会出异常

chenweibo commented 3 years ago

没有序列号完完全全拿 demo里面的文件跑

Snipaste_2021-01-15_16-06-29
chenweibo commented 3 years ago
Snipaste_2021-01-15_16-06-29
binarywang commented 3 years ago

请查阅wxjava的wiki常见问题

binarywang commented 3 years ago

或者参考wxjava的issue置顶区问题

chenweibo commented 3 years ago

thinks