增加腾讯云短信

This commit is contained in:
2025-08-05 20:08:04 +08:00
parent 7bc94795e5
commit 0fb5189f4e
5 changed files with 232 additions and 23 deletions

View File

@@ -95,11 +95,14 @@ public class LoginController {
return new ResponseEntity<>("code is not same", HttpStatus.BAD_REQUEST);
}
try {
User user = userService.registerByPhone(phone, code, deviceId,new Date());
User user = userService.registerByPhone(phone, code, deviceId, new Date());
TokenPair tokenPair = jwtUtil.generateTokenPair(user.getUserId(), deviceId);
//返回给app保存access_token用来加入header请求接口refresh_token用来更换access_token
return new ResponseEntity<>(tokenPair, HttpStatus.CREATED);
} catch (RuntimeException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
} finally {
redisTemplate.delete(phone);
}
} else {
return new ResponseEntity<>("verify key is expired", HttpStatus.BAD_REQUEST);