|
|
|
@ -3,40 +3,30 @@ using HybirdFrameworkCore.Autofac;
|
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
using HybirdFrameworkCore.Job;
|
|
|
|
|
using log4net;
|
|
|
|
|
using Quartz;
|
|
|
|
|
using Quartz.Impl.Triggers;
|
|
|
|
|
using Repository.System;
|
|
|
|
|
|
|
|
|
|
namespace Service.Job;
|
|
|
|
|
|
|
|
|
|
[Scope]
|
|
|
|
|
public class TestJob : IMyJob
|
|
|
|
|
public class TestJob : AbstractCronJob
|
|
|
|
|
{
|
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(TestJob));
|
|
|
|
|
|
|
|
|
|
private SysConfigRepository SysConfigRepository = AppInfo.Container.Resolve<SysConfigRepository>();
|
|
|
|
|
|
|
|
|
|
public JobKey GetJobKey()
|
|
|
|
|
protected override Task Handle()
|
|
|
|
|
{
|
|
|
|
|
return JobKey.Create("default", JobKey.DefaultGroup);
|
|
|
|
|
Log.Info("work");
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ITrigger GetTrigger()
|
|
|
|
|
protected override string Key()
|
|
|
|
|
{
|
|
|
|
|
return new CronTriggerImpl("d", "d", "0/5 * * * * ?");
|
|
|
|
|
return "test-job";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task Execute(IJobExecutionContext context)
|
|
|
|
|
protected override string Cron()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Log.Info($"{SysConfigRepository.GetHashCode()}");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Log.Error(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
return "0/2 * * * * ?";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|