Pārlūkot izejas kodu

fix: getPhoneNoInfo 已过期

xingyu4j 5 mēneši atpakaļ
vecāks
revīzija
0fb8f683c8

+ 2 - 3
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java

@@ -262,9 +262,9 @@ public class SocialClientServiceImpl implements SocialClientService {
     public WxMaPhoneNumberInfo getWxMaPhoneNumberInfo(Integer userType, String phoneCode) {
         WxMaService service = getWxMaService(userType);
         try {
-            return service.getUserService().getPhoneNoInfo(phoneCode);
+            return service.getUserService().getPhoneNumber(phoneCode);
         } catch (WxErrorException e) {
-            log.error("[getPhoneNoInfo][userType({}) phoneCode({}) 获得手机号失败]", userType, phoneCode, e);
+            log.error("[getPhoneNumber][userType({}) phoneCode({}) 获得手机号失败]", userType, phoneCode, e);
             throw exception(SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR);
         }
     }
@@ -474,7 +474,6 @@ public class SocialClientServiceImpl implements SocialClientService {
 
     /**
      * 校验社交应用是否重复,需要保证 userType + socialType 唯一
-     *
      * 原因是,不同端(userType)选择某个社交登录(socialType)时,需要通过 {@link #buildAuthRequest(Integer, Integer)} 构建对应的请求
      *
      * @param id         编号

+ 2 - 2
yudao-module-system/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImplTest.java

@@ -274,7 +274,7 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest {
         WxMaUserService userService = mock(WxMaUserService.class);
         when(wxMaService.getUserService()).thenReturn(userService);
         WxMaPhoneNumberInfo phoneNumber = randomPojo(WxMaPhoneNumberInfo.class);
-        when(userService.getPhoneNoInfo(eq(phoneCode))).thenReturn(phoneNumber);
+        when(userService.getPhoneNumber(eq(phoneCode))).thenReturn(phoneNumber);
 
         // 调用
         WxMaPhoneNumberInfo result = socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode);
@@ -291,7 +291,7 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest {
         WxMaUserService userService = mock(WxMaUserService.class);
         when(wxMaService.getUserService()).thenReturn(userService);
         WxErrorException wxErrorException = new WxErrorException(new NullPointerException());
-        when(userService.getPhoneNoInfo(eq(phoneCode))).thenThrow(wxErrorException);
+        when(userService.getPhoneNumber(eq(phoneCode))).thenThrow(wxErrorException);
 
         // 调用并断言异常
         assertServiceException(() -> socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode),