This commit is contained in:
2026-05-15 19:59:31 +08:00
parent f7e42c4824
commit 7c8d5fd24e
2 changed files with 16 additions and 6 deletions

View File

@@ -162,10 +162,11 @@ public class TtRollServiceImpl extends ServiceImpl<TtRollMapper, TtRoll> impleme
TtRoll one = new LambdaQueryChainWrapper<>(baseMapper)
.eq(TtRoll::getId, ttRoll.getId())
.eq(TtRoll::getRollStatus, 0)
.eq(TtRoll::getDelFlag, 0)
.one();
if (ObjectUtil.isEmpty(one)) return AjaxResult.error("不存在的roll房。");
Date oldEndTime = one.getEndTime();
// 此刻
@@ -175,11 +176,15 @@ public class TtRollServiceImpl extends ServiceImpl<TtRollMapper, TtRoll> impleme
long difference = endTime - c.getTimeInMillis();
if (difference < 10) return AjaxResult.error("开奖时间不能早于现在。");
// 临界区检查
c.add(Calendar.MINUTE, 5);
long criticalTime = c.getTimeInMillis();
if (criticalTime > oldEndTime.getTime()) {
return AjaxResult.error("该roll房开奖时间已处于临界保护区【5分钟】内请勿修改开奖时间。");
// 已结束的房间可以随时修改时间,不受临界区限制
boolean isEnded = c.getTime().compareTo(oldEndTime) >= 0 || !"0".equals(one.getRollStatus());
if (!isEnded) {
// 临界区检查(仅对未结束的房间生效)
c.add(Calendar.MINUTE, 5);
long criticalTime = c.getTimeInMillis();
if (criticalTime > oldEndTime.getTime()) {
return AjaxResult.error("该roll房开奖时间已处于临界保护区【5分钟】内请勿修改开奖时间。");
}
}
baseMapper.updateById(ttRoll);