Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
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
黄奎
Education
Commits
5e3b343d
Commit
5e3b343d
authored
3 years ago
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时任务修改
parent
7691f383
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
TimerJobj.cs
Edu.WebApi/Timers/TimerJobj.cs
+15
-5
No files found.
Edu.WebApi/Timers/TimerJobj.cs
View file @
5e3b343d
...
@@ -6,9 +6,15 @@ using System.Threading;
...
@@ -6,9 +6,15 @@ using System.Threading;
namespace
Edu.WebApi.Timers
namespace
Edu.WebApi.Timers
{
{
/// <summary>
/// 定时任务
/// </summary>
public
class
TimerJobj
public
class
TimerJobj
{
{
private
static
DutyPlanModule
dutyPlanModule
=
AOP
.
AOPHelper
.
CreateAOPObject
<
DutyPlanModule
>();
/// <summary>
/// 值班处理对象
/// </summary>
private
static
readonly
DutyPlanModule
dutyPlanModule
=
AOP
.
AOPHelper
.
CreateAOPObject
<
DutyPlanModule
>();
static
System
.
Timers
.
Timer
timer1
;
//计时器
static
System
.
Timers
.
Timer
timer1
;
//计时器
...
@@ -16,13 +22,17 @@ namespace Edu.WebApi.Timers
...
@@ -16,13 +22,17 @@ namespace Edu.WebApi.Timers
public
static
void
RunTimer
()
public
static
void
RunTimer
()
{
{
timer1
=
new
System
.
Timers
.
Timer
();
timer1
=
new
System
.
Timers
.
Timer
timer1
.
Interval
=
1000
*
(
60
*
60
)
*
3
;
//60分钟
{
Interval
=
1000
*
(
60
*
60
)
*
3
//60分钟
};
timer1
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
ClearFile
);
timer1
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
ClearFile
);
timer1
.
Enabled
=
true
;
timer1
.
Enabled
=
true
;
timer2
=
new
System
.
Timers
.
Timer
();
timer2
=
new
System
.
Timers
.
Timer
timer2
.
Interval
=
(
1000
*
60
)
*
(
1
*
60
);
//1小时执行一次
{
Interval
=
(
1000
*
60
)
*
(
1
*
60
)
//1小时执行一次
};
timer2
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
DealDuty
);
timer2
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
DealDuty
);
timer2
.
Enabled
=
true
;
timer2
.
Enabled
=
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
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