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
56a8a829
Commit
56a8a829
authored
Jan 26, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
缓存修改
parent
26422b2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
16 deletions
+25
-16
TimerJobj.cs
Edu.WebApi/Timers/TimerJobj.cs
+25
-16
No files found.
Edu.WebApi/Timers/TimerJobj.cs
View file @
56a8a829
using
Edu.Common.Plugin
;
using
Edu.CacheManager.Base
;
using
Edu.Common.Plugin
;
using
Edu.Module.Course
;
using
Edu.Module.Customer
;
using
Edu.Module.Duty
;
...
...
@@ -40,6 +41,13 @@ namespace Edu.WebApi.Timers
/// </summary>
private
static
readonly
PaperModule
paperModule
=
new
PaperModule
();
/// <summary>
/// 使用redis第几号库
/// </summary>
static
readonly
int
REDIS_DB3
=
3
;
static
readonly
RedisHelper
redis
=
new
RedisHelper
(
REDIS_DB3
);
/// <summary>
/// 课程顾问部和市场部数据统计
/// </summary>
...
...
@@ -87,7 +95,7 @@ namespace Edu.WebApi.Timers
timer4
=
new
System
.
Timers
.
Timer
()
{
Interval
=
(
1000
*
60
)
*
(
1
*
10
)
//10分中执行一次
Interval
=
(
1000
*
60
)
*
(
1
*
10
)
//10分中执行一次
};
timer4
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
UpdateAuditThroughStudent
);
timer4
.
Enabled
=
true
;
...
...
@@ -113,9 +121,9 @@ namespace Edu.WebApi.Timers
finishGuest
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
DealGuestFinish
);
finishGuest
.
Enabled
=
true
;
marketTimer
=
new
System
.
Timers
.
Timer
()
marketTimer
=
new
System
.
Timers
.
Timer
()
{
Interval
=
(
1000
)
*
(
1
)
//1秒检测一次 00:30:00 每天执行
一次
Interval
=
(
1000
*
60
)
*
(
1
)
//1小时检查
一次
};
marketTimer
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
DealMarketConsultantData
);
marketTimer
.
Enabled
=
true
;
...
...
@@ -146,6 +154,7 @@ namespace Edu.WebApi.Timers
private
static
int
marketconsultant_Timer
=
0
;
private
static
string
createMarkDataKey
=
"createMarkDataKey"
;
/// <summary>
/// 定时生成市场部和课程顾问部数据统计
/// </summary>
...
...
@@ -153,20 +162,20 @@ namespace Edu.WebApi.Timers
/// <param name="e"></param>
public
static
void
DealMarketConsultantData
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
if
(
Interlocked
.
Exchange
(
ref
marketconsultant_Timer
,
1
)
==
0
)
if
(
Interlocked
.
Exchange
(
ref
marketconsultant_Timer
,
1
)
==
0
)
{
int
intHour
=
e
.
SignalTime
.
Hour
;
int
intMinute
=
e
.
SignalTime
.
Minute
;
int
intSecond
=
e
.
SignalTime
.
Second
;
// 定制时间;比如 在00:30:00 的时候执行某个函数
int
iHour
=
00
;
int
iMinute
=
30
;
int
iSecond
=
00
;
// 设置每天的
if
(
intHour
==
iHour
&&
intMinute
==
iMinute
&&
intSecond
==
iSecond
)
var
currentDate
=
DateTime
.
Now
;
string
cacheData
=
redis
.
Get
(
createMarkDataKey
);
if
(
string
.
IsNullOrEmpty
(
cacheData
))
{
redis
.
Set
(
createMarkDataKey
,
Common
.
ConvertHelper
.
FormatDate
(
currentDate
));
cacheData
=
Common
.
ConvertHelper
.
FormatDate
(
currentDate
);
}
if
(!
string
.
IsNullOrEmpty
(
cacheData
)
&&
cacheData
!=
Common
.
ConvertHelper
.
FormatDate
(
currentDate
))
{
marketConsultantModule
.
CreateConsultantDataModule
(
DateTime
.
Now
);
marketConsultantModule
.
CreateMarketDataModule
(
DateTime
.
Now
);
redis
.
Set
(
createMarkDataKey
,
Common
.
ConvertHelper
.
FormatDate
(
currentDate
));
marketConsultantModule
.
CreateConsultantDataModule
(
currentDate
);
marketConsultantModule
.
CreateMarketDataModule
(
currentDate
);
}
Interlocked
.
Exchange
(
ref
marketconsultant_Timer
,
0
);
}
...
...
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