|
@@ -26,7 +26,6 @@ import com.citu.module.system.api.social.dto.SocialWxPhoneNumberInfoRespDTO;
|
|
|
import com.citu.module.system.enums.logger.LoginLogTypeEnum;
|
|
|
import com.citu.module.system.enums.logger.LoginResultEnum;
|
|
|
import com.citu.module.system.enums.oauth2.OAuth2ClientConstants;
|
|
|
-import com.citu.module.system.enums.sms.SmsSceneEnum;
|
|
|
import com.citu.module.system.enums.social.SocialTypeEnum;
|
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
|
import com.xingyuv.captcha.model.common.ResponseModel;
|
|
@@ -80,13 +79,13 @@ public class MdeAuthServiceImpl implements MdeAuthService {
|
|
|
private CaptchaService captchaService;
|
|
|
|
|
|
@VisibleForTesting
|
|
|
- void validateCaptcha(MdeAuthLoginReqVO reqVO) {
|
|
|
+ void validateCaptcha(AppMdeAuthLoginReqVO reqVO) {
|
|
|
// 如果验证码关闭,则不进行校验
|
|
|
if (!captchaEnable) {
|
|
|
return;
|
|
|
}
|
|
|
// 校验验证码
|
|
|
- ValidationUtils.validate(validator, reqVO, MdeAuthLoginReqVO.CodeEnableGroup.class);
|
|
|
+ ValidationUtils.validate(validator, reqVO, AppMdeAuthLoginReqVO.CodeEnableGroup.class);
|
|
|
CaptchaVO captchaVO = new CaptchaVO();
|
|
|
captchaVO.setCaptchaVerification(reqVO.getCaptchaVerification());
|
|
|
ResponseModel response = captchaService.verification(captchaVO);
|
|
@@ -99,7 +98,7 @@ public class MdeAuthServiceImpl implements MdeAuthService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public MdeAuthLoginRespVO login(MdeAuthLoginReqVO reqVO) {
|
|
|
+ public AppMdeAuthLoginRespVO login(AppMdeAuthLoginReqVO reqVO) {
|
|
|
// 校验验证码
|
|
|
validateCaptcha(reqVO);
|
|
|
// 使用手机 + 密码,进行登录。
|
|
@@ -162,7 +161,7 @@ public class MdeAuthServiceImpl implements MdeAuthService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public MdeAuthLoginRespVO smsLogin(MdeAuthSmsLoginReqVO reqVO) {
|
|
|
+ public AppMdeAuthLoginRespVO smsLogin(AppMdeAuthSmsLoginReqVO reqVO) {
|
|
|
// 校验验证码
|
|
|
String userIp = getClientIP();
|
|
|
// smsCodeApi.useSmsCode(MdeAuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MENDUNER_LOGIN.getScene(), userIp).setMobile(reqVO.getPhone())).getCheckedData();
|
|
@@ -184,7 +183,7 @@ public class MdeAuthServiceImpl implements MdeAuthService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public MdeAuthLoginRespVO socialLogin(MdeAuthSocialLoginReqVO reqVO) {
|
|
|
+ public AppMdeAuthLoginRespVO socialLogin(AppMdeAuthSocialLoginReqVO reqVO) {
|
|
|
// 使用 code 授权码,进行登录。然后,获得到绑定的用户编号
|
|
|
SocialUserRespDTO socialUser = socialUserApi.getSocialUserByCode(UserTypeEnum.MEMBER.getValue(), reqVO.getType(),
|
|
|
reqVO.getCode(), reqVO.getState()).getCheckedData();
|
|
@@ -212,7 +211,7 @@ public class MdeAuthServiceImpl implements MdeAuthService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public MdeAuthLoginRespVO weixinMiniAppLogin(MdeAuthWeixinMiniAppLoginReqVO reqVO) {
|
|
|
+ public AppMdeAuthLoginRespVO weixinMiniAppLogin(AppMdeAuthWeixinMiniAppLoginReqVO reqVO) {
|
|
|
// 获得对应的手机号信息
|
|
|
SocialWxPhoneNumberInfoRespDTO phoneNumberInfo = socialClientApi.getWxMaPhoneNumberInfo(
|
|
|
UserTypeEnum.MEMBER.getValue(), reqVO.getPhoneCode()).getCheckedData();
|
|
@@ -237,7 +236,7 @@ public class MdeAuthServiceImpl implements MdeAuthService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void sendSmsCode(Long userId, MdeAuthSmsSendReqVO reqVO) {
|
|
|
+ public void sendSmsCode(Long userId, AppMdeAuthSmsSendReqVO reqVO) {
|
|
|
// // 情况 1:如果是修改手机场景,需要校验新手机号是否已经注册,说明不能使用该手机了
|
|
|
// if (Objects.equals(reqVO.getScene(), SmsSceneEnum.MEMBER_UPDATE_MOBILE.getScene())) {
|
|
|
// MdeUserDO user = userService.getUserByPhone(reqVO.getPhone());
|
|
@@ -264,12 +263,12 @@ public class MdeAuthServiceImpl implements MdeAuthService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void validateSmsCode(Long userId, MdeAuthSmsValidateReqVO reqVO) {
|
|
|
+ public void validateSmsCode(Long userId, AppMdeAuthSmsValidateReqVO reqVO) {
|
|
|
smsCodeApi.validateSmsCode(MdeAuthConvert.INSTANCE.convert(reqVO).setMobile(reqVO.getPhone()));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public MdeAuthLoginRespVO refreshToken(String refreshToken) {
|
|
|
+ public AppMdeAuthLoginRespVO refreshToken(String refreshToken) {
|
|
|
OAuth2AccessTokenRespDTO accessTokenDO = oauth2TokenApi.refreshAccessToken(refreshToken,
|
|
|
OAuth2ClientConstants.CLIENT_ID_DEFAULT).getCheckedData();
|
|
|
return MdeAuthConvert.INSTANCE.convert(accessTokenDO, null);
|
|
@@ -305,8 +304,8 @@ public class MdeAuthServiceImpl implements MdeAuthService {
|
|
|
return UserTypeEnum.MEMBER;
|
|
|
}
|
|
|
|
|
|
- private MdeAuthLoginRespVO createTokenAfterLoginSuccess(MdeUserDO user, String phone,
|
|
|
- LoginLogTypeEnum logType, String openid) {
|
|
|
+ private AppMdeAuthLoginRespVO createTokenAfterLoginSuccess(MdeUserDO user, String phone,
|
|
|
+ LoginLogTypeEnum logType, String openid) {
|
|
|
// 插入登陆日志
|
|
|
createLoginLog(user.getId(), phone, logType, LoginResultEnum.SUCCESS);
|
|
|
// 创建 Token 令牌
|