Commit 0fb8f683c894238c90e776758808dea233dba571
1 parent
53d8e731
fix: getPhoneNoInfo 已过期
Showing
2 changed files
with
4 additions
and
5 deletions
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java
| @@ -262,9 +262,9 @@ public class SocialClientServiceImpl implements SocialClientService { | @@ -262,9 +262,9 @@ public class SocialClientServiceImpl implements SocialClientService { | ||
| 262 | public WxMaPhoneNumberInfo getWxMaPhoneNumberInfo(Integer userType, String phoneCode) { | 262 | public WxMaPhoneNumberInfo getWxMaPhoneNumberInfo(Integer userType, String phoneCode) { |
| 263 | WxMaService service = getWxMaService(userType); | 263 | WxMaService service = getWxMaService(userType); |
| 264 | try { | 264 | try { |
| 265 | - return service.getUserService().getPhoneNoInfo(phoneCode); | 265 | + return service.getUserService().getPhoneNumber(phoneCode); |
| 266 | } catch (WxErrorException e) { | 266 | } catch (WxErrorException e) { |
| 267 | - log.error("[getPhoneNoInfo][userType({}) phoneCode({}) 获得手机号失败]", userType, phoneCode, e); | 267 | + log.error("[getPhoneNumber][userType({}) phoneCode({}) 获得手机号失败]", userType, phoneCode, e); |
| 268 | throw exception(SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR); | 268 | throw exception(SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR); |
| 269 | } | 269 | } |
| 270 | } | 270 | } |
| @@ -474,7 +474,6 @@ public class SocialClientServiceImpl implements SocialClientService { | @@ -474,7 +474,6 @@ public class SocialClientServiceImpl implements SocialClientService { | ||
| 474 | 474 | ||
| 475 | /** | 475 | /** |
| 476 | * 校验社交应用是否重复,需要保证 userType + socialType 唯一 | 476 | * 校验社交应用是否重复,需要保证 userType + socialType 唯一 |
| 477 | - * | ||
| 478 | * 原因是,不同端(userType)选择某个社交登录(socialType)时,需要通过 {@link #buildAuthRequest(Integer, Integer)} 构建对应的请求 | 477 | * 原因是,不同端(userType)选择某个社交登录(socialType)时,需要通过 {@link #buildAuthRequest(Integer, Integer)} 构建对应的请求 |
| 479 | * | 478 | * |
| 480 | * @param id 编号 | 479 | * @param id 编号 |
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImplTest.java
| @@ -274,7 +274,7 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest { | @@ -274,7 +274,7 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest { | ||
| 274 | WxMaUserService userService = mock(WxMaUserService.class); | 274 | WxMaUserService userService = mock(WxMaUserService.class); |
| 275 | when(wxMaService.getUserService()).thenReturn(userService); | 275 | when(wxMaService.getUserService()).thenReturn(userService); |
| 276 | WxMaPhoneNumberInfo phoneNumber = randomPojo(WxMaPhoneNumberInfo.class); | 276 | WxMaPhoneNumberInfo phoneNumber = randomPojo(WxMaPhoneNumberInfo.class); |
| 277 | - when(userService.getPhoneNoInfo(eq(phoneCode))).thenReturn(phoneNumber); | 277 | + when(userService.getPhoneNumber(eq(phoneCode))).thenReturn(phoneNumber); |
| 278 | 278 | ||
| 279 | // 调用 | 279 | // 调用 |
| 280 | WxMaPhoneNumberInfo result = socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode); | 280 | WxMaPhoneNumberInfo result = socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode); |
| @@ -291,7 +291,7 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest { | @@ -291,7 +291,7 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest { | ||
| 291 | WxMaUserService userService = mock(WxMaUserService.class); | 291 | WxMaUserService userService = mock(WxMaUserService.class); |
| 292 | when(wxMaService.getUserService()).thenReturn(userService); | 292 | when(wxMaService.getUserService()).thenReturn(userService); |
| 293 | WxErrorException wxErrorException = new WxErrorException(new NullPointerException()); | 293 | WxErrorException wxErrorException = new WxErrorException(new NullPointerException()); |
| 294 | - when(userService.getPhoneNoInfo(eq(phoneCode))).thenThrow(wxErrorException); | 294 | + when(userService.getPhoneNumber(eq(phoneCode))).thenThrow(wxErrorException); |
| 295 | 295 | ||
| 296 | // 调用并断言异常 | 296 | // 调用并断言异常 |
| 297 | assertServiceException(() -> socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode), | 297 | assertServiceException(() -> socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode), |