新增手机号注册接口
This commit is contained in:
@@ -48,6 +48,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/hxz/v1/**",
|
||||
"/api/sendSmsCaptcha",
|
||||
"/api/loginBySms",
|
||||
"/api/regByPhone",
|
||||
"/api/parseToken/*",
|
||||
"/api/login-alipay/*",
|
||||
"/api/wx-login/loginByMpWxPhone",
|
||||
|
||||
@@ -111,6 +111,21 @@ public class UserController extends BaseController {
|
||||
return success("登录成功", new LoginResult(access_token, user));
|
||||
}
|
||||
|
||||
@ApiOperation("手机号注册")
|
||||
@PostMapping("/regByPhone")
|
||||
public ApiResult<?> regByPhone(@RequestBody User user) {
|
||||
user.setPassword(userService.encodePassword(user.getPassword()));
|
||||
// 排重
|
||||
final User byPhone = userService.getByPhone(user.getPhone());
|
||||
if (ObjectUtil.isNotEmpty(byPhone)) {
|
||||
return fail("该手机号码已存在");
|
||||
}
|
||||
if (userService.saveUser(user)) {
|
||||
return success("添加成功", user.getUserId());
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:user:save')")
|
||||
@ApiOperation("添加用户")
|
||||
@PostMapping()
|
||||
|
||||
Reference in New Issue
Block a user