礼包继承类型转换bug修复

master_longzhu
grimm 2024-08-20 16:05:22 +08:00
parent b527298c7f
commit c068430102
1 changed files with 16 additions and 13 deletions

View File

@ -757,24 +757,22 @@ public class BuyGoodsNewLogic {
boolean needChange = refreshWelfareState(user);
NewRechargeInfo rechargeInfo = user.getPlayerInfoManager().getNewRechargeInfo();
Set<Integer> needRemoveIds = new HashSet<>();
ArrayList<Integer> list = new ArrayList<>();
// 永久礼包
ArrayList<AbstractWelfareBag> 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());