fix: 增加【修改轨迹】参数【NewTrackTime】轨迹时间的范围的验证
This commit is contained in:
parent
a4df525ee8
commit
a6eddbdbd9
@ -60,7 +60,9 @@ public partial class TrackService : ApplicationService, ITrackService
|
||||
throw new BusinessException(message: "轨迹来源是必须的");
|
||||
}
|
||||
|
||||
if (input.TrackTime < DateTime.Now.AddYears(-100) || input.TrackTime > DateTime.Now.AddYears(100))
|
||||
//要求时间在当前时间的前后100年之间内
|
||||
bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100));
|
||||
if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime))
|
||||
{
|
||||
throw new BusinessException(message: "轨迹时间不合法");
|
||||
}
|
||||
@ -326,7 +328,9 @@ public partial class TrackService : ApplicationService, ITrackService
|
||||
//【更新】存在指定轨迹的内容(匹配到多条则不处理)
|
||||
var order = orders.First();
|
||||
|
||||
if (input.TrackTime < DateTime.Now.AddYears(-100) || input.TrackTime > DateTime.Now.AddYears(100))
|
||||
//要求时间在当前时间的前后100年之间内
|
||||
bool ValidateTrackTime(DateTime? d) => (d != null && d < DateTime.Now.AddYears(-100) || d > DateTime.Now.AddYears(100));
|
||||
if (ValidateTrackTime(input.TrackTime) || ValidateTrackTime(input.NewTrackTime))
|
||||
{
|
||||
throw new BusinessException(message: "轨迹时间不合法");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user