二次押注不消耗道具问题处理
parent
c44cbff181
commit
f614593007
|
@ -301,6 +301,17 @@ public class RidingSwardLogic{
|
||||||
User user = verifyUser(uid);
|
User user = verifyUser(uid);
|
||||||
// 配置
|
// 配置
|
||||||
SRidingSwardConfig config = STableManager.getConfig(SRidingSwardConfig.class).get(1);
|
SRidingSwardConfig config = STableManager.getConfig(SRidingSwardConfig.class).get(1);
|
||||||
|
// 验证道具数量
|
||||||
|
if (proto.getCostNum() > config.getMaxRaiseNum()[1] || proto.getCostNum() < config.getJoinCost()[1]){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"押注道具不满足最低或最高上限");
|
||||||
|
}
|
||||||
|
// 道具消耗检验
|
||||||
|
HashMap<Integer, Integer> map = new HashMap<>();
|
||||||
|
map.put(config.getMaxRaiseNum()[0],proto.getCostNum());
|
||||||
|
boolean cost = ItemUtil.checkCost(user, map);
|
||||||
|
if (!cost){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
|
}
|
||||||
// 投注记录,key:时间戳,value:竞猜记录信息
|
// 投注记录,key:时间戳,value:竞猜记录信息
|
||||||
Map<Long, List<RidingSwardRecord>> recordMap = getRecordList(uid);
|
Map<Long, List<RidingSwardRecord>> recordMap = getRecordList(uid);
|
||||||
// 获取下一场
|
// 获取下一场
|
||||||
|
@ -312,17 +323,6 @@ public class RidingSwardLogic{
|
||||||
if (betNum >= config.getJoinCount()){
|
if (betNum >= config.getJoinCount()){
|
||||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
|
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
|
||||||
}
|
}
|
||||||
// 验证道具数量
|
|
||||||
if (proto.getCostNum() > config.getMaxRaiseNum()[1] || proto.getCostNum() < config.getJoinCost()[1]){
|
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"押注道具不满足最低或最高上限");
|
|
||||||
}
|
|
||||||
// 道具消耗
|
|
||||||
HashMap<Integer, Integer> map = new HashMap<>();
|
|
||||||
map.put(config.getMaxRaiseNum()[0],proto.getCostNum());
|
|
||||||
boolean checkCost = ItemUtil.itemCost(user, map, BIReason.RIDING_SWARD_BET,0);
|
|
||||||
if (!checkCost){
|
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
|
||||||
}
|
|
||||||
RidingSwardRecord record = new RidingSwardRecord(nextTime,proto.getSwardId(),proto.getCostNum());
|
RidingSwardRecord record = new RidingSwardRecord(nextTime,proto.getSwardId(),proto.getCostNum());
|
||||||
records.add(record);
|
records.add(record);
|
||||||
// 记录押注次数
|
// 记录押注次数
|
||||||
|
@ -343,6 +343,8 @@ public class RidingSwardLogic{
|
||||||
if (!records.isEmpty()){
|
if (!records.isEmpty()){
|
||||||
RedisUtil.getInstence().putMapEntry(RedisKey.RIDING_SWARD_RECORD, String.valueOf(uid),String.valueOf(nextTime),records);
|
RedisUtil.getInstence().putMapEntry(RedisKey.RIDING_SWARD_RECORD, String.valueOf(uid),String.valueOf(nextTime),records);
|
||||||
}
|
}
|
||||||
|
// 道具消耗
|
||||||
|
ItemUtil.itemCost(user, map, BIReason.RIDING_SWARD_BET,0);
|
||||||
// 返回消息
|
// 返回消息
|
||||||
sendRidingSwardInfo(uid);
|
sendRidingSwardInfo(uid);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue