Exemple #1
0
        private void AddTrafficJob(ApplicationInitializationContext context)
        {
            //周期性作业
            var trafficBackgroungJob = context.ServiceProvider.GetRequiredService <TrafficBackgroungJob>();

            RecurringJob.AddOrUpdate("每天服务异常量统计",
                                     () => trafficBackgroungJob.ExecuteAsync(null),
                                     HelloAbpCronType.Minute());
        }
Exemple #2
0
        private async Task AddChinaRegionJob(ApplicationInitializationContext context)
        {
            var regionJob = context.ServiceProvider.GetRequiredService <CrawlingChinaRegionJob>();
            var provinces = await regionJob.GetProvincesAsync();

            foreach (var dic in provinces)
            {
                RecurringJob.AddOrUpdate($"{dic.Key}--每个月同步",
                                         () => regionJob.ExecuteAsync(new ChinaRegionArgs()
                {
                    Province = dic.Key,
                    Href     = dic.Value
                }),
                                         HelloAbpCronType.Month());
            }
        }