修改商店刷物品的bug

master_ob2
DESKTOP-C3M45P4\dengdan 2023-08-15 21:05:41 +08:00
parent 090fe26a22
commit 3b616bd845
1 changed files with 16 additions and 1 deletions

View File

@ -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);