diff --git a/HealthMonitor.Common/DateTimeUtil.cs b/HealthMonitor.Common/DateTimeUtil.cs index 3d98312..d1ff884 100644 --- a/HealthMonitor.Common/DateTimeUtil.cs +++ b/HealthMonitor.Common/DateTimeUtil.cs @@ -736,8 +736,15 @@ namespace HealthMonitor.Common return 1; // 23点到0点时,返回次日1小时 } + // 处理 22 点特殊情况 + if (currentHour == 22) + { + return 0; // 22点到23点时,返回次日0小时 + } + + // 计算其他时间的返回值 - return (currentHour / 2 + 1) * 2; + return (int)((Math.Round(currentHour / 2.0, 1) + 1) * 2); } ///// diff --git a/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs b/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs index c81e1dc..ed73f5c 100644 --- a/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs +++ b/HealthMonitor.Service/Resolver/PregnancyHeartRateResolver.cs @@ -257,7 +257,7 @@ namespace HealthMonitor.Service.Resolver ); // 跨天 - if (selectedScheduleHour == 1) + if (selectedScheduleHour == 1 || selectedScheduleHour == 0) { scheduledDateTime = scheduledDateTime.AddDays(1); }