diff --git a/serverlogic/src/main/java/com/ljsd/jieling/exception/ErrorTableException.java b/serverlogic/src/main/java/com/ljsd/jieling/exception/ErrorTableException.java index ee3a8d793..7f91e8558 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/exception/ErrorTableException.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/exception/ErrorTableException.java @@ -1,6 +1,6 @@ package com.ljsd.jieling.exception; -import config.SErrorCodeEerverConfig; +import config.SErrorCodeHint; import util.StringUtil; import java.util.ArrayList; @@ -28,10 +28,10 @@ public class ErrorTableException extends Exception { } public ErrorTableException(int id) { - String message = SErrorCodeEerverConfig.errorTableMap.get(id); + String message = SErrorCodeHint.errorMap.get(id); if (StringUtil.isEmpty(message)){ this.id = -1; - this.msg = "操作失败,并未找到错误码:{"+id+"},请联系管理员"; + this.msg = "发现异常,并未找到错误码:{"+id+"},请联系管理员"; }else { this.id = id; this.msg = message; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java index 528a27412..0fada4a69 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java @@ -12,6 +12,7 @@ import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisUtil; import com.ljsd.jieling.exception.ErrorCode; import com.ljsd.jieling.exception.ErrorCodeException; +import com.ljsd.jieling.exception.ErrorTableException; import com.ljsd.jieling.globals.BIReason; import com.ljsd.jieling.globals.Global; import com.ljsd.jieling.handler.GetPlayerInfoHandler; @@ -939,7 +940,7 @@ public class PlayerLogic { } Hero hero = userInMem.getHeroManager().getHero(heroId); if(hero == null){ - throw new ErrorCodeException(ErrorCode.newDefineCode("hero no")); + throw new ErrorTableException(159,"未找到英雄"); } PlayerInfoProto.ViewHeroInfoResponse.Builder builder = PlayerInfoProto.ViewHeroInfoResponse.newBuilder(); Map heroNotBufferAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(userInMem, hero, true, teamId); diff --git a/tablemanager/src/main/java/config/SErrorCodeHint.java b/tablemanager/src/main/java/config/SErrorCodeHint.java index 00401cc66..f481972ee 100644 --- a/tablemanager/src/main/java/config/SErrorCodeHint.java +++ b/tablemanager/src/main/java/config/SErrorCodeHint.java @@ -3,6 +3,7 @@ package config; import manager.STableManager; import manager.Table; +import java.util.HashMap; import java.util.Map; @Table(name ="ErrorCodeHint") @@ -11,11 +12,16 @@ public class SErrorCodeHint implements BaseConfig { private int id; private int showType; + private String desc; + public static Map errorMap = new HashMap<>(); @Override public void init() throws Exception { - + Map config = STableManager.getConfig(SErrorCodeHint.class); + for (SErrorCodeHint value : config.values()) { + errorMap.put(value.getId(),value.getDesc()); + } } @@ -27,5 +33,11 @@ public class SErrorCodeHint implements BaseConfig { return showType; } + public String getDesc() { + return desc; + } + public void setDesc(String desc) { + this.desc = desc; + } } \ No newline at end of file