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

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());
boolean result = false;
//判断刷新时间
if(bag.getRefreshTime() != 0 && bag.getRefreshTime() < System.currentTimeMillis()){
long now = TimeUtils.now();
if(bag.getRefreshTime() != 0 && bag.getRefreshTime() < now){
bag.refresh();
result = true;
}
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);
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{
if(bag.getType() == RechargeType.push.getType() && !bag.isOpen()){
user.getPlayerInfoManager().getNewRechargeInfo().removePush(bag.getModId());
@ -513,7 +525,7 @@ public class BuyGoodsNewLogic {
}
}
}else{
if(bag.getTimeType() == 9){
if (bag.getTimeType() == 9) {
boolean init = true;
for(String[] con : bag.getCondition()){
if(!judgeOpen(con,user)){
@ -528,7 +540,7 @@ public class BuyGoodsNewLogic {
endTime = Long.parseLong(con[2])*1000;
}
}
bag.setStartTime(System.currentTimeMillis());
bag.setStartTime(now);
if(endTime != 0){
bag.setEndTime(bag.getStartTime() + endTime);
}
@ -537,7 +549,7 @@ public class BuyGoodsNewLogic {
}
}else{
boolean open = true;
if(System.currentTimeMillis() > bag.getStartTime()){
if(now > bag.getStartTime()){
for(String[] con : bag.getCondition()){
if(!judgeOpen(con,user)){
open = false;