|
|
@@ -66,7 +66,7 @@ public class HomeController extends BaseController {
|
|
66
|
66
|
@ApiOperation("登录")
|
|
67
|
67
|
@PostMapping("/login")
|
|
68
|
68
|
public AjaxResult Login(@RequestBody LoginInput input) {
|
|
69
|
|
- if (input == null || StringHelper.isEmpty(input.getUsername()) || StringHelper.isEmpty(input.getPassword()) || StringHelper.isEmpty(input.getCode())) {
|
|
|
69
|
+ if (input == null || StringHelper.isEmpty(input.getUserName()) || StringHelper.isEmpty(input.getPassword()) || StringHelper.isEmpty(input.getCode())) {
|
|
70
|
70
|
return Error("请输入账号、密码、验证码");
|
|
71
|
71
|
}
|
|
72
|
72
|
if (StringHelper.isEmpty(input.getUuid())) {
|
|
|
@@ -78,9 +78,9 @@ public class HomeController extends BaseController {
|
|
78
|
78
|
return Error("验证码已过期");
|
|
79
|
79
|
}
|
|
80
|
80
|
LambdaQueryWrapper<User> qw = new LambdaQueryWrapper<>();
|
|
81
|
|
- qw.eq(User::getUser_name, input.getUsername())
|
|
|
81
|
+ qw.eq(User::getUserName, input.getUserName())
|
|
82
|
82
|
.eq(User::getPassword, DigestUtils.md5DigestAsHex(input.getPassword().getBytes()))
|
|
83
|
|
- .eq(User::getDel_flag, 0);
|
|
|
83
|
+ .eq(User::getDelFlag, 0);
|
|
84
|
84
|
User entity = userService.getEntity(qw);
|
|
85
|
85
|
if (entity == null) {
|
|
86
|
86
|
return Error("账号或者密码错误");
|
|
|
@@ -90,11 +90,11 @@ public class HomeController extends BaseController {
|
|
90
|
90
|
}
|
|
91
|
91
|
redisHelper.deleteCache(verifyKey);
|
|
92
|
92
|
|
|
93
|
|
- List<Long> roleids = userRoleService.getList().stream().filter(p -> p.getUser_id().equals(entity.getUser_id()))
|
|
94
|
|
- .map(p -> p.getRole_id()).sorted().collect(Collectors.toList());
|
|
|
93
|
+ List<Long> roleids = userRoleService.getList().stream().filter(p -> p.getUserId().equals(entity.getUserId()))
|
|
|
94
|
+ .map(p -> p.getRoleId()).sorted().collect(Collectors.toList());
|
|
95
|
95
|
|
|
96
|
96
|
Map<String, Object> cls = new HashMap<String, Object>();
|
|
97
|
|
- cls.put("UserId", entity.getUser_id());
|
|
|
97
|
+ cls.put("UserId", entity.getUserId());
|
|
98
|
98
|
cls.put("RoleIds", roleids);
|
|
99
|
99
|
String token = JwtHelper.createToken(cls);
|
|
100
|
100
|
return Success("登录成功", token);
|
|
|
@@ -104,11 +104,11 @@ public class HomeController extends BaseController {
|
|
104
|
104
|
@PostMapping("/login/user")
|
|
105
|
105
|
public AjaxResult Login(@RequestBody User user) {
|
|
106
|
106
|
if (!userService.checkUserNameUnique(user)) {
|
|
107
|
|
- return Error("注册用户'" + user.getUser_name() + "'失败,登录账号已存在");
|
|
|
107
|
+ return Error("注册用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
108
|
108
|
} else if (StringHelper.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
|
109
|
|
- return Error("注册用户'" + user.getUser_name() + "'失败,手机号码已存在");
|
|
|
109
|
+ return Error("注册用户'" + user.getUserName() + "'失败,手机号码已存在");
|
|
110
|
110
|
} else if (StringHelper.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
|
111
|
|
- return Error("注册用户'" + user.getUser_name() + "'失败,邮箱账号已存在");
|
|
|
111
|
+ return Error("注册用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
|
112
|
112
|
}
|
|
113
|
113
|
|
|
114
|
114
|
String md5Password = DigestUtils.md5DigestAsHex((user.getPassword()).getBytes());
|