|
@@ -32,6 +32,7 @@ namespace Masuit.MyBlogs.Core.Extensions.Hangfire
|
|
|
private readonly IHttpClientFactory _httpClientFactory;
|
|
|
private readonly IWebHostEnvironment _hostEnvironment;
|
|
|
private readonly ISearchEngine<DataContext> _searchEngine;
|
|
|
+ private readonly IAdvertisementService _advertisementService;
|
|
|
|
|
|
/// <summary>
|
|
|
/// hangfire后台任务
|
|
@@ -44,7 +45,7 @@ namespace Masuit.MyBlogs.Core.Extensions.Hangfire
|
|
|
/// <param name="httpClientFactory"></param>
|
|
|
/// <param name="HostEnvironment"></param>
|
|
|
/// <param name="searchEngine"></param>
|
|
|
- public HangfireBackJob(IUserInfoService userInfoService, IPostService postService, ISystemSettingService settingService, ISearchDetailsService searchDetailsService, ILinksService linksService, IHttpClientFactory httpClientFactory, IWebHostEnvironment HostEnvironment, ISearchEngine<DataContext> searchEngine)
|
|
|
+ public HangfireBackJob(IUserInfoService userInfoService, IPostService postService, ISystemSettingService settingService, ISearchDetailsService searchDetailsService, ILinksService linksService, IHttpClientFactory httpClientFactory, IWebHostEnvironment HostEnvironment, ISearchEngine<DataContext> searchEngine, IAdvertisementService advertisementService)
|
|
|
{
|
|
|
_userInfoService = userInfoService;
|
|
|
_postService = postService;
|
|
@@ -54,6 +55,7 @@ namespace Masuit.MyBlogs.Core.Extensions.Hangfire
|
|
|
_httpClientFactory = httpClientFactory;
|
|
|
_hostEnvironment = HostEnvironment;
|
|
|
_searchEngine = searchEngine;
|
|
|
+ _advertisementService = advertisementService;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -155,6 +157,18 @@ namespace Masuit.MyBlogs.Core.Extensions.Hangfire
|
|
|
TrackData.DumpLog();
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 每月的任务
|
|
|
+ /// </summary>
|
|
|
+ public void EverymonthJob()
|
|
|
+ {
|
|
|
+ _advertisementService.GetAll().UpdateFromQuery(a => new Advertisement()
|
|
|
+ {
|
|
|
+ DisplayCount = 0,
|
|
|
+ ViewCount = 0
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 检查友链
|
|
|
/// </summary>
|