增加现金券购买礼包逻辑
parent
4da56d4f85
commit
95002a1108
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue