周卡月卡调整,兼容老版本2

back_recharge
duhui 2022-06-10 19:06:38 +08:00
parent f8e2852405
commit 43873b23eb
2 changed files with 38 additions and 15 deletions

View File

@ -304,6 +304,12 @@ public class TimeUtils {
return format1.parse(time); return format1.parse(time);
} }
public static long dateFormat2(String time) throws ParseException {
DateFormat format1 = new SimpleDateFormat(ymdhms_Format_new);
return format1.parse(time).getTime();
}
// /** // /**
// * 是否是同一天 // * 是否是同一天
// * // *

View File

@ -63,6 +63,7 @@ import rpc.protocols.PlayerInfoProto;
import util.MathUtils; import util.MathUtils;
import util.TimeUtils; import util.TimeUtils;
import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -1694,24 +1695,40 @@ public class PlayerLogic {
return cardInfos; return cardInfos;
} }
public void checkOldMonthCard(User user){ public void checkOldMonthCard(User user) throws ParseException {
if (user.getPlayerInfoManager().getOldMonthCardMark() == 1){ PlayerManager playerInfoManager = user.getPlayerInfoManager();
if (playerInfoManager.getOldMonthCardMark() == 1){
return; return;
} }
Map<Integer, Integer> monthCard = user.getPlayerInfoManager().getMonthCard();
HashMap<Integer, Integer> map = new HashMap<>(); double rmb = playerInfoManager.getNewRechargeInfo().getRr();
Integer oldone = monthCard.get(1);
if (oldone!=null){ long createTime = playerInfoManager.getCreateTime();
int begin = (int)(TimeUtils.getBeginOfDay(oldone * 1000)/1000); long format2 = TimeUtils.dateFormat2("2022-06-11 00:00:00");
map.put(2,begin);
playerInfoManager.setMonthCard(new HashMap<>());
if (createTime < format2 && rmb >= 100){
HashMap<Integer, Integer> map = new HashMap<>();
Map<Integer, SMonthcardConfig> configMap = STableManager.getConfig(SMonthcardConfig.class);
for (SMonthcardConfig config : configMap.values()) {
int goodId = config.getPrice();
SRechargeCommodityNewConfig newConfig = SRechargeCommodityNewConfig.getConfigById(goodId);
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(newConfig.getOtype());
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(goodId);
if (bag == null){
LOGGER.error("老玩家月卡兼容报错礼包信息不存在uid{}goodid{}",user.getId(),goodId);
continue;
}
boolean bol = bag.buy();
if (!bol){
LOGGER.error("老玩家月卡兼容报错礼包已购买uid{}goodid{}",user.getId(),goodId);
continue;
}
BuyGoodsNewLogic.activeMonthCard(user,goodId);
}
playerInfoManager.setMonthCard(map);
} }
Integer oldtwo = monthCard.get(2); playerInfoManager.setOldMonthCardMark(1);
if (oldtwo!=null){
int begin = (int)(TimeUtils.getBeginOfDay(oldtwo * 1000)/1000);
map.put(3,begin);
}
user.getPlayerInfoManager().setMonthCard(map);
user.getPlayerInfoManager().setOldMonthCardMark(1);
} }
/** /**