namespace QYZH.InteractiveMagazine.Models.Settings; /// /// Hangfire 定时任务配置集合(对应 appsettings.json 中的 "HangfireJobs" 节点) /// public class HangfireJobSettings { /// /// 定时任务列表,每一项对应一个 Hangfire RecurringJob /// public List Jobs { get; set; } = new(); } /// /// 单个定时任务配置 /// public class HangfireJobConfig { /// /// 任务名称(Hangfire Dashboard 中展示的唯一标识,建议英文短横线命名,如 "sample-job") /// public string Name { get; set; } = ""; /// /// Job 类的完整类型名称(含命名空间,如 "QYZH.InteractiveMagazine.WorkService.Jobs.SampleJob") /// public string JobType { get; set; } = ""; /// /// 要调用的方法名称(默认 "ExecuteAsync",方法必须为 public 无参 Task) /// public string MethodName { get; set; } = "ExecuteAsync"; /// /// Cron 表达式,控制执行频率。常用示例: /// "* * * * *" 每分钟 /// "*/5 * * * *" 每5分钟 /// "0 * * * *" 每小时整点 /// "0 0 * * *" 每天午夜 /// "0 9 * * *" 每天上午9点 /// "0 9 * * 1" 每周一上午9点 /// "0 0 1 * *" 每月1号午夜 /// 格式:分 时 日 月 星期(5位,不支持秒和年) /// public string Cron { get; set; } = ""; /// /// 是否启用此任务(设为 false 将从 Hangfire 中移除该任务) /// public bool Enabled { get; set; } = true; /// /// 备注说明(仅供阅读理解,不参与运行逻辑) /// public string? Description { get; set; } }