异常和错误提示修改

back_recharge
zhangshanxue 2019-10-25 15:34:46 +08:00
parent b946685cdf
commit be7a119263
6 changed files with 16 additions and 15 deletions

View File

@ -29,6 +29,7 @@ public enum ErrorCode implements IErrorCode {
SERVER_SELF_DEFINE(-1, "操作失败"),
SERVER_DEFINE(-1, "操作失败"),
CFG_NULL(-1, "配置不存在"),
UNKNOWN(0, "正在紧急修复中,请稍后再试"),
NAME_USE(1, "该名字已被使用"),
@ -196,6 +197,6 @@ public enum ErrorCode implements IErrorCode {
}
public static ErrorCode newDefineCode(String errMsg) {
return SERVER_SELF_DEFINE.reDefineMsg(errMsg);
return SERVER_DEFINE.reDefineMsg(errMsg);
}
}

View File

@ -1602,14 +1602,14 @@ public class HeroLogic {
int composeNum = itemNum/sItem.getUsePerCount();
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
if (composeNum <= 0 || composeNum > gameSetting.getHeroCompoundLimit()){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if (hasHeroNum + composeNum > gameSetting.getHeroNumlimit()){
throw new ErrorCodeException(ErrorCode.HERO_HERO_MAX);
}
boolean result = ItemUtil.checkCost(user, sItem, itemNum,BIReason.COMPOS_HERO_CONSUME,0);
if (!result){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
Map<Integer,Integer> randomMap = new ConcurrentHashMap<>();
randomMap.put(itemId,composeNum);

View File

@ -71,7 +71,7 @@ public class ItemLogic {
int[][] costItemArr = StringUtil.parseFiledInt2(cost.toString());
boolean result = ItemUtil.itemCost(user, costItemArr,BIReason.DECOMPOSE_ITEM_CONSUME,0);
if (!result){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, StringUtil.parseFiledInt(reward.toString()), 1, 0,BIReason.DECOMPOS_ITEM_REWARD);
sendUseAndPriceItemMessage(iSession, msgId, drop);
@ -115,7 +115,7 @@ public class ItemLogic {
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
if (itemList.size() == 0 ){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int openBoxLimits = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getOpenBoxLimits();
for (CommonProto.Item item :itemList){
@ -144,7 +144,7 @@ public class ItemLogic {
int[][] costItemArr = StringUtil.parseFiledInt2(cost.toString());
boolean result = ItemUtil.itemCost(user, costItemArr,BIReason.USER_ITEM,0);
if (!result){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user,StringUtil.parseFiledInt(reward.toString()),1,0,BIReason.USER_ITEM);
sendUseAndPriceItemMessage(iSession, msgId, drop);

View File

@ -184,7 +184,7 @@ public class MailLogic {
MailManager mailManager = user.getMailManager();
Mail mail = mailManager.getMailMap().get(mailId);
if (mail == null){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if (mail.getMailItem()==null||mail.getMailItem().isEmpty()){
mail.setState(Global.MAIL_STATE_READ);
@ -205,7 +205,7 @@ public class MailLogic {
for (String mailId : mailIdsList){
Mail mail = mailManager.getMail(mailId);
if (mail == null){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if (mailItem.length() == 0){
mailItem = new StringBuilder(mail.getMailItem());
@ -224,7 +224,7 @@ public class MailLogic {
for (String mailId : mailIdsList){
Mail mail = mailManager.getMail(mailId);
if (mail == null){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
mail.setState(Global.MAIL_DRAW_ST_GOT);
mail.setMailItem("");

View File

@ -141,7 +141,7 @@ public class PlayerLogic {
RedisUtil.getInstence().set(key, String.valueOf(uid),RedisKey.REDIS_OVER_FOREVER);
}else{
if (!teamPosManager.getTeamNames().containsKey(teamPosId)){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
teamPosManager.getTeamNames().put(teamPosId,name);
}

View File

@ -336,7 +336,7 @@ public class StoreLogic {
int uid = iSession.getUid();
if (itemNum < 0|| itemNum >999){
LOGGER.info("buyStoreItem==> uid={},itemNum={}",uid,itemNum);
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
User user = UserManager.getUser(uid);
@ -474,13 +474,13 @@ public class StoreLogic {
Map<Integer, StoreInfo> storeInfoMap = storeManager.getStoreInfoMap();
if (!storeInfoMap.containsKey(storeId)){
LOGGER.info("handRefreStore==> uid={},storeId={}",uid,storeId);
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
StoreInfo storeInfo = storeInfoMap.get(storeId);
SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeId);
if (sStoreTypeConfig.getIfManualRefresh() != 1){
LOGGER.info("handRefreStore==> uid={},storeId={},ifManualRefresh={}",uid,storeId,sStoreTypeConfig.getIfManualRefresh());
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
PlayerManager playerInfoManager = user.getPlayerInfoManager();
int refreshPrivilege = sStoreTypeConfig.getRefreshPrivilege();
@ -509,7 +509,7 @@ public class StoreLogic {
Map<Integer, StoreInfo> storeInfoMap = storeManager.getStoreInfoMap();
if (!storeInfoMap.containsKey(storeId)){
LOGGER.info("handRefreStore==> uid={},storeId={}",uid,storeId);
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
StoreInfo storeInfo = storeInfoMap.get(storeId);
SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeId);
@ -517,7 +517,7 @@ public class StoreLogic {
int time = sStoreTypeConfig.getRefreshType()[1];
if (type == 1){
LOGGER.info("automaticRefreStore==>uid={},storeid={},type={}",uid,storeId,type);
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
Map<Integer, Integer> itemNumMap = null;
long nowTime = System.currentTimeMillis();