using Furion.Logging; using Furion.TaskScheduler; namespace Admin.NET.Application.Serice; /// /// 任务调度测试 /// public class JobTimer : ISpareTimeWorker { /// /// 定时器 /// /// /// [SpareTime(5000, "定时器", StartNow = true, ExecuteType = SpareTimeExecuteTypes.Serial)] public void CollectDeviceChannel(SpareTimer timer, long count) { //// 写日志文件 //StringLoggingPart.Default.SetMessage("这是一个日志").LogInformation(); Scoped.Create(async (_, scope) => { var services = scope.ServiceProvider; var db = services.GetService(); // 写日志文件 StringLoggingPart.Default.SetMessage("【定时器】" + DateTime.Now + "执行次数:" + count).LogInformation(); }); } }