35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using MAX.Core.DependencyInjection;
|
|
using MAX.Core.Logger;
|
|
using Store.Framework.Jobs;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Web;
|
|
|
|
namespace KJD_Web.Services.Shops;
|
|
|
|
/// <summary>
|
|
/// 更新商铺统计 每天0:5分 统计
|
|
/// </summary>
|
|
[Job("ShopStats", "5 0 * * *")]
|
|
public class ShopStatsJob : IScheduledJobs, ITransientDependency
|
|
{
|
|
private readonly ShopRevenueStatisticsService _shopRevenueStatisticsService;
|
|
private readonly ILoggerFacade _logger;
|
|
|
|
public ShopStatsJob(ShopRevenueStatisticsService shopRevenueStatisticsService, ILoggerFacade logger)
|
|
{
|
|
_shopRevenueStatisticsService = shopRevenueStatisticsService;
|
|
_logger = logger;
|
|
}
|
|
public Task RunAsync()
|
|
{
|
|
var data = DateTime.Now.AddDays(-1).Date;
|
|
_logger.Info($">>> 执行商铺统计更新:{data.ToString("yyyy-MM-dd")}");
|
|
_shopRevenueStatisticsService.UpdateStats(data);
|
|
_logger.Info($"<<< 执行商铺更新:{data.ToString("yyyy-MM-dd")}");
|
|
return Task.CompletedTask;
|
|
|
|
}
|
|
} |