验证码发送修改

master
Xusan 2024-05-21 14:04:17 +08:00
parent f34ee35d91
commit 124e64491d
1 changed files with 10 additions and 2 deletions

View File

@ -183,9 +183,17 @@ public class UserController {
@ApiOperation(value = "手机验证码登录") @ApiOperation(value = "手机验证码登录")
@GetMapping(value = "loginByCode/{phone}/{code}") @GetMapping(value = "loginByCode/{phone}/{code}")
public ResultJson loginByCode(@PathVariable("phone") String phone,@PathVariable("code") String code) { public ResultJson loginByCode(@PathVariable("phone") String phone,@PathVariable("code") String code) throws InvocationTargetException, IllegalAccessException {
return ResultJson.ok(service.loginByCode(phone,code.toUpperCase())); LoginVo loginVo = service.loginByCode(phone, code.toUpperCase());
StpUtil.login(loginVo.getId()); // 使用 user id 登录
// 获取 Token 相关参数
loginVo.setTokenInfo(new AuthToken(StpUtil.getTokenInfo()));
// 更新最后登录时间
service.updateLastDate(loginVo.getId());
return ResultJson.ok(loginVo);
} }