From 7d26a0da2528f846a8a149dbe6b79df4c8da7ef7 Mon Sep 17 00:00:00 2001 From: lvxinran Date: Tue, 26 Nov 2019 15:29:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E4=BC=9A=E5=AE=A3=E8=A8=80=E9=95=BF?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ljsd/jieling/exception/ErrorCode.java | 3 ++- .../main/java/com/ljsd/jieling/logic/family/GuildLogic.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/exception/ErrorCode.java b/serverlogic/src/main/java/com/ljsd/jieling/exception/ErrorCode.java index 8feb3d9c7..643595cf3 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/exception/ErrorCode.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/exception/ErrorCode.java @@ -142,7 +142,8 @@ public enum ErrorCode implements IErrorCode { IN_BLACK(108,"对方已被您加入黑名单,无法添加好友"), NULL_NAME(109,"名字不能为空"), NAME_LENGTH_ERROR(110,"公会名长度不符"), - EXIST_NAME(111,"此名已存在"); + EXIST_NAME(111,"此名已存在"), + ANNOUNCE_SIZE(112,"公会宣言长度不符"), ; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildLogic.java index 42c8dc112..ddf93e3ff 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildLogic.java @@ -98,6 +98,9 @@ public class GuildLogic { if(StringUtil.isEmpty(announce)){ announce= SGuildSetting.sGuildSetting.getDefaultDeclaration(); } + if(announce.length()<0||announce.length()>32){ + throw new ErrorCodeException(ErrorCode.ANNOUNCE_SIZE); + } GuildInfo guildInfo = new GuildInfo(user.getId(),familyName,announce); GuilidManager.addGuildInfo(guildInfo); user.getPlayerInfoManager().setGuildId(guildInfo.getId()); @@ -680,6 +683,9 @@ public class GuildLogic { throw new ErrorCodeException(ErrorCode.FAMILY_IN_SENSITIVE); }else{ if(type==1){ + if(content.length()<0||content.length()>32){ + throw new ErrorCodeException(ErrorCode.ANNOUNCE_SIZE); + } guildInfo.setAnnounce(content); }else{ checkForCreateGuild(user, content, guildInfo.getAnnounce());