增加定时任务,

This commit is contained in:
chfei committed 2026-09-30 15:46:20 +08:00
1 parent be1fc11e07
commit be08510a84
10 files changed
+171 -8

No files matched your search

@@ -0,0 +1,15 @@
using Hangfire;
using System.ComponentModel;
using System.Web.Http.Dependencies;
namespace Store.Framework.Jobs;
public class ContainerJobActivator : JobActivator
{
private readonly IDependencyResolver _provider;
public ContainerJobActivator(IDependencyResolver provider) => _provider = provider;
public override object ActivateJob(Type jobType)
=> _provider.GetService(jobType);
}
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Store.Framework.Jobs;
public interface IScheduledJobs
{
Task RunAsync();
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Store.Framework.Jobs;
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class JobAttribute : Attribute
{
public string Name { get; }
public string Cron { get; }
public JobAttribute(string name, string cron)
{
Name = name;
Cron = cron;
}
}