Commit b0a50a16 by 段启岩

添加封号操作

parent 5f7d02ea
...@@ -60,6 +60,9 @@ public class User implements Serializable { ...@@ -60,6 +60,9 @@ public class User implements Serializable {
@ApiModelProperty(value = "本阶段昵称修改次数") @ApiModelProperty(value = "本阶段昵称修改次数")
private Integer nickModifyCount; private Integer nickModifyCount;
@ApiModelProperty(value = "用户状态")
private Integer status;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
......
...@@ -29,7 +29,8 @@ public enum UserErrorCode implements IErrorCode { ...@@ -29,7 +29,8 @@ public enum UserErrorCode implements IErrorCode {
NON_LOCAL_AUTH_INFO(10016, "该手机未注册"), NON_LOCAL_AUTH_INFO(10016, "该手机未注册"),
USER_NOT_EXISTS(10017, "要查看的用户不存在"), USER_NOT_EXISTS(10017, "要查看的用户不存在"),
USER_NICK_NAME_USED(10018,"该昵称已存在"), USER_NICK_NAME_USED(10018,"该昵称已存在"),
NICK_MODIFY_UPPER_LIMIT(10019, "本月昵称修改次数已达上限"); NICK_MODIFY_UPPER_LIMIT(10019, "本月昵称修改次数已达上限"),
USER_DISABLED(10020, "您已被封号,请联系管理员解封");
UserErrorCode(long code, String msg) { UserErrorCode(long code, String msg) {
this.code = code; this.code = code;
......
package cn.meteor.beyondclouds.modules.user.enums;
import lombok.Getter;
/**
* @author meteor
*/
@Getter
public enum UserStatus {
NORMAL(0),
DISABLED(1)
;
private Integer status;
UserStatus(Integer status) {
this.status = status;
}
}
...@@ -9,12 +9,10 @@ import cn.meteor.beyondclouds.core.redis.RedisKey; ...@@ -9,12 +9,10 @@ import cn.meteor.beyondclouds.core.redis.RedisKey;
import cn.meteor.beyondclouds.modules.queue.service.IMessageQueueService; import cn.meteor.beyondclouds.modules.queue.service.IMessageQueueService;
import cn.meteor.beyondclouds.modules.user.dto.AuthenticationResultDTO; import cn.meteor.beyondclouds.modules.user.dto.AuthenticationResultDTO;
import cn.meteor.beyondclouds.modules.user.dto.UserAuthDTO; import cn.meteor.beyondclouds.modules.user.dto.UserAuthDTO;
import cn.meteor.beyondclouds.modules.user.entity.User;
import cn.meteor.beyondclouds.modules.user.entity.UserAuthApp; import cn.meteor.beyondclouds.modules.user.entity.UserAuthApp;
import cn.meteor.beyondclouds.modules.user.entity.UserAuthLocal; import cn.meteor.beyondclouds.modules.user.entity.UserAuthLocal;
import cn.meteor.beyondclouds.modules.user.enums.AuthStatus; import cn.meteor.beyondclouds.modules.user.enums.*;
import cn.meteor.beyondclouds.modules.user.enums.AuthType;
import cn.meteor.beyondclouds.modules.user.enums.AuthenticationErrorCode;
import cn.meteor.beyondclouds.modules.user.enums.UserErrorCode;
import cn.meteor.beyondclouds.modules.user.exception.AuthenticationServiceException; import cn.meteor.beyondclouds.modules.user.exception.AuthenticationServiceException;
import cn.meteor.beyondclouds.modules.user.exception.UserServiceException; import cn.meteor.beyondclouds.modules.user.exception.UserServiceException;
import cn.meteor.beyondclouds.modules.user.service.IAuthenticationService; import cn.meteor.beyondclouds.modules.user.service.IAuthenticationService;
...@@ -77,6 +75,11 @@ public class AuthenticationServiceImpl implements IAuthenticationService { ...@@ -77,6 +75,11 @@ public class AuthenticationServiceImpl implements IAuthenticationService {
throw new AuthenticationServiceException(AuthenticationErrorCode.USER_NOT_FOUND); throw new AuthenticationServiceException(AuthenticationErrorCode.USER_NOT_FOUND);
} }
User user = userService.getById(userAuthLocal.getUserId());
if (UserStatus.DISABLED.getStatus().equals(user.getStatus())) {
throw new AuthenticationServiceException(UserErrorCode.USER_DISABLED);
}
//2. 判断账号状态 //2. 判断账号状态
if (null == userAuthLocal.getStatus()) { if (null == userAuthLocal.getStatus()) {
throw new AuthenticationServiceException(AuthenticationErrorCode.USER_AUTH_DISABLED); throw new AuthenticationServiceException(AuthenticationErrorCode.USER_AUTH_DISABLED);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment