修改商店刷物品的bug
parent
090fe26a22
commit
3b616bd845
|
@ -551,6 +551,10 @@ public class StoreLogic {
|
|||
int storeId = proto.getStoreId();
|
||||
int itemId = proto.getItemId();
|
||||
int itemNum = proto.getItemNum();
|
||||
//暂时设定200000上限,后期策划控制兑换次数,防止传入int最大值,导致消耗相加成负数
|
||||
if(itemNum >= 200000){
|
||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
|
||||
}
|
||||
boolean update = checkBuyGoodsAndUpdate(user, storeId, itemId, itemNum);
|
||||
if (!update){
|
||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
|
||||
|
@ -661,7 +665,18 @@ public class StoreLogic {
|
|||
check = PlayerLogic.getInstance().check(user, limit, itemNum);
|
||||
}
|
||||
}else{
|
||||
check = limit > buyTimes;
|
||||
//判断是否还有购买次数
|
||||
if(limit > buyTimes){
|
||||
//判断购买物品数量是否超出可购数量
|
||||
int canBuyTimes = limit - buyTimes;
|
||||
if(itemNum > canBuyTimes) {
|
||||
check = false;
|
||||
}else{
|
||||
check = true;
|
||||
}
|
||||
}else{
|
||||
check = false;
|
||||
}
|
||||
}
|
||||
if(!check){
|
||||
LOGGER.error("购买商店商品校验,超过限购次数,uid:{},store:{},itemid:{},num:{}",user.getId(),storeId,itemId,itemNum);
|
||||
|
|
Loading…
Reference in New Issue