月礼包特殊处理,可每日都刷新购买次数

back_recharge
jiahuiwen 2021-11-25 19:27:52 +08:00
parent af0b9547c5
commit c11813b44e
1 changed files with 17 additions and 5 deletions

View File

@ -485,15 +485,27 @@ public class BuyGoodsNewLogic {
SRechargeCommodityNewConfig configById = SRechargeCommodityNewConfig.getConfigById(bag.getModId()); SRechargeCommodityNewConfig configById = SRechargeCommodityNewConfig.getConfigById(bag.getModId());
boolean result = false; boolean result = false;
//判断刷新时间 //判断刷新时间
if(bag.getRefreshTime() != 0 && bag.getRefreshTime() < System.currentTimeMillis()){ long now = TimeUtils.now();
if(bag.getRefreshTime() != 0 && bag.getRefreshTime() < now){
bag.refresh(); bag.refresh();
result = true; result = true;
} }
if(bag.isOpen()){ if(bag.isOpen()){
if(bag.getType() != 1 && bag.getEndTime() != 0 && System.currentTimeMillis() > bag.getEndTime()){ if(bag.getType() != 1 && bag.getEndTime() != 0 && now > bag.getEndTime()){
bagTimeUp(user,bag); bagTimeUp(user,bag);
result = true; result = true;
} }
// 月礼包 特殊处理,需要每日都刷新
if (configById.getTime() == 8 && configById.getDailyUpdate() == 1) {
if (!TimeUtils.isSameDay(now, bag.getStartTime())) {
bag.setStartTime(now);
if (bag.getBuyTimes() > 0) {
bag.setBuyTimes(0);
}
bag.setOpen(true);
result = true;
}
}
}else{ }else{
if(bag.getType() == RechargeType.push.getType() && !bag.isOpen()){ if(bag.getType() == RechargeType.push.getType() && !bag.isOpen()){
user.getPlayerInfoManager().getNewRechargeInfo().removePush(bag.getModId()); user.getPlayerInfoManager().getNewRechargeInfo().removePush(bag.getModId());
@ -513,7 +525,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(String[] con : bag.getCondition()){
if(!judgeOpen(con,user)){ if(!judgeOpen(con,user)){
@ -528,7 +540,7 @@ public class BuyGoodsNewLogic {
endTime = Long.parseLong(con[2])*1000; endTime = Long.parseLong(con[2])*1000;
} }
} }
bag.setStartTime(System.currentTimeMillis()); bag.setStartTime(now);
if(endTime != 0){ if(endTime != 0){
bag.setEndTime(bag.getStartTime() + endTime); bag.setEndTime(bag.getStartTime() + endTime);
} }
@ -537,7 +549,7 @@ public class BuyGoodsNewLogic {
} }
}else{ }else{
boolean open = true; boolean open = true;
if(System.currentTimeMillis() > bag.getStartTime()){ if(now > bag.getStartTime()){
for(String[] con : bag.getCondition()){ for(String[] con : bag.getCondition()){
if(!judgeOpen(con,user)){ if(!judgeOpen(con,user)){
open = false; open = false;