提交
This commit is contained in:
@@ -167,6 +167,26 @@ public class TtRollServiceImpl extends ServiceImpl<TtRollMapper, TtRoll> impleme
|
|||||||
|
|
||||||
if (ObjectUtil.isEmpty(one)) return AjaxResult.error("不存在的roll房。");
|
if (ObjectUtil.isEmpty(one)) return AjaxResult.error("不存在的roll房。");
|
||||||
|
|
||||||
|
Date oldEndTime = one.getEndTime();
|
||||||
|
|
||||||
|
// 此刻
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
|
||||||
|
// 已结束的房间可以随时修改时间,不受任何限制
|
||||||
|
boolean isEnded = c.getTime().compareTo(oldEndTime) >= 0 || !"0".equals(one.getRollStatus());
|
||||||
|
if (!isEnded) {
|
||||||
|
long endTime = ttRoll.getEndTime().getTime();
|
||||||
|
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分钟】内,请勿修改开奖时间。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
baseMapper.updateById(ttRoll);
|
baseMapper.updateById(ttRoll);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user