Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hemei
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
hemei
Commits
343a9178
Commit
343a9178
authored
Oct 29, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 把1个月提示需要重启服务器, 改为3个月后才提示
parent
32c61afd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
24 deletions
+31
-24
TDGage.cs
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/TDGage.cs
+16
-11
TDGage.cs
....Thick.BlowingScan/FLY.Thick.BlowingScan/Server/TDGage.cs
+15
-13
No files found.
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/TDGage.cs
View file @
343a9178
...
...
@@ -430,11 +430,13 @@ namespace FLY.Thick.Blowing.Server
#
region
数据库备份检测
DispatcherTimer
backupDbTimer
;
DateTime
StartupTime
;
DateTime
startupTime
;
DateTime
lastTipBackupTime
;
void
BackupDbCheckInit
()
{
S
tartupTime
=
DateTime
.
Now
;
s
tartupTime
=
DateTime
.
Now
;
lastTipBackupTime
=
startupTime
;
//定时检查提示
backupDbTimer
=
new
DispatcherTimer
();
backupDbTimer
.
Interval
=
TimeSpan
.
FromHours
(
1
);
...
...
@@ -446,16 +448,19 @@ namespace FLY.Thick.Blowing.Server
private
void
BackupDbTimer_Tick
(
object
sender
,
EventArgs
e
)
{
//只有在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
;
if
(
DateTime
.
Now
-
StartupTime
>
TimeSpan
.
FromDays
(
28
)
&&
DateTime
.
Now
.
Month
!=
StartupTime
.
Month
)
{
//已经连续开机1个月,需要重新启动程序
warning
.
Add
(
ERRNOs
.
Instance
.
BASE_ERRNO_DB_BACKUP
.
Code
,
ERRNOs
.
Instance
.
BASE_ERRNO_DB_BACKUP
.
Descrption
);
}
if
(
now
-
startupTime
<
TimeSpan
.
FromDays
(
93
))
return
;
//超过3个月,才能提示
if
(
now
.
Day
==
lastTipBackupTime
.
Day
)
return
;
//一天只提醒一次
lastTipBackupTime
=
DateTime
.
Now
;
//已经连续开机1个月,需要重新启动程序,
warning
.
Add
(
ERRNOs
.
Instance
.
BASE_ERRNO_DB_BACKUP
);
}
#
endregion
...
...
Project.FLY.Thick.BlowingScan/FLY.Thick.BlowingScan/Server/TDGage.cs
View file @
343a9178
...
...
@@ -692,7 +692,6 @@ namespace FLY.Thick.BlowingScan.Server
thk
=
profile
.
Param
.
K
*
thk
;
thk
=
Math
.
Round
(
thk
,
2
);
return
thk
;
}
...
...
@@ -744,13 +743,13 @@ namespace FLY.Thick.BlowingScan.Server
}
#
region
数据库备份检测
DispatcherTimer
backupDbTimer
;
DateTime
S
tartupTime
;
DateTime
s
tartupTime
;
DateTime
lastTipBackupTime
;
void
BackupDbCheckInit
()
{
S
tartupTime
=
DateTime
.
Now
;
s
tartupTime
=
DateTime
.
Now
;
lastTipBackupTime
=
startupTime
;
//定时检查提示
backupDbTimer
=
new
DispatcherTimer
();
backupDbTimer
.
Interval
=
TimeSpan
.
FromHours
(
1
);
...
...
@@ -762,16 +761,19 @@ namespace FLY.Thick.BlowingScan.Server
private
void
BackupDbTimer_Tick
(
object
sender
,
EventArgs
e
)
{
//只有在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
;
if
(
DateTime
.
Now
-
StartupTime
>
TimeSpan
.
FromDays
(
28
)
&&
DateTime
.
Now
.
Month
!=
StartupTime
.
Month
)
{
//已经连续开机1个月,需要重新启动程序
warning
.
Add
(
ERRNOs
.
Instance
.
BASE_ERRNO_DB_BACKUP
.
Code
,
ERRNOs
.
Instance
.
BASE_ERRNO_DB_BACKUP
.
Descrption
);
}
if
(
now
-
startupTime
<
TimeSpan
.
FromDays
(
93
))
return
;
//超过3个月,才能提示
if
(
now
.
Day
==
lastTipBackupTime
.
Day
)
return
;
//一天只提醒一次
lastTipBackupTime
=
DateTime
.
Now
;
//已经连续开机1个月,需要重新启动程序,
warning
.
Add
(
ERRNOs
.
Instance
.
BASE_ERRNO_DB_BACKUP
);
}
#
endregion
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment