1、聊天添加限制条件

2、礼包表结构修改
back_recharge
duhui 2022-11-18 18:01:49 +08:00
parent 1b0bfdd9be
commit 8bec8568f2
12 changed files with 181 additions and 184 deletions

View File

@ -114,48 +114,49 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
iterator.remove(); iterator.remove();
continue; continue;
} }
if (2 == sGlobalSystemConfig.getType()) { long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime();
long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime(); switch (sGlobalSystemConfig.getType()){
sGlobalSystemConfig.setSeasonOpenLong(cacheOpenTime + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000); case 2:
sGlobalSystemConfig.setSeasonEndLong(cacheOpenTime + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000); sGlobalSystemConfig.setSeasonOpenLong(cacheOpenTime + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L);
} else if( 4 == sGlobalSystemConfig.getType()){ sGlobalSystemConfig.setSeasonEndLong(cacheOpenTime + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L);
long cacheOpenTime = GameApplication.serverConfig.getCacheOpenTime(); break;
Calendar calendar = Calendar.getInstance(); case 4:
calendar.setTimeInMillis(cacheOpenTime); Calendar calendar1 = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,0); calendar1.setTimeInMillis(cacheOpenTime);
calendar.set(Calendar.MINUTE,0); calendar1.set(Calendar.HOUR_OF_DAY,0);
calendar.set(Calendar.SECOND,0); calendar1.set(Calendar.MINUTE,0);
long timeInMillis = calendar.getTimeInMillis(); calendar1.set(Calendar.SECOND,0);
sGlobalSystemConfig.setSeasonOpenLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L); long timeInMillis = calendar1.getTimeInMillis();
sGlobalSystemConfig.setSeasonEndLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L); sGlobalSystemConfig.setSeasonOpenLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L);
}else if( 5 == sGlobalSystemConfig.getType()){ sGlobalSystemConfig.setSeasonEndLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L);
long cacheOpenTime =TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSystemOpen(), TimeUtils.Stand_CeHua_Data_format); break;
Calendar calendar = Calendar.getInstance(); case 5:
calendar.setTimeInMillis(cacheOpenTime); Calendar calendar2 = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,5); calendar2.setTimeInMillis(cacheOpenTime);
calendar.set(Calendar.MINUTE,0); calendar2.set(Calendar.HOUR_OF_DAY,5);
calendar.set(Calendar.SECOND,0); calendar2.set(Calendar.MINUTE,0);
long timeInMillis = calendar.getTimeInMillis(); calendar2.set(Calendar.SECOND,0);
sGlobalSystemConfig.setSeasonOpenLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L); long timeInMillis2 = calendar2.getTimeInMillis();
sGlobalSystemConfig.setSeasonEndLong(timeInMillis + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L); sGlobalSystemConfig.setSeasonOpenLong(timeInMillis2 + Integer.parseInt(sGlobalSystemConfig.getSeasonOpen()) * 1000L);
} else { sGlobalSystemConfig.setSeasonEndLong(timeInMillis2 + Integer.parseInt(sGlobalSystemConfig.getSeasonEnd()) * 1000L);
sGlobalSystemConfig.setSeasonOpenLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonOpen(), TimeUtils.Stand_CeHua_Data_format)); break;
sGlobalSystemConfig.setSeasonEndLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSeasonEnd(), TimeUtils.Stand_CeHua_Data_format)); 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)); for (int[] openRule : sGlobalSystemConfig.getOpenRules()) {
sGlobalSystemConfig.setSystemEndLong(TimeUtils.parseTimeToMiles(sGlobalSystemConfig.getSystemEnd(), TimeUtils.Stand_CeHua_Data_format)); int openType = openRule[0];
int openCondition = openRule[1];
int[] openRules = sGlobalSystemConfig.getOpenRules(); if (!sGlobalSystemConfigMapByTypeAndConditionMapTmp.containsKey(openType)) {
int openType = openRules[0]; sGlobalSystemConfigMapByTypeAndConditionMapTmp.put(openType, new HashMap<>());
int openCondition = openRules[1]; }
if (!sGlobalSystemConfigMapByTypeAndConditionMapTmp.containsKey(openType)) { if (!sGlobalSystemConfigMapByTypeAndConditionMapTmp.get(openType).containsKey(openCondition)) {
sGlobalSystemConfigMapByTypeAndConditionMapTmp.put(openType, new HashMap<>()); 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);
} }
} }

View File

@ -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), 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), Foods(6,null,MessageTypeProto.MessageType.COOK_FOOD_REQUEST_VALUE),
Adventure(7,null, Adventure(7,null,
MessageTypeProto.MessageType.ADVENTURE_CHALLENGE_REQUEST_VALUE, MessageTypeProto.MessageType.ADVENTURE_CHALLENGE_REQUEST_VALUE,
MessageTypeProto.MessageType.ADVENTURE_UPLEVEL_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_CHALLENGE_REQEUST_VALUE,
MessageTypeProto.MessageType.ADVENTURE_BOSS_RANK_REQUEST_VALUE, MessageTypeProto.MessageType.ADVENTURE_BOSS_RANK_REQUEST_VALUE,
MessageTypeProto.MessageType.ADVENTURE_BOSS_SHARE_REQUEST_VALUE), MessageTypeProto.MessageType.ADVENTURE_BOSS_SHARE_REQUEST_VALUE),
@ -42,7 +41,7 @@ public enum FunctionIdEnum {
DailyTasks(12,null), DailyTasks(12,null),
WorldBoss(13,null), WorldBoss(13,null),
Talking(14,null), Talking(14, null, MessageTypeProto.MessageType.SEND_CHAT_INFO_REQUEST_VALUE),
Store(20,null), Store(20,null),
Trial(30,new TrialFunction()), Trial(30,new TrialFunction()),
@ -75,6 +74,7 @@ public enum FunctionIdEnum {
GodSoul(116,null),//神魂 GodSoul(116,null),//神魂
FaBaoSoul(119,null),//法宝聚灵 FaBaoSoul(119,null),//法宝聚灵
LifeGrid(122,null),//命格 LifeGrid(122,null),//命格
CrossServerChat(127,null,MessageTypeProto.MessageType.SEND_CHAT_INFO_REQUEST_VALUE),//跨服聊天
WeekGood(9091,null), WeekGood(9091,null),
; ;

View File

@ -12,9 +12,14 @@ import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.MainLevelManager; import com.ljsd.jieling.logic.dao.MainLevelManager;
import com.ljsd.jieling.logic.dao.UserManager; import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User; 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.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.server.ProtocolsManager; import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession; import com.ljsd.jieling.network.session.ISession;
import config.SRechargeCommodityNewConfig;
import org.springframework.expression.spel.ast.OpPlus;
import rpc.protocols.MessageTypeProto; import rpc.protocols.MessageTypeProto;
import com.ljsd.jieling.util.AyyncWorker; import com.ljsd.jieling.util.AyyncWorker;
import com.ljsd.jieling.util.MessageUtil; import com.ljsd.jieling.util.MessageUtil;
@ -256,25 +261,40 @@ public class HandlerLogicThread extends Thread{
if(sGlobalSystemConfig == null || !GlobalDataManaager.getInstance().checkIsOpen(sGlobalSystemConfig.getId())){ if(sGlobalSystemConfig == null || !GlobalDataManaager.getInstance().checkIsOpen(sGlobalSystemConfig.getId())){
return false; return false;
} }
int level = user.getPlayerInfoManager().getLevel(); boolean result = true;
int workShopLevel = user.getWorkShopController().getWorkShopLevel(); outside: for (int[] openRule : sGlobalSystemConfig.getOpenRules()) {
MainLevelManager mainLevelManager = user.getMainLevelManager(); switch (openRule[0]){
int type = sGlobalSystemConfig.getOpenRules()[0]; case 1:
int condition = sGlobalSystemConfig.getOpenRules()[1]; if (!SMainLevelConfig.biggerThanFight(user.getMainLevelManager().getFightId(),openRule[1])) {
if (type ==1){ result = false;
if (!SMainLevelConfig.biggerThanFight(mainLevelManager.getFightId(),condition)) { break outside;
return false; }
} break;
}else if(type == 2){ case 2:
if (level < condition){ if (user.getPlayerInfoManager().getLevel() < openRule[1]){
return false; result = false;
} break outside;
}else if(type == 3){ //工坊 }
if (workShopLevel < condition){ break;
return false; 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;
} }

View File

@ -4867,7 +4867,7 @@ public class HeroLogic {
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
List<Integer> config = SGlobalSystemConfig.idsByType.get(FunctionIdEnum.Pokemon.getFunctionType()); List<Integer> config = SGlobalSystemConfig.idsByType.get(FunctionIdEnum.Pokemon.getFunctionType());
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(config.iterator().next()); 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); throw new ErrorCodeException(ErrorCode.PLAYER_LEVE_NOT);
} }
PokemonManager pokemonManager = user.getPokemonManager(); PokemonManager pokemonManager = user.getPokemonManager();

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.logic.store; package com.ljsd.jieling.logic.store;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.core.VipPrivilegeType; import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.db.mongo.MongoUtil; import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisKey;
@ -628,8 +629,8 @@ public class BuyGoodsNewLogic {
} }
} }
if (bag.getType() == RechargeType.receive.getType()){ if (bag.getType() == RechargeType.receive.getType()){
for (String[] strings : bag.getCondition()) { for (int[] strings : bag.getCondition()) {
if (strings[0].equals("9")){ if (strings[0] == 9){
if(judgeOpen(strings, user)){ if(judgeOpen(strings, user)){
bag.setOpen(false); bag.setOpen(false);
} }
@ -638,8 +639,8 @@ public class BuyGoodsNewLogic {
} }
//周礼包需求:根据不同的等级推送不同的礼包 //周礼包需求:根据不同的等级推送不同的礼包
if (bag.getType() == RechargeType.perpetual.getType()){ if (bag.getType() == RechargeType.perpetual.getType()){
for (String[] strings : bag.getCondition()){ for (int[] strings : bag.getCondition()){
if (strings[0].equals("1")){ if (strings[0] == 1){
if(judgeOpen(strings, user)){ if(judgeOpen(strings, user)){
bag.setOpen(false); bag.setOpen(false);
} }
@ -653,9 +654,9 @@ public class BuyGoodsNewLogic {
} }
if(bag.getType() == RechargeType.timeLimit.getType()){ if(bag.getType() == RechargeType.timeLimit.getType()){
//活动类型特殊处理 //活动类型特殊处理
for(String[] s : configById.getCondition()){ for(int[] s : configById.getOnSaleRule()){
int anInt = Integer.parseInt(s[1]); int anInt = s[1];
if(!s[0].equals("3")){ if(s[0]==3){
continue; continue;
} }
if(ActivityLogic.checkActivityOpen(user, anInt)){ if(ActivityLogic.checkActivityOpen(user, anInt)){
@ -669,7 +670,7 @@ public class BuyGoodsNewLogic {
}else{ }else{
if (bag.getTimeType() == 9) { if (bag.getTimeType() == 9) {
boolean init = true; boolean init = true;
for(String[] con : bag.getCondition()){ for(int[] con : bag.getCondition()){
if(judgeOpen(con, user)){ if(judgeOpen(con, user)){
init = false; init = false;
break; break;
@ -677,9 +678,9 @@ public class BuyGoodsNewLogic {
} }
if(init){ if(init){
long endTime = 0; long endTime = 0;
for(String[] con : bag.getCondition()){ for(int[] con : bag.getCondition()){
if(con[0].equals("4")){ if(con[0] == 4){
endTime = Long.parseLong(con[2])*1000; endTime = con[2]*1000L;
} }
} }
bag.setStartTime(now); bag.setStartTime(now);
@ -692,7 +693,7 @@ public class BuyGoodsNewLogic {
}else{ }else{
boolean open = true; boolean open = true;
if(now > bag.getStartTime()){ if(now > bag.getStartTime()){
for(String[] con : bag.getCondition()){ for(int[] con : bag.getCondition()){
if(judgeOpen(con, user)){ if(judgeOpen(con, user)){
open = false; open = false;
break; break;
@ -717,14 +718,20 @@ public class BuyGoodsNewLogic {
public static AbstractWelfareBag initUnitWF(User user,SRechargeCommodityNewConfig config){ public static AbstractWelfareBag initUnitWF(User user,SRechargeCommodityNewConfig config){
AbstractWelfareBag bag = null; AbstractWelfareBag bag = null;
try{ try{
if(config.getOtype() == 1){ switch (config.getOtype()){
bag = new PerpetualWelfareBag(user,config); case 1:
}else if(config.getOtype() == 2){ bag = new PerpetualWelfareBag(user,config);
bag = new TimeLimitWelfareBag(user,config); break;
}else if(config.getOtype() == 3){ case 2:
bag = new ReceiveWelfareBag(user,config); bag = new TimeLimitWelfareBag(user,config);
}else if(config.getOtype() == 4){ break;
bag = new PushWelfareBag(user,config); case 3:
bag = new ReceiveWelfareBag(user,config);
break;
case 4:
bag = new PushWelfareBag(user,config);
break;
default:break;
} }
}catch(Exception e){ }catch(Exception e){
e.printStackTrace(); 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; boolean result = false;
int level = user.getPlayerInfoManager().getLevel(); int level = user.getPlayerInfoManager().getLevel();
switch (con[0]){ switch (con[0]){
case "1"://玩家等级 case 1://玩家等级
if(Integer.parseInt(con[1]) <= level && level <= Integer.parseInt(con[2])){ if(con[1] <= level && level <= con[2]){
result = true; result = true;
} }
break; break;
case "2"://功能开启 case 2://功能开启
if(GlobalDataManaager.getInstance().checkIsOpen(Integer.parseInt(con[1]))){ SGlobalSystemConfig systemConfig = SGlobalSystemConfig.getConfigById(con[1]);
SGlobalSystemConfig config = SGlobalSystemConfig.getConfigById(Integer.parseInt(con[1])); boolean checkOpen = HandlerLogicThread.checkOpen(user, systemConfig);
if(config == null){ if (checkOpen){
break;
}
int[] rule = config.getOpenRules();
if(rule[0] == 2 && level < rule[1]){
break;
}
result = true; result = true;
} }
break; break;
case "3"://活动开启 case 3://活动开启
result = ActivityLogic.checkActivityOpen(user,Integer.parseInt(con[1])); result = ActivityLogic.checkActivityOpen(user,con[1]);
break; break;
case "5"://激活高级月卡 case 5://激活高级月卡
result = user.getPlayerInfoManager().getMonthCard().get(Global.LMONTHCARDID) != null; result = user.getPlayerInfoManager().getMonthCard().get(Global.LMONTHCARDID) != null;
break; break;
case "4"://时间类全部true case 4://时间类全部true
case "7": case 7:
result = true; result = true;
break; break;
case "9": case 9:
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(Integer.parseInt(con[1])); SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(con[1]);
if (config == null){ if (config == null){
result = true; result = true;
break; 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 (mission.getActivityState() != ActivityType.OPEN_STATE){
if (open[1].equals(String.valueOf(activityId))){ if (open[1] == activityId){
iterator.remove(); iterator.remove();
break; break;
} }
} }
} }
// 功能未开启的表 // 功能未开启的表
if ("2".equals(open[0])){ if (open[0] == 2){
if (!GlobalDataManaager.getInstance().checkIsOpen(Integer.parseInt(open[1]))){ if (!GlobalDataManaager.getInstance().checkIsOpen(open[1])){
iterator.remove(); iterator.remove();
break; break;
} }
@ -1228,9 +1229,9 @@ public class BuyGoodsNewLogic {
*/ */
private static int getTime(AbstractWelfareBag bag){ private static int getTime(AbstractWelfareBag bag){
int i = 2; int i = 2;
for(String[] s : bag.getCondition()){ for(int[] s : bag.getCondition()){
if(s[0].equals("6")){ if(s[0]==6){
i = Integer.parseInt(s[1]); i = s[1];
break; break;
} }
} }

View File

@ -55,7 +55,7 @@ public class AbstractWelfareBag extends MongoBase{
} }
/** /**
* *
* @return * @return
*/ */
public boolean buy() { public boolean buy() {
@ -70,10 +70,18 @@ public class AbstractWelfareBag extends MongoBase{
return true; return true;
} }
/**
*
* @return
*/
public boolean buyAgo(){ public boolean buyAgo(){
return buyTimes >= getLimit(); return buyTimes >= getLimit();
} }
/**
*
* @return
*/
public boolean checkBuy() { public boolean checkBuy() {
if(!isOpen()){ if(!isOpen()){
LOGGER.error("礼包:{}未开启",modId); LOGGER.error("礼包:{}未开启",modId);
@ -163,12 +171,12 @@ public class AbstractWelfareBag extends MongoBase{
updateString("open",open); updateString("open",open);
} }
public String[][] getCondition() { return SRechargeCommodityNewConfig.getConditon(modId); } public int[][] getCondition() { return SRechargeCommodityNewConfig.getConditon(modId); }
public Set<Integer> getConditionType(){ public Set<Integer> getConditionType(){
HashSet<Integer> set = new HashSet<>(); HashSet<Integer> set = new HashSet<>();
for (String[] value : getCondition()) { for (int[] value : getCondition()) {
set.add(Integer.valueOf(value[0])); set.add(value[0]);
} }
return set; return set;
} }
@ -279,9 +287,9 @@ public class AbstractWelfareBag extends MongoBase{
} }
public boolean isUserBuyRefresh() { public boolean isUserBuyRefresh() {
String[][] condition = getCondition(); int[][] condition = getCondition();
for (String[] rule : condition) { for (int[] rule : condition) {
if(rule[0].equals("7")){ if(rule[0] == 7){
return true; return true;
} }
} }

View File

@ -13,14 +13,14 @@ public class PerpetualWelfareBag extends AbstractWelfareBag {
public PerpetualWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{ public PerpetualWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{
super(config); super(config);
for(String[] value : getCondition()){ for(int[] value : getCondition()){
if(value[0].equals("4")){ if(value[0] == 4){
switch (config.getTime()){ switch (config.getTime()){
case 1://绝对时间 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; break;
case 2://创角时间 case 2://创角时间
setStartTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(value[1])); setStartTime(user.getPlayerInfoManager().getCreateTime()+value[1]);
break; break;
case 3://开服时间 case 3://开服时间
setStartTime(GameApplication.serverConfig.getCacheOpenTime()); setStartTime(GameApplication.serverConfig.getCacheOpenTime());

View File

@ -36,9 +36,9 @@ public class PushWelfareBag extends AbstractWelfareBag {
private int getTime(){ private int getTime(){
int i = 2; int i = 2;
for(String[] s : getCondition()){ for(int[] s : getCondition()){
if(s[0].equals("6")){ if(s[0] == 6){
i = Integer.parseInt(s[1]); i = s[1];
break; break;
} }
} }

View File

@ -19,20 +19,20 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
public ReceiveWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{ public ReceiveWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{
super(config); super(config);
for(String[] value : getCondition()){ for(int[] value : getCondition()){
if(value[0].equals("4")){ if(value[0] == 4){
switch (config.getTime()){ switch (config.getTime()){
case 1://绝对时间 case 1://绝对时间
setStartTime(TimeUtils.parseTimeToMiles(value[1],TimeUtils.Stand_CeHua_Data_format)); setStartTime(TimeUtils.parseTimeToMiles(String.valueOf(value[1]),TimeUtils.Stand_CeHua_Data_format));
setEndTime(TimeUtils.parseTimeToMiles(value[2],TimeUtils.Stand_CeHua_Data_format)); setEndTime(TimeUtils.parseTimeToMiles(String.valueOf(value[2]),TimeUtils.Stand_CeHua_Data_format));
break; break;
case 2://创角时间 case 2://创角时间
setStartTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(value[1])); setStartTime(user.getPlayerInfoManager().getCreateTime()+value[1]);
setEndTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(value[2])); setEndTime(user.getPlayerInfoManager().getCreateTime()+value[2]);
break; break;
case 3://开服时间 case 3://开服时间
setStartTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(value[1])); setStartTime(GameApplication.serverConfig.getCacheOpenTime()+value[1]);
setEndTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(value[2])); setEndTime(GameApplication.serverConfig.getCacheOpenTime()+value[2]);
break; break;
case 9://条件达成 case 9://条件达成
setStartTime(0); setStartTime(0);
@ -40,7 +40,7 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
default: default:
break; break;
} }
if(value[2].equals("0")){ if(value[2] == 0){
setEndTime(0); setEndTime(0);
} }
} }

View File

@ -12,9 +12,9 @@ public class TimeLimitWelfareBag extends AbstractWelfareBag {
public TimeLimitWelfareBag(User user, SRechargeCommodityNewConfig config){ public TimeLimitWelfareBag(User user, SRechargeCommodityNewConfig config){
super(config); super(config);
for(String[] value : getCondition()){ for(int[] value : getCondition()){
if(value[0].equals("3")){ if(value[0] == 3){
int anInt = Integer.parseInt(value[1]); int anInt = value[1];
if(ActivityLogic.checkActivityOpen(user,anInt)){ if(ActivityLogic.checkActivityOpen(user,anInt)){
setOpen(true); setOpen(true);
long[] result = ActivityLogic.getStartAndEndTime(user, anInt); long[] result = ActivityLogic.getStartAndEndTime(user, anInt);

View File

@ -15,7 +15,7 @@ public class SGlobalSystemConfig implements BaseConfig {
private String name; private String name;
private int[] openRules; private int[][] openRules;
private String systemOpen; private String systemOpen;
@ -82,7 +82,7 @@ public class SGlobalSystemConfig implements BaseConfig {
return id; return id;
} }
public int[] getOpenRules() { public int[][] getOpenRules() {
return openRules; return openRules;
} }

View File

@ -39,39 +39,28 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
private int time; private int time;
private String onSaleRule; private int[][] onSaleRule;
private int dailyUpdate; private int dailyUpdate;
private int[] mail; private int[] mail;
private int otype; 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 rechargeId2;
private String rechargeId3; private String rechargeId3;
private String rechargeId4; private String rechargeId4;
private String rechargeId5; private String rechargeId5;
private String rechargeId6; private String rechargeId6;
private String rechargeId7; private String rechargeId7;
private String rechargeId8; private String rechargeId8;
private String rechargeId9; private String rechargeId9;
private String rechargeId10; 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<Integer,SRechargeCommodityNewConfig> configMap; public static Map<Integer,SRechargeCommodityNewConfig> configMap;
public static Map<String,SRechargeCommodityNewConfig> sdkconfigMap; public static Map<String,SRechargeCommodityNewConfig> sdkconfigMap;
public static Map<Integer, List<Integer>> configTypeMap; public static Map<Integer, List<Integer>> configTypeMap;
@ -82,7 +71,6 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
Map<String,SRechargeCommodityNewConfig> tempSdkConfigMap = new HashMap<>(); Map<String,SRechargeCommodityNewConfig> tempSdkConfigMap = new HashMap<>();
Map<Integer, List<Integer>> tempConfigTypeMap = new HashMap<>(); Map<Integer, List<Integer>> tempConfigTypeMap = new HashMap<>();
for(SRechargeCommodityNewConfig newConfig : config.values()){ for(SRechargeCommodityNewConfig newConfig : config.values()){
newConfig.setCondition(initConditon(newConfig));
tempConfigMap.put(newConfig.getId(),newConfig); tempConfigMap.put(newConfig.getId(),newConfig);
tempSdkConfigMap.put(newConfig.getRechargeId(),newConfig); tempSdkConfigMap.put(newConfig.getRechargeId(),newConfig);
tempSdkConfigMap.put(newConfig.getRechargeId2(),newConfig); tempSdkConfigMap.put(newConfig.getRechargeId2(),newConfig);
@ -100,29 +88,12 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
configTypeMap = tempConfigTypeMap; configTypeMap = tempConfigTypeMap;
} }
public static String[][] getConditon(int id){ public static int[][] getConditon(int id){
if (!configMap.containsKey(id)) { int[][] result = configMap.get(id).getOnSaleRule();
return new String[0][0]; if (result == null){
return new int[0][0];
} }
return configMap.get(id).getCondition(); return result;
}
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;
} }
public static SRechargeCommodityNewConfig getConfigById(int id){ public static SRechargeCommodityNewConfig getConfigById(int id){
@ -207,12 +178,8 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
return rechargeId10; return rechargeId10;
} }
public String[][] getCondition() { public int[][] getOnSaleRule() {
return condition; return onSaleRule;
}
public void setCondition(String[][] condition) {
this.condition = condition;
} }
public int getIsShowInWeb() { public int getIsShowInWeb() {