修改:
1.新增检查登录爬大哥客户端登录接口
This commit is contained in:
@@ -63,4 +63,35 @@ public class UserController {
|
||||
return ResultUtils.success(systemUsersVO);
|
||||
}
|
||||
|
||||
// 用户登陆接口
|
||||
@PostMapping("bigbrother-doLogin")
|
||||
public BaseResponse<SystemUsersVO> bigBrotherDoLogin(@RequestBody SystemUsersDTO usersDTO) {
|
||||
SystemUsers user = usersService.getUserByUserName(usersDTO.getUsername(),usersDTO.getTenantId());
|
||||
if (user == null) {
|
||||
throw new BusinessException(ErrorCode.USERNAME_OR_PASSWORD_ERROR);
|
||||
}
|
||||
if (!usersService.isPasswordMatch(usersDTO.getPassword(), user.getPassword())) {
|
||||
throw new BusinessException(ErrorCode.USERNAME_OR_PASSWORD_ERROR);
|
||||
}
|
||||
|
||||
if (CommonStatusEnum.isDisable(Integer.valueOf(user.getStatus()))) {
|
||||
throw new BusinessException(ErrorCode.USER_DISABLE);
|
||||
}
|
||||
if (usersService.isExpired(usersDTO.getTenantId())){
|
||||
throw new BusinessException(ErrorCode.PACKAGE_EXPIRED);
|
||||
}
|
||||
if (!usersService.checkbigBrotherlRole(user.getId())){
|
||||
throw new BusinessException(ErrorCode.LOGIN_NOW_ALLOWED);
|
||||
}
|
||||
Long second = usersService.getTenantExpiredTime(usersDTO.getTenantId());
|
||||
SystemUsersVO systemUsersVO = new SystemUsersVO();
|
||||
BeanUtil.copyProperties(user, systemUsersVO);
|
||||
// 赋予用户 Id
|
||||
StpUtil.login(user.getId());
|
||||
// 设置 token 有效期为当前日期和套餐有效期的差值
|
||||
StpUtil.renewTimeout(second);
|
||||
systemUsersVO.setTokenName(StpUtil.getTokenName());
|
||||
systemUsersVO.setTokenValue(StpUtil.getTokenValue());
|
||||
return ResultUtils.success(systemUsersVO);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user