|
|
@ -103,7 +103,6 @@ public class LoginController extends BaseController {
|
|
|
|
@VerifyParam LoginReq loginReq) {
|
|
|
|
@VerifyParam LoginReq loginReq) {
|
|
|
|
// 得到缓存中的验证码
|
|
|
|
// 得到缓存中的验证码
|
|
|
|
String redisMobileCheckCodeKey = Constants.REDIS_KEY_MOBILE_CHECK_CODE + loginReq.getDeviceId();
|
|
|
|
String redisMobileCheckCodeKey = Constants.REDIS_KEY_MOBILE_CHECK_CODE + loginReq.getDeviceId();
|
|
|
|
try {
|
|
|
|
|
|
|
|
String redisMobileCheckCode = (String) redisTemplate.opsForValue().get(redisMobileCheckCodeKey);
|
|
|
|
String redisMobileCheckCode = (String) redisTemplate.opsForValue().get(redisMobileCheckCodeKey);
|
|
|
|
if (StringTools.isEmpty(redisMobileCheckCode)) {
|
|
|
|
if (StringTools.isEmpty(redisMobileCheckCode)) {
|
|
|
|
return Result.failed(StatusCode.USER_MOBILE_VERIFICATION_CODE_EXPIRED);
|
|
|
|
return Result.failed(StatusCode.USER_MOBILE_VERIFICATION_CODE_EXPIRED);
|
|
|
@ -116,10 +115,9 @@ public class LoginController extends BaseController {
|
|
|
|
loginUserInfo.setLastUseDeviceId(loginReq.getDeviceId());
|
|
|
|
loginUserInfo.setLastUseDeviceId(loginReq.getDeviceId());
|
|
|
|
loginUserInfo.setLastUseDeviceBrand(loginReq.getDeviceBrand());
|
|
|
|
loginUserInfo.setLastUseDeviceBrand(loginReq.getDeviceBrand());
|
|
|
|
loginUserInfo.setLastLoginIp(getIpAddr(request));
|
|
|
|
loginUserInfo.setLastLoginIp(getIpAddr(request));
|
|
|
|
return Result.success(userInfoService.loginOrRegister(loginUserInfo));
|
|
|
|
String token = userInfoService.loginOrRegister(loginUserInfo);
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
redisTemplate.delete(redisMobileCheckCodeKey);
|
|
|
|
redisTemplate.delete(redisMobileCheckCodeKey);
|
|
|
|
}
|
|
|
|
return Result.success(token);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|