Commit 5e3b343d authored by 黄奎's avatar 黄奎

定时任务修改

parent 7691f383
...@@ -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;
} }
......
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