23123
This commit is contained in:
24
Service/Application.Web/Plug/Timer/AutoJob.cs
Normal file
24
Service/Application.Web/Plug/Timer/AutoJob.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Photon.Core.Timer;
|
||||
using Quartz;
|
||||
namespace Application.Web;
|
||||
|
||||
public class AutoJob: ITimerAutoJob
|
||||
{
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
string jobId = context.JobDetail.Key.Name;
|
||||
if (!string.IsNullOrEmpty(jobId))
|
||||
{
|
||||
var jobService = App.GetService<IGameAutoJobService>();
|
||||
var jobData = await jobService.GetJobInfo(jobId);
|
||||
if (jobData != null)
|
||||
{
|
||||
await jobService.HandleJob(jobData);
|
||||
if (jobData.opType == nameof(GameEnum.JobType.single))
|
||||
{
|
||||
await jobService.StopJob(jobId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user