/// <summary>
        /// 每日热点数据抓取
        /// </summary>
        /// <param name="context"></param>
        public static void UseHotNewsJob(this IServiceProvider service)
        {
            var job = service.GetService <HotNewsJob>();

            RecurringJob.AddOrUpdate("每日热点数据抓取", () => job.ExecuteAsync(), CronType.Hour(1, 2));
        }
        /// <summary>
        /// 壁纸数据抓取
        /// </summary>
        /// <param name="service"></param>
        public static void UseWallpaperJob(this IServiceProvider service)
        {
            var job = service.GetService <WallpaperJob>();

            RecurringJob.AddOrUpdate("壁纸数据抓取", () => job.ExecuteAsync(), CronType.Hour(1, 3));
        }
        public static void UseWallpaperJob(this ApplicationInitializationContext context)
        {
            var job = context.ServiceProvider.GetService <WallpaperJob>();

            RecurringJob.AddOrUpdate("壁纸数据抓取", () => job.RunAsync(), CronType.Hour(1, 3));
        }
Example #4
0
        public static void UseHangfireTest(this IServiceProvider service)
        {
            var job = service.GetService <HangfireTestJob>();

            RecurringJob.AddOrUpdate("定时任务测试", () => job.ExecuteAsync(), CronType.Minute());
        }
        public static void UseHotNewsJob(this ApplicationInitializationContext context)
        {
            var job = context.ServiceProvider.GetService <HotNewsJob>();

            RecurringJob.AddOrUpdate("每日热点数据抓取", () => job.RunAsync(), CronType.Hour(10, 2));
        }