namespace Milimoe.FunGame.Core.Model { public class ScheduledTask(string name, TimeSpan timeSpan, Action action) { /// /// 任务名称 /// public string Name { get; set; } = name; /// /// 每天的目标时间 /// public TimeSpan TimeOfDay { get; set; } = timeSpan; /// /// 任务执行逻辑 /// public Action Action { get; set; } = action; /// /// 记录上一次运行时间 /// public DateTime? LastRun { get; set; } = null; /// /// 当天是否已经运行 /// public bool IsTodayRun => LastRun.HasValue && LastRun.Value.Date == DateTime.Today; /// /// 最后一次运行时发生的错误 /// public Exception? Error { get; set; } } }