From 8bec8568f29a14d6b0c49bfcfb1af35c316ea508 Mon Sep 17 00:00:00 2001 From: duhui Date: Fri, 18 Nov 2022 18:01:49 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=81=8A=E5=A4=A9=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=99=90=E5=88=B6=E6=9D=A1=E4=BB=B6=202=E3=80=81=E7=A4=BC?= =?UTF-8?q?=E5=8C=85=E8=A1=A8=E7=BB=93=E6=9E=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clazzStaticCfg/CommonStaticConfig.java | 79 +++++++-------- .../com/ljsd/jieling/core/FunctionIdEnum.java | 6 +- .../ljsd/jieling/core/HandlerLogicThread.java | 54 +++++++---- .../ljsd/jieling/logic/hero/HeroLogic.java | 2 +- .../jieling/logic/store/BuyGoodsNewLogic.java | 97 ++++++++++--------- .../bean/AbstractWelfareBag.java | 22 +++-- .../bean/PerpetualWelfareBag.java | 8 +- .../newRechargeInfo/bean/PushWelfareBag.java | 6 +- .../bean/ReceiveWelfareBag.java | 18 ++-- .../bean/TimeLimitWelfareBag.java | 6 +- .../main/java/config/SGlobalSystemConfig.java | 4 +- .../config/SRechargeCommodityNewConfig.java | 63 +++--------- 12 files changed, 181 insertions(+), 184 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/CommonStaticConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/CommonStaticConfig.java index 530db6aaf..f8ecc4d29 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/CommonStaticConfig.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/CommonStaticConfig.java @@ -114,48 +114,49 @@ public class CommonStaticConfig extends AbstractClassStaticConfig { iterator.remove(); continue; } - if (2 == sGlobalSystemConfig.getType()) { - long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime(); - sGlobalSystemConfig.setSeasonOpenLong(cacheOpenTime + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000); - sGlobalSystemConfig.setSeasonEndLong(cacheOpenTime + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000); - } else if( 4 == sGlobalSystemConfig.getType()){ - long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime(); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(cacheOpenTime); - calendar.set(Calendar.HOUR_OF_DAY,0); - calendar.set(Calendar.MINUTE,0); - calendar.set(Calendar.SECOND,0); - long timeInMillis = calendar.getTimeInMillis(); - sGlobalSystemConfig.setSeasonOpenLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L); - sGlobalSystemConfig.setSeasonEndLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L); - }else if( 5 == sGlobalSystemConfig.getType()){ - long cacheOpenTime =TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSystemOpen(), TimeUtils.Stand_CeHua_Data_format); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(cacheOpenTime); - calendar.set(Calendar.HOUR_OF_DAY,5); - calendar.set(Calendar.MINUTE,0); - calendar.set(Calendar.SECOND,0); - long timeInMillis = calendar.getTimeInMillis(); - sGlobalSystemConfig.setSeasonOpenLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L); - sGlobalSystemConfig.setSeasonEndLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L); - } else { - sGlobalSystemConfig.setSeasonOpenLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonOpen(), TimeUtils.Stand_CeHua_Data_format)); - sGlobalSystemConfig.setSeasonEndLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonEnd(), TimeUtils.Stand_CeHua_Data_format)); + long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime(); + switch (sGlobalSystemConfig.getType()){ + case 2: + sGlobalSystemConfig.setSeasonOpenLong(cacheOpenTime + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L); + sGlobalSystemConfig.setSeasonEndLong(cacheOpenTime + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L); + break; + case 4: + Calendar calendar1 = Calendar.getInstance(); + calendar1.setTimeInMillis(cacheOpenTime); + calendar1.set(Calendar.HOUR_OF_DAY,0); + calendar1.set(Calendar.MINUTE,0); + calendar1.set(Calendar.SECOND,0); + long timeInMillis = calendar1.getTimeInMillis(); + sGlobalSystemConfig.setSeasonOpenLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L); + sGlobalSystemConfig.setSeasonEndLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L); + break; + case 5: + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTimeInMillis(cacheOpenTime); + calendar2.set(Calendar.HOUR_OF_DAY,5); + calendar2.set(Calendar.MINUTE,0); + calendar2.set(Calendar.SECOND,0); + long timeInMillis2 = calendar2.getTimeInMillis(); + sGlobalSystemConfig.setSeasonOpenLong(timeInMillis2 + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L); + sGlobalSystemConfig.setSeasonEndLong(timeInMillis2 + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L); + break; + default: + sGlobalSystemConfig.setSeasonOpenLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonOpen(), TimeUtils.Stand_CeHua_Data_format)); + sGlobalSystemConfig.setSeasonEndLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonEnd(), TimeUtils.Stand_CeHua_Data_format)); + break; } - sGlobalSystemConfig.setSystemOpenLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSystemOpen(), TimeUtils.Stand_CeHua_Data_format)); - sGlobalSystemConfig.setSystemEndLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSystemEnd(), TimeUtils.Stand_CeHua_Data_format)); - - int[] openRules = sGlobalSystemConfig.getOpenRules(); - int openType = openRules[0]; - int openCondition = openRules[1]; - if (!sGlobalSystemConfigMapByTypeAndConditionMapTmp.containsKey(openType)) { - sGlobalSystemConfigMapByTypeAndConditionMapTmp.put(openType, new HashMap<>()); + for (int[] openRule : sGlobalSystemConfig.getOpenRules()) { + int openType = openRule[0]; + int openCondition = openRule[1]; + if (!sGlobalSystemConfigMapByTypeAndConditionMapTmp.containsKey(openType)) { + sGlobalSystemConfigMapByTypeAndConditionMapTmp.put(openType, new HashMap<>()); + } + if (!sGlobalSystemConfigMapByTypeAndConditionMapTmp.get(openType).containsKey(openCondition)) { + sGlobalSystemConfigMapByTypeAndConditionMapTmp.get(openType).put(openCondition, new ArrayList<>()); + } + sGlobalSystemConfigMapByTypeAndConditionMapTmp.get(openType).get(openCondition).add(sGlobalSystemConfig); } - if (!sGlobalSystemConfigMapByTypeAndConditionMapTmp.get(openType).containsKey(openCondition)) { - sGlobalSystemConfigMapByTypeAndConditionMapTmp.get(openType).put(openCondition, new ArrayList<>()); - } - sGlobalSystemConfigMapByTypeAndConditionMapTmp.get(openType).get(openCondition).add(sGlobalSystemConfig); } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/core/FunctionIdEnum.java b/serverlogic/src/main/java/com/ljsd/jieling/core/FunctionIdEnum.java index 96118230f..51d95c0c7 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/core/FunctionIdEnum.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/core/FunctionIdEnum.java @@ -32,9 +32,8 @@ public enum FunctionIdEnum { WorkShop(5,null,MessageTypeProto.MessageType.WORKSHOP_LEVELUP_RESPONSE_VALUE,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_REQUEST_VALUE,MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_REQUEST_VALUE), Foods(6,null,MessageTypeProto.MessageType.COOK_FOOD_REQUEST_VALUE), Adventure(7,null, - MessageTypeProto.MessageType.ADVENTURE_CHALLENGE_REQUEST_VALUE, + MessageTypeProto.MessageType.ADVENTURE_CHALLENGE_REQUEST_VALUE, MessageTypeProto.MessageType.ADVENTURE_UPLEVEL_REQUEST_VALUE, - // MessageTypeProto.MessageType.ADVENTURE_REWARD_REQUEST_VALUE, MessageTypeProto.MessageType.ADVENTURE_BOSS_CHALLENGE_REQEUST_VALUE, MessageTypeProto.MessageType.ADVENTURE_BOSS_RANK_REQUEST_VALUE, MessageTypeProto.MessageType.ADVENTURE_BOSS_SHARE_REQUEST_VALUE), @@ -42,7 +41,7 @@ public enum FunctionIdEnum { DailyTasks(12,null), WorldBoss(13,null), - Talking(14,null), + Talking(14, null, MessageTypeProto.MessageType.SEND_CHAT_INFO_REQUEST_VALUE), Store(20,null), Trial(30,new TrialFunction()), @@ -75,6 +74,7 @@ public enum FunctionIdEnum { GodSoul(116,null),//神魂 FaBaoSoul(119,null),//法宝聚灵 LifeGrid(122,null),//命格 + CrossServerChat(127,null,MessageTypeProto.MessageType.SEND_CHAT_INFO_REQUEST_VALUE),//跨服聊天 WeekGood(9091,null), ; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/core/HandlerLogicThread.java b/serverlogic/src/main/java/com/ljsd/jieling/core/HandlerLogicThread.java index ff137e46c..a7c3c1102 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/core/HandlerLogicThread.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/core/HandlerLogicThread.java @@ -12,9 +12,14 @@ import com.ljsd.jieling.logic.OnlineUserManager; import com.ljsd.jieling.logic.dao.MainLevelManager; import com.ljsd.jieling.logic.dao.UserManager; import com.ljsd.jieling.logic.dao.root.User; +import com.ljsd.jieling.logic.store.BuyGoodsNewLogic; +import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag; +import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler; import com.ljsd.jieling.netty.cocdex.PacketNetData; import com.ljsd.jieling.network.server.ProtocolsManager; import com.ljsd.jieling.network.session.ISession; +import config.SRechargeCommodityNewConfig; +import org.springframework.expression.spel.ast.OpPlus; import rpc.protocols.MessageTypeProto; import com.ljsd.jieling.util.AyyncWorker; import com.ljsd.jieling.util.MessageUtil; @@ -256,25 +261,40 @@ public class HandlerLogicThread extends Thread{ if(sGlobalSystemConfig == null || !GlobalDataManaager.getInstance().checkIsOpen(sGlobalSystemConfig.getId())){ return false; } - int level = user.getPlayerInfoManager().getLevel(); - int workShopLevel = user.getWorkShopController().getWorkShopLevel(); - MainLevelManager mainLevelManager = user.getMainLevelManager(); - int type = sGlobalSystemConfig.getOpenRules()[0]; - int condition = sGlobalSystemConfig.getOpenRules()[1]; - if (type ==1){ - if (!SMainLevelConfig.biggerThanFight(mainLevelManager.getFightId(),condition)) { - return false; - } - }else if(type == 2){ - if (level < condition){ - return false; - } - }else if(type == 3){ //工坊 - if (workShopLevel < condition){ - return false; + boolean result = true; + outside: for (int[] openRule : sGlobalSystemConfig.getOpenRules()) { + switch (openRule[0]){ + case 1: + if (!SMainLevelConfig.biggerThanFight(user.getMainLevelManager().getFightId(),openRule[1])) { + result = false; + break outside; + } + break; + case 2: + if (user.getPlayerInfoManager().getLevel() < openRule[1]){ + result = false; + break outside; + } + break; + case 3: + if (user.getHeroManager().getHongmengMaxLevelByInt() < openRule[1]){ + result = false; + break outside; + } + break; + case 4: + SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(openRule[1]); + RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(config.getOtype()); + AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(config.getId()); + if (bag == null || !bag.buyAgo()){ + result = false; + break outside; + } + break; + default:break; } } - return true; + return result; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java index ee28ac3c2..2ac790f8f 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java @@ -4867,7 +4867,7 @@ public class HeroLogic { User user = UserManager.getUser(uid); List config = SGlobalSystemConfig.idsByType.get(FunctionIdEnum.Pokemon.getFunctionType()); SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(config.iterator().next()); - if (user.getPlayerInfoManager().getLevel() < sGlobalSystemConfig.getOpenRules()[1]) { + if (!HandlerLogicThread.checkOpen(user,sGlobalSystemConfig)) { throw new ErrorCodeException(ErrorCode.PLAYER_LEVE_NOT); } PokemonManager pokemonManager = user.getPokemonManager(); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsNewLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsNewLogic.java index c4a1760b1..43e8dce42 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsNewLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsNewLogic.java @@ -1,5 +1,6 @@ package com.ljsd.jieling.logic.store; +import com.ljsd.jieling.core.HandlerLogicThread; import com.ljsd.jieling.core.VipPrivilegeType; import com.ljsd.jieling.db.mongo.MongoUtil; import com.ljsd.jieling.db.redis.RedisKey; @@ -628,8 +629,8 @@ public class BuyGoodsNewLogic { } } if (bag.getType() == RechargeType.receive.getType()){ - for (String[] strings : bag.getCondition()) { - if (strings[0].equals("9")){ + for (int[] strings : bag.getCondition()) { + if (strings[0] == 9){ if(judgeOpen(strings, user)){ bag.setOpen(false); } @@ -638,8 +639,8 @@ public class BuyGoodsNewLogic { } //周礼包需求:根据不同的等级推送不同的礼包 if (bag.getType() == RechargeType.perpetual.getType()){ - for (String[] strings : bag.getCondition()){ - if (strings[0].equals("1")){ + for (int[] strings : bag.getCondition()){ + if (strings[0] == 1){ if(judgeOpen(strings, user)){ bag.setOpen(false); } @@ -653,9 +654,9 @@ public class BuyGoodsNewLogic { } if(bag.getType() == RechargeType.timeLimit.getType()){ //活动类型特殊处理 - for(String[] s : configById.getCondition()){ - int anInt = Integer.parseInt(s[1]); - if(!s[0].equals("3")){ + for(int[] s : configById.getOnSaleRule()){ + int anInt = s[1]; + if(s[0]==3){ continue; } if(ActivityLogic.checkActivityOpen(user, anInt)){ @@ -669,7 +670,7 @@ public class BuyGoodsNewLogic { }else{ if (bag.getTimeType() == 9) { boolean init = true; - for(String[] con : bag.getCondition()){ + for(int[] con : bag.getCondition()){ if(judgeOpen(con, user)){ init = false; break; @@ -677,9 +678,9 @@ public class BuyGoodsNewLogic { } if(init){ long endTime = 0; - for(String[] con : bag.getCondition()){ - if(con[0].equals("4")){ - endTime = Long.parseLong(con[2])*1000; + for(int[] con : bag.getCondition()){ + if(con[0] == 4){ + endTime = con[2]*1000L; } } bag.setStartTime(now); @@ -692,7 +693,7 @@ public class BuyGoodsNewLogic { }else{ boolean open = true; if(now > bag.getStartTime()){ - for(String[] con : bag.getCondition()){ + for(int[] con : bag.getCondition()){ if(judgeOpen(con, user)){ open = false; break; @@ -717,14 +718,20 @@ public class BuyGoodsNewLogic { public static AbstractWelfareBag initUnitWF(User user,SRechargeCommodityNewConfig config){ AbstractWelfareBag bag = null; try{ - if(config.getOtype() == 1){ - bag = new PerpetualWelfareBag(user,config); - }else if(config.getOtype() == 2){ - bag = new TimeLimitWelfareBag(user,config); - }else if(config.getOtype() == 3){ - bag = new ReceiveWelfareBag(user,config); - }else if(config.getOtype() == 4){ - bag = new PushWelfareBag(user,config); + switch (config.getOtype()){ + case 1: + bag = new PerpetualWelfareBag(user,config); + break; + case 2: + bag = new TimeLimitWelfareBag(user,config); + break; + case 3: + bag = new ReceiveWelfareBag(user,config); + break; + case 4: + bag = new PushWelfareBag(user,config); + break; + default:break; } }catch(Exception e){ e.printStackTrace(); @@ -747,40 +754,34 @@ public class BuyGoodsNewLogic { /** * 礼包开启条件判断(除了时间) */ - public static boolean judgeOpen(String[] con,User user) { + public static boolean judgeOpen(int[] con,User user) { boolean result = false; int level = user.getPlayerInfoManager().getLevel(); switch (con[0]){ - case "1"://玩家等级 - if(Integer.parseInt(con[1]) <= level && level <= Integer.parseInt(con[2])){ + case 1://玩家等级 + if(con[1] <= level && level <= con[2]){ result = true; } break; - case "2"://功能开启 - if(GlobalDataManaager.getInstance().checkIsOpen(Integer.parseInt(con[1]))){ - SGlobalSystemConfig config = SGlobalSystemConfig.getConfigById(Integer.parseInt(con[1])); - if(config == null){ - break; - } - int[] rule = config.getOpenRules(); - if(rule[0] == 2 && level < rule[1]){ - break; - } + case 2://功能开启 + SGlobalSystemConfig systemConfig = SGlobalSystemConfig.getConfigById(con[1]); + boolean checkOpen = HandlerLogicThread.checkOpen(user, systemConfig); + if (checkOpen){ result = true; } break; - case "3"://活动开启 - result = ActivityLogic.checkActivityOpen(user,Integer.parseInt(con[1])); + case 3://活动开启 + result = ActivityLogic.checkActivityOpen(user,con[1]); break; - case "5"://激活高级月卡 + case 5://激活高级月卡 result = user.getPlayerInfoManager().getMonthCard().get(Global.LMONTHCARDID) != null; break; - case "4"://时间类全部true - case "7": + case 4://时间类全部true + case 7: result = true; break; - case "9": - SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(Integer.parseInt(con[1])); + case 9: + SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(con[1]); if (config == null){ result = true; break; @@ -952,19 +953,19 @@ public class BuyGoodsNewLogic { } } } - for (String[] open : config.getCondition()) { + for (int[] open : config.getOnSaleRule()) { // 活动未开启的礼包 - if ("3".equals(open[0])){ + if (open[0] == 3){ if (mission.getActivityState() != ActivityType.OPEN_STATE){ - if (open[1].equals(String.valueOf(activityId))){ + if (open[1] == activityId){ iterator.remove(); break; } } } // 功能未开启的表 - if ("2".equals(open[0])){ - if (!GlobalDataManaager.getInstance().checkIsOpen(Integer.parseInt(open[1]))){ + if (open[0] == 2){ + if (!GlobalDataManaager.getInstance().checkIsOpen(open[1])){ iterator.remove(); break; } @@ -1228,9 +1229,9 @@ public class BuyGoodsNewLogic { */ private static int getTime(AbstractWelfareBag bag){ int i = 2; - for(String[] s : bag.getCondition()){ - if(s[0].equals("6")){ - i = Integer.parseInt(s[1]); + for(int[] s : bag.getCondition()){ + if(s[0]==6){ + i = s[1]; break; } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/AbstractWelfareBag.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/AbstractWelfareBag.java index 8f49f5b48..3ea057377 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/AbstractWelfareBag.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/AbstractWelfareBag.java @@ -55,7 +55,7 @@ public class AbstractWelfareBag extends MongoBase{ } /** - * 检查礼包是否可以购买 + * 检查并购买 * @return */ public boolean buy() { @@ -70,10 +70,18 @@ public class AbstractWelfareBag extends MongoBase{ return true; } + /** + * 是否买过 + * @return + */ public boolean buyAgo(){ return buyTimes >= getLimit(); } + /** + * 检查是否可以购买 + * @return + */ public boolean checkBuy() { if(!isOpen()){ LOGGER.error("礼包:{}未开启",modId); @@ -163,12 +171,12 @@ public class AbstractWelfareBag extends MongoBase{ updateString("open",open); } - public String[][] getCondition() { return SRechargeCommodityNewConfig.getConditon(modId); } + public int[][] getCondition() { return SRechargeCommodityNewConfig.getConditon(modId); } public Set getConditionType(){ HashSet set = new HashSet<>(); - for (String[] value : getCondition()) { - set.add(Integer.valueOf(value[0])); + for (int[] value : getCondition()) { + set.add(value[0]); } return set; } @@ -279,9 +287,9 @@ public class AbstractWelfareBag extends MongoBase{ } public boolean isUserBuyRefresh() { - String[][] condition = getCondition(); - for (String[] rule : condition) { - if(rule[0].equals("7")){ + int[][] condition = getCondition(); + for (int[] rule : condition) { + if(rule[0] == 7){ return true; } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/PerpetualWelfareBag.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/PerpetualWelfareBag.java index c5bb04d9b..52e7c2c1b 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/PerpetualWelfareBag.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/PerpetualWelfareBag.java @@ -13,14 +13,14 @@ public class PerpetualWelfareBag extends AbstractWelfareBag { public PerpetualWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{ super(config); - for(String[] value : getCondition()){ - if(value[0].equals("4")){ + for(int[] value : getCondition()){ + if(value[0] == 4){ switch (config.getTime()){ case 1://绝对时间 - setStartTime(TimeUtils.parseTimeToMiles(value[1],TimeUtils.Stand_CeHua_Data_format)); + setStartTime(TimeUtils.parseTimeToMiles(String.valueOf(value[1]),TimeUtils.Stand_CeHua_Data_format)); break; case 2://创角时间 - setStartTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(value[1])); + setStartTime(user.getPlayerInfoManager().getCreateTime()+value[1]); break; case 3://开服时间 setStartTime(GameApplication.serverConfig.getCacheOpenTime()); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/PushWelfareBag.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/PushWelfareBag.java index eec8ddd0b..5b07ccf91 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/PushWelfareBag.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/PushWelfareBag.java @@ -36,9 +36,9 @@ public class PushWelfareBag extends AbstractWelfareBag { private int getTime(){ int i = 2; - for(String[] s : getCondition()){ - if(s[0].equals("6")){ - i = Integer.parseInt(s[1]); + for(int[] s : getCondition()){ + if(s[0] == 6){ + i = s[1]; break; } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/ReceiveWelfareBag.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/ReceiveWelfareBag.java index ef0a4f5d2..ed1ad07bb 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/ReceiveWelfareBag.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/ReceiveWelfareBag.java @@ -19,20 +19,20 @@ public class ReceiveWelfareBag extends AbstractWelfareBag { public ReceiveWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{ super(config); - for(String[] value : getCondition()){ - if(value[0].equals("4")){ + for(int[] value : getCondition()){ + if(value[0] == 4){ switch (config.getTime()){ case 1://绝对时间 - setStartTime(TimeUtils.parseTimeToMiles(value[1],TimeUtils.Stand_CeHua_Data_format)); - setEndTime(TimeUtils.parseTimeToMiles(value[2],TimeUtils.Stand_CeHua_Data_format)); + setStartTime(TimeUtils.parseTimeToMiles(String.valueOf(value[1]),TimeUtils.Stand_CeHua_Data_format)); + setEndTime(TimeUtils.parseTimeToMiles(String.valueOf(value[2]),TimeUtils.Stand_CeHua_Data_format)); break; case 2://创角时间 - setStartTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(value[1])); - setEndTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(value[2])); + setStartTime(user.getPlayerInfoManager().getCreateTime()+value[1]); + setEndTime(user.getPlayerInfoManager().getCreateTime()+value[2]); break; case 3://开服时间 - setStartTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(value[1])); - setEndTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(value[2])); + setStartTime(GameApplication.serverConfig.getCacheOpenTime()+value[1]); + setEndTime(GameApplication.serverConfig.getCacheOpenTime()+value[2]); break; case 9://条件达成 setStartTime(0); @@ -40,7 +40,7 @@ public class ReceiveWelfareBag extends AbstractWelfareBag { default: break; } - if(value[2].equals("0")){ + if(value[2] == 0){ setEndTime(0); } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/TimeLimitWelfareBag.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/TimeLimitWelfareBag.java index 9b30058b5..b29c6fa7f 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/TimeLimitWelfareBag.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/bean/TimeLimitWelfareBag.java @@ -12,9 +12,9 @@ public class TimeLimitWelfareBag extends AbstractWelfareBag { public TimeLimitWelfareBag(User user, SRechargeCommodityNewConfig config){ super(config); - for(String[] value : getCondition()){ - if(value[0].equals("3")){ - int anInt = Integer.parseInt(value[1]); + for(int[] value : getCondition()){ + if(value[0] == 3){ + int anInt = value[1]; if(ActivityLogic.checkActivityOpen(user,anInt)){ setOpen(true); long[] result = ActivityLogic.getStartAndEndTime(user, anInt); diff --git a/tablemanager/src/main/java/config/SGlobalSystemConfig.java b/tablemanager/src/main/java/config/SGlobalSystemConfig.java index 4b18fdf05..4a80efe86 100644 --- a/tablemanager/src/main/java/config/SGlobalSystemConfig.java +++ b/tablemanager/src/main/java/config/SGlobalSystemConfig.java @@ -15,7 +15,7 @@ public class SGlobalSystemConfig implements BaseConfig { private String name; - private int[] openRules; + private int[][] openRules; private String systemOpen; @@ -82,7 +82,7 @@ public class SGlobalSystemConfig implements BaseConfig { return id; } - public int[] getOpenRules() { + public int[][] getOpenRules() { return openRules; } diff --git a/tablemanager/src/main/java/config/SRechargeCommodityNewConfig.java b/tablemanager/src/main/java/config/SRechargeCommodityNewConfig.java index daed43056..ea63bf257 100644 --- a/tablemanager/src/main/java/config/SRechargeCommodityNewConfig.java +++ b/tablemanager/src/main/java/config/SRechargeCommodityNewConfig.java @@ -39,39 +39,28 @@ public class SRechargeCommodityNewConfig implements BaseConfig { private int time; - private String onSaleRule; - + private int[][] onSaleRule; private int dailyUpdate; - private int[] mail; - private int otype; + private int isShowInWeb; + private int[] forbid; + private int isRecommond; + private int[][] extraReward; + private int[][] gainFame; + private int[][] gainCrystal; + private String rechargeId2; - private String rechargeId3; - private String rechargeId4; - private String rechargeId5; - private String rechargeId6; private String rechargeId7; private String rechargeId8; private String rechargeId9; private String rechargeId10; - private int isShowInWeb; - - private int[] forbid; - - private String[][] condition; - - private int isRecommond; - private int[][] extraReward; - private int[][] gainFame; - private int[][] gainCrystal; - public static Map configMap; public static Map sdkconfigMap; public static Map> configTypeMap; @@ -82,7 +71,6 @@ public class SRechargeCommodityNewConfig implements BaseConfig { Map tempSdkConfigMap = new HashMap<>(); Map> tempConfigTypeMap = new HashMap<>(); for(SRechargeCommodityNewConfig newConfig : config.values()){ - newConfig.setCondition(initConditon(newConfig)); tempConfigMap.put(newConfig.getId(),newConfig); tempSdkConfigMap.put(newConfig.getRechargeId(),newConfig); tempSdkConfigMap.put(newConfig.getRechargeId2(),newConfig); @@ -100,29 +88,12 @@ public class SRechargeCommodityNewConfig implements BaseConfig { configTypeMap = tempConfigTypeMap; } - public static String[][] getConditon(int id){ - if (!configMap.containsKey(id)) { - return new String[0][0]; + public static int[][] getConditon(int id){ + int[][] result = configMap.get(id).getOnSaleRule(); + if (result == null){ + return new int[0][0]; } - return configMap.get(id).getCondition(); - } - - public String getOnSaleRule() { return onSaleRule; } - - public String[][] initConditon(SRechargeCommodityNewConfig config){ - String[] s = config.getOnSaleRule().split("\\|"); - condition = new String[s.length][3]; - int i = 0; - for (String s0 : s) { - String[] s1 = s0.split("#"); - condition[i][0] = s1[0]; - condition[i][1] = s1[1]; - if(s1.length > 2){ - condition[i][2] = s1[2]; - } - i++; - } - return condition; + return result; } public static SRechargeCommodityNewConfig getConfigById(int id){ @@ -207,12 +178,8 @@ public class SRechargeCommodityNewConfig implements BaseConfig { return rechargeId10; } - public String[][] getCondition() { - return condition; - } - - public void setCondition(String[][] condition) { - this.condition = condition; + public int[][] getOnSaleRule() { + return onSaleRule; } public int getIsShowInWeb() {