diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/GlobalDataManaager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/GlobalDataManaager.java index 924c0db75..f81fed35f 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/GlobalDataManaager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/GlobalDataManaager.java @@ -475,6 +475,8 @@ public class GlobalDataManaager implements IManager { Poster.getPoster().dispatchEvent(new SuperBoxEvent(user.getId(),SuperBoxEvent.fund_zero_init)); // 心愿格子信息刷新 HeroLogic.getInstance().resetWishDrawCardInfoMap(user); + ///清空当天推送的礼包次数 + user.getPlayerInfoManager().getNewRechargeInfo().ClearDayPushMap(); } user.getPlayerInfoManager().setLoginTime(TimeUtils.now()); } 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 636fa0907..064ef73a1 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 @@ -208,6 +208,7 @@ public class BuyGoodsNewLogic { info.setMaxSingleR(price); } info.setRr(MathUtils.doubleAdd(price,info.getRr())); + info.setRechargeList(TimeUtils.now(),price); //处理月卡 user.getPlayerInfoManager().getMonthCard(); activeMonthCard(user,price,info); @@ -810,18 +811,32 @@ public class BuyGoodsNewLogic { if(list == null){ return; } + Collections.sort(list, new Comparator(){ + @Override + public int compare(SPackPushConfig o1, SPackPushConfig o2) { + return Integer.compare(o1.getPriority(), o2.getPriority()); + } + }); int popup = 0; boolean push = false; for(SPackPushConfig con : list){ int bagId = judgePushCondition(user,con); + int conditionType=con.getConditionId()[0]; + int pushId=con.getId(); + if (con.getStatistics()>0&&info.getDayPushNum(pushId)>=con.getStatistics())continue; + if (con.getCount()>0&&info.getAllPuthNum(pushId)>=con.getCount())continue; //条件成功 - if(bagId > 0 && info.getNextPushTime() < System.currentTimeMillis()){ + if(bagId > 0 && info.getNextPushTime() < System.currentTimeMillis()&& info.getTypePushTimeMap(conditionType) < System.currentTimeMillis()){ popup = bagId; info.setNextPushTime(System.currentTimeMillis() + con.getcDTime() * TimeUtils.HOUR); + info.setTypePushTimeMap(conditionType,System.currentTimeMillis() + con.getPrivateCD() * TimeUtils.HOUR); + info.setDayPushNum(pushId,1); + info.setAllPuthNum(pushId,1); boolean tempPush = createPushBag(bagId,user,num); if(!push){ push = tempPush; } + break; } } List goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size()); @@ -861,12 +876,16 @@ public class BuyGoodsNewLogic { return -1; } }else if(scope[0] == 7){ - double mxr = user.getPlayerInfoManager().getNewRechargeInfo().getMaxSingleR(); + //此处根据需求改成指定天数内最大充值订单,之前的条件是历史充值最大订单 + //double mxr = user.getPlayerInfoManager().getNewRechargeInfo().getMaxSingleR(); + double mxr = user.getPlayerInfoManager().getNewRechargeInfo().GetSingleMaxRechargeNum(SSpecialConfig.getIntegerValue(SSpecialConfig.DAYS_FOR_RECHARGE_SINGLE)); if(mxr < scope[1]){ return -1; } } - double rr = user.getPlayerInfoManager().getNewRechargeInfo().getRr(); + //double rr = user.getPlayerInfoManager().getNewRechargeInfo().getRr(); + //此处根据需求改成指定天数累计充值,之前的条件是历史累计充值 + double rr = user.getPlayerInfoManager().getNewRechargeInfo().GetAllRechargeNum(SSpecialConfig.getIntegerValue(SSpecialConfig.DAYS_FOR_RECHARGE_SUM)); int index = 0; for(int i = 1;i rr){ diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/NewRechargeInfo.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/NewRechargeInfo.java index 7b62d31bf..bb9973881 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/NewRechargeInfo.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/NewRechargeInfo.java @@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.store.newRechargeInfo; import com.ljsd.common.mogodb.MongoBase; import com.ljsd.jieling.logic.store.newRechargeInfo.bean.*; +import util.TimeUtils; import java.util.ArrayList; import java.util.HashMap; @@ -20,6 +21,8 @@ public class NewRechargeInfo extends MongoBase { private long firstTime;//首冲时间 private int isDayFirst; + private MaprechargeList=new HashMap<>();//充值记录 + private Map perpetualMap = new HashMap<>();//永久礼包 private Map timeLimitMap = new HashMap<>();//限时刷新礼包 private Map receiveMap = new HashMap<>();//限时刷新礼包 @@ -30,6 +33,12 @@ public class NewRechargeInfo extends MongoBase { private int towerLost; //记录爬塔失败次数 private long nextPushTime; //上次推送时间 + private MaptypePushTimeMap=new HashMap<>();//记录推送条件类型cd时间 + + private Map dayPushNumMap =new HashMap<>();//记录当天推送次数 + + private Map allPushNumMap =new HashMap<>();//记录历史推送次数 + private long lastRefreshTime; public static int FIVESTARLIMIT = 2;//临时五星成长礼每天最多两次 private Map tempLimitMap = new HashMap<>();//五星成长礼每天购买次数 @@ -254,12 +263,60 @@ public class NewRechargeInfo extends MongoBase { public long getNextPushTime() { return nextPushTime; } - public void setNextPushTime(long nextPushTime) { this.nextPushTime = nextPushTime; updateString("nextPushTime",nextPushTime); } + public long getTypePushTimeMap(int pushType) { + if (typePushTimeMap.containsKey(pushType)){ + return typePushTimeMap.get(pushType); + } + return 0; + } + + public void setTypePushTimeMap(int pushType,long nextPushTime) { + this.typePushTimeMap.put(pushType,nextPushTime); + updateString("typePushTimeMap."+pushType,nextPushTime); + } + + public int getDayPushNum(int pushId) { + if (dayPushNumMap.containsKey(pushId)){ + return dayPushNumMap.get(pushId); + } + return 0; + } + + public void setDayPushNum(int pushId,int addNum) { + int pushNum=addNum; + if (dayPushNumMap.containsKey(pushId)){ + pushNum+= dayPushNumMap.get(pushId); + } + this.dayPushNumMap.put(pushId,pushNum); + updateString("dayPushNumMap."+pushId,pushNum); + } + + public void ClearDayPushMap(){ + dayPushNumMap.clear(); + updateString("dayPushNumMap", dayPushNumMap); + } + + public int getAllPuthNum(int pushId) { + if (allPushNumMap.containsKey(pushId)){ + return allPushNumMap.get(pushId); + } + return 0; + } + + public void setAllPuthNum(int pushId,int addNum) { + int pushNum=addNum; + if (allPushNumMap.containsKey(pushId)){ + pushNum+= allPushNumMap.get(pushId); + } + this.allPushNumMap.put(pushId,pushNum); + updateString("allPushNumMap."+pushId,pushNum); + } + public long getLastRefreshTime() { return lastRefreshTime; } @@ -278,6 +335,41 @@ public class NewRechargeInfo extends MongoBase { updateString("maxSingleR",maxSingleR); } + public Map getRechargeList() { + return rechargeList; + } + + public void setRechargeList(long _rechargeTime,double _rechargePrice) { + this.rechargeList.put(_rechargeTime,_rechargePrice); + updateString("rechargeList",this.rechargeList); + } + + ///获取指定天数内累计充值金额 + public double GetAllRechargeNum(int _deyNum){ + double rechargeNum=0; + long limitTime= TimeUtils.now()-TimeUtils.ONE_DAY*_deyNum; + for (Map.Entry entry : rechargeList.entrySet()) { + if (entry.getKey()>limitTime) { + rechargeNum+=entry.getValue(); + } + } + return rechargeNum; + } + + ///获取指定天数内单笔最大充值金额 + public double GetSingleMaxRechargeNum(int _deyNum){ + double rechargeNum=0; + long limitTime= TimeUtils.now()-TimeUtils.ONE_DAY*_deyNum; + for (Map.Entry entry : rechargeList.entrySet()) { + if (entry.getKey()>limitTime) { + if (entry.getValue()>rechargeNum){ + rechargeNum=entry.getValue(); + } + } + } + return rechargeNum; + } + public Map getTempLimitMap() { return tempLimitMap; } @@ -285,4 +377,5 @@ public class NewRechargeInfo extends MongoBase { public void setTempLimitMap(Map tempLimitMap) { this.tempLimitMap = tempLimitMap; } + } diff --git a/tablemanager/src/main/java/config/SPackPushConfig.java b/tablemanager/src/main/java/config/SPackPushConfig.java index 242d4fa2a..7c04ef72a 100644 --- a/tablemanager/src/main/java/config/SPackPushConfig.java +++ b/tablemanager/src/main/java/config/SPackPushConfig.java @@ -19,6 +19,8 @@ public class SPackPushConfig implements BaseConfig { private int[] packs; private int statistics; + private int privateCD; + public static Map configMap; public static Map>> conditionMap; @@ -66,79 +68,50 @@ public class SPackPushConfig implements BaseConfig { return id; } - public void setId(int id) { - this.id = id; - } - public String getDesc() { return desc; } - public void setDesc(String desc) { - this.desc = desc; - } - public int[] getScopeId() { return scopeId; } - public void setScopeId(int[] scopeId) { - this.scopeId = scopeId; - } public int[] getConditionId() { return conditionId; } - public void setConditionId(int[] conditionId) { - this.conditionId = conditionId; - } public int getPriority() { return priority; } - public void setPriority(int priority) { - this.priority = priority; - } public int getcDTime() { return cDTime; } - public void setcDTime(int cDTime) { - this.cDTime = cDTime; - } public int getCount() { return count; } - public void setCount(int count) { - this.count = count; - } - public int[] getPersonas() { return personas; } - public void setPersonas(int[] personas) { - this.personas = personas; - } public int[] getPacks() { return packs; } - public void setPacks(int[] packs) { - this.packs = packs; - } public int getStatistics() { return statistics; } - public void setStatistics(int statistics) { - this.statistics = statistics; + + public int getPrivateCD() { + return privateCD; } } diff --git a/tablemanager/src/main/java/config/SSpecialConfig.java b/tablemanager/src/main/java/config/SSpecialConfig.java index 371595079..16f29d559 100644 --- a/tablemanager/src/main/java/config/SSpecialConfig.java +++ b/tablemanager/src/main/java/config/SSpecialConfig.java @@ -115,6 +115,8 @@ public class SSpecialConfig implements BaseConfig { public static final String QIJIEHOLYCONFIG = "QIJIEHOLYCONFIG";//七界试炼遗物开启层数 public static final String LIKE_ABILITY = "LikeAbility";//好感度功能,每日赠予礼物次数上限 + public static final String DAYS_FOR_RECHARGE_SUM = "DaysForRechargeSum";//近期累计充值金额累计时长 + public static final String DAYS_FOR_RECHARGE_SINGLE = "DaysForRechargeSingle";//近期最大单笔充值金额累计时长 @Override public void init() throws Exception {