Commit 3dffb620 by 段启岩

Merge remote-tracking branch 'origin/fix-issue#13'

parents e100b93d 0e53ee43
......@@ -19,7 +19,8 @@ public enum UserErrorCode implements IErrorCode {
ALREADY_FOLLOWED(1006, "已关注过该用户"),
NON_FOLLOWED(1007, "没有关注过该用户"),
USER_ALREADY_BLACKED(1008,"用户已经被你拉进黑名单"),
YOU_ALREADY_BLACKED(1009,"你已经被对方拉进黑名单");
YOU_ALREADY_BLACKED(1009,"你已经被对方拉进黑名单"),
CAN_NOT_BLACKE_SELF(1010,"不能拉黑自己");
UserErrorCode(long code, String msg) {
this.code = code;
......
......@@ -28,6 +28,11 @@ public class UserBlacklistServiceImpl extends ServiceImpl<UserBlacklistMapper, U
@Override
public void blacklist(String blackedId, String userId) throws UserServiceException {
// 自己不能拉黑自己
if (userId.equals(blackedId)) {
throw new UserServiceException(UserErrorCode.CAN_NOT_BLACKE_SELF);
}
//查询 是否用户已被拉黑
QueryWrapper<UserBlacklist> myBlackListQueryWrapper = new QueryWrapper<>();
myBlackListQueryWrapper.eq("user_id", userId);
myBlackListQueryWrapper.eq("blacked_id", blackedId);
......
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