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 0415a1cbf..42cf50bf5 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 @@ -757,24 +757,22 @@ public class BuyGoodsNewLogic { boolean needChange = refreshWelfareState(user); NewRechargeInfo rechargeInfo = user.getPlayerInfoManager().getNewRechargeInfo(); Set needRemoveIds = new HashSet<>(); + ArrayList list = new ArrayList<>(); // 永久礼包 - ArrayList list = new ArrayList<>(rechargeInfo.getPerpetualMap().values()); + list.addAll(rechargeInfo.getPerpetualMap().keySet()); // 活动礼包 - list.addAll(rechargeInfo.getTimeLimitMap().values()); + list.addAll(rechargeInfo.getTimeLimitMap().keySet()); // 领取礼包 - list.addAll(rechargeInfo.getReceiveMap().values()); + list.addAll(rechargeInfo.getReceiveMap().keySet()); // 推送礼包 - list.addAll(rechargeInfo.getPushMap().values()); + list.addAll(rechargeInfo.getPushMap().keySet()); // gm礼包 - list.addAll(rechargeInfo.getGmSingleMap().values()); + list.addAll(rechargeInfo.getGmSingleMap().keySet()); - for(AbstractWelfareBag bag : list){ - if (bag == null || !bag.isOpen()){ - continue; - } - CommonProto.GiftGoodsInfo giftGoodsInfo = buildGoodsInfo(bag); + for(int goodId : list){ + CommonProto.GiftGoodsInfo giftGoodsInfo = buildGoodsInfo(user, goodId); if (giftGoodsInfo == null) { - needRemoveIds.add(bag.getModId()); + needRemoveIds.add(goodId); }else { giftGoodsInfoList.add(giftGoodsInfo); } @@ -898,12 +896,17 @@ public class BuyGoodsNewLogic { return null; } - public static CommonProto.GiftGoodsInfo buildGoodsInfo(AbstractWelfareBag bag){ - SRechargeCommodityNewConfig configById = SRechargeCommodityNewConfig.getConfigById(bag.getModId()); + public static CommonProto.GiftGoodsInfo buildGoodsInfo(User user, int goodsId){ + SRechargeCommodityNewConfig configById = SRechargeCommodityNewConfig.getConfigById(goodsId); // 配置表里已删除的礼包 删除 if (configById == null) { return null; } + RechargeHandler rechargeHandler = getRechargeHandler(configById.getOtype()); + AbstractWelfareBag bag = rechargeHandler.getBag(user, goodsId); + if (bag == null || !bag.isOpen()){ + return null; + } CommonProto.GiftGoodsInfo.Builder builder = CommonProto.GiftGoodsInfo.newBuilder(); builder.setGoodsId(bag.getModId()); builder.setBuyTimes(bag.getBuyTimes());