Commit 343a9178 authored by 潘栩锋's avatar 潘栩锋 🚴

优化 把1个月提示需要重启服务器, 改为3个月后才提示

parent 32c61afd
...@@ -430,11 +430,13 @@ namespace FLY.Thick.Blowing.Server ...@@ -430,11 +430,13 @@ namespace FLY.Thick.Blowing.Server
#region 数据库备份检测 #region 数据库备份检测
DispatcherTimer backupDbTimer; DispatcherTimer backupDbTimer;
DateTime StartupTime; DateTime startupTime;
DateTime lastTipBackupTime;
void BackupDbCheckInit() void BackupDbCheckInit()
{ {
StartupTime = DateTime.Now; startupTime = DateTime.Now;
lastTipBackupTime = startupTime;
//定时检查提示 //定时检查提示
backupDbTimer = new DispatcherTimer(); backupDbTimer = new DispatcherTimer();
backupDbTimer.Interval = TimeSpan.FromHours(1); backupDbTimer.Interval = TimeSpan.FromHours(1);
...@@ -446,16 +448,19 @@ namespace FLY.Thick.Blowing.Server ...@@ -446,16 +448,19 @@ namespace FLY.Thick.Blowing.Server
private void BackupDbTimer_Tick(object sender, EventArgs e) private void BackupDbTimer_Tick(object sender, EventArgs e)
{ {
//只有在9:00 到 21:00 才会检查,避免深夜出问题 //只有在9:00 到 21:00 才会检查,避免深夜出问题
if (DateTime.Now.Hour < 9 || DateTime.Now.Hour > 20) DateTime now = DateTime.Now;
if (now.Hour < 9 || now.Hour > 20)
return; return;
if (DateTime.Now - StartupTime > TimeSpan.FromDays(28) && DateTime.Now.Month != StartupTime.Month) if (now - startupTime < TimeSpan.FromDays(93))
{ return;//超过3个月,才能提示
//已经连续开机1个月,需要重新启动程序
warning.Add( if (now.Day == lastTipBackupTime.Day)
ERRNOs.Instance.BASE_ERRNO_DB_BACKUP.Code, return;//一天只提醒一次
ERRNOs.Instance.BASE_ERRNO_DB_BACKUP.Descrption);
} lastTipBackupTime = DateTime.Now;
//已经连续开机1个月,需要重新启动程序,
warning.Add(ERRNOs.Instance.BASE_ERRNO_DB_BACKUP);
} }
#endregion #endregion
......
...@@ -692,7 +692,6 @@ namespace FLY.Thick.BlowingScan.Server ...@@ -692,7 +692,6 @@ namespace FLY.Thick.BlowingScan.Server
thk = profile.Param.K * thk; thk = profile.Param.K * thk;
thk = Math.Round(thk, 2); thk = Math.Round(thk, 2);
return thk; return thk;
} }
...@@ -744,13 +743,13 @@ namespace FLY.Thick.BlowingScan.Server ...@@ -744,13 +743,13 @@ namespace FLY.Thick.BlowingScan.Server
} }
#region 数据库备份检测 #region 数据库备份检测
DispatcherTimer backupDbTimer; DispatcherTimer backupDbTimer;
DateTime StartupTime; DateTime startupTime;
DateTime lastTipBackupTime;
void BackupDbCheckInit() void BackupDbCheckInit()
{ {
StartupTime = DateTime.Now; startupTime = DateTime.Now;
lastTipBackupTime = startupTime;
//定时检查提示 //定时检查提示
backupDbTimer = new DispatcherTimer(); backupDbTimer = new DispatcherTimer();
backupDbTimer.Interval = TimeSpan.FromHours(1); backupDbTimer.Interval = TimeSpan.FromHours(1);
...@@ -762,16 +761,19 @@ namespace FLY.Thick.BlowingScan.Server ...@@ -762,16 +761,19 @@ namespace FLY.Thick.BlowingScan.Server
private void BackupDbTimer_Tick(object sender, EventArgs e) private void BackupDbTimer_Tick(object sender, EventArgs e)
{ {
//只有在9:00 到 21:00 才会检查,避免深夜出问题 //只有在9:00 到 21:00 才会检查,避免深夜出问题
if (DateTime.Now.Hour < 9 || DateTime.Now.Hour > 20) DateTime now = DateTime.Now;
if (now.Hour < 9 || now.Hour > 20)
return; return;
if (DateTime.Now - StartupTime > TimeSpan.FromDays(28) && DateTime.Now.Month != StartupTime.Month) if (now - startupTime < TimeSpan.FromDays(93))
{ return;//超过3个月,才能提示
//已经连续开机1个月,需要重新启动程序
warning.Add( if (now.Day == lastTipBackupTime.Day)
ERRNOs.Instance.BASE_ERRNO_DB_BACKUP.Code, return;//一天只提醒一次
ERRNOs.Instance.BASE_ERRNO_DB_BACKUP.Descrption);
} lastTipBackupTime = DateTime.Now;
//已经连续开机1个月,需要重新启动程序,
warning.Add(ERRNOs.Instance.BASE_ERRNO_DB_BACKUP);
} }
#endregion #endregion
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment