增加现金券购买礼包逻辑

master_0.05
DESKTOP-C3M45P4\dengdan 2024-12-19 18:07:12 +08:00
parent 4da56d4f85
commit 95002a1108
1 changed files with 14 additions and 4 deletions

View File

@ -39,10 +39,20 @@ public class VouchersBuyGiftHandler extends BaseHandler<PlayerInfoProto.GmBuyGoo
if (config == null){
throw new ErrorCodeException(ErrorCode.CFG_NULL,"礼包id不存在"+goodsId);
}
// 道具是否足够
boolean cost = ItemUtil.itemCost(user, config.getOtherBuy(), BIReason.VOUCHERS_BUY_GOOD_COST, 0);
if (!cost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
int buyType = proto.getBuyType();
//代金券
if(buyType == 0){
// 道具是否足够
boolean cost = ItemUtil.itemCost(user, config.getOtherBuy(), BIReason.VOUCHERS_BUY_GOOD_COST, 0);
if (!cost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
}else{//现金券
// 道具是否足够
boolean cost = ItemUtil.itemCost(user, config.getOtherBuy2(), BIReason.VOUCHERS_BUY_GOOD_COST, 0);
if (!cost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
}
// 走礼包逻辑发送奖励
BuyGoodsNewLogic.vouchersBuyGoods(iSession, goodsId);