汽修登录 注册 验证码

This commit is contained in:
nyoung 2024-09-20 11:16:36 +08:00
parent 8b253be951
commit 3ccf1e83d7

View File

@ -212,6 +212,10 @@ public class SysLoginController {
AuthLoginReqVO authLoginReqVO = new AuthLoginReqVO();
authLoginReqVO.setUsername(loginBody.getUsername());
authLoginReqVO.setPassword(loginBody.getPassword());
if(org.apache.commons.lang3.StringUtils.isEmpty(user.getMobile())){
// 借用此字段设置需要填写手机号标志 为1时弹出验证手机号页面
authLoginReqVO.setSocialState("1");
}
return success(loginService.login(authLoginReqVO));
}
@ -230,20 +234,16 @@ public class SysLoginController {
}
/**
* 汽修小程序注册方法
* 汽修小程序更新用户手机号方法
*
* @param registerVO 登录信息
* @return 结果
*/
@PostMapping("/registerQx")
@TenantIgnore
@PostMapping("/updateUserQx")
public CommonResult registerQx(@RequestBody RegisterVO registerVO){
if(org.apache.commons.lang3.StringUtils.isEmpty(registerVO.getPhone())){
return error(500,"手机号不能为空");
}
if(org.apache.commons.lang3.StringUtils.isEmpty(registerVO.getPassword())){
return error(500,"密码不能为空");
}
if(org.apache.commons.lang3.StringUtils.isEmpty(registerVO.getCode())){
return error(500,"验证码不能为空");
}
@ -253,12 +253,13 @@ public class SysLoginController {
}
redisCache2.deleteObject(registerVO.getPhone() + "-registerCode");
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
userSaveReqVO.setUsername(registerVO.getPhone());
userSaveReqVO.setPassword(passwordEncoder.encode(registerVO.getPassword()));
userSaveReqVO.setId(loginUser.getId());
userSaveReqVO.setMobile(registerVO.getPhone());
userService.createUser(userSaveReqVO);
return success("注册成功");
userService.updateUser(userSaveReqVO);
return success("成功");
}