feat 配送点管理
This commit is contained in:
32
Src/Dlhis.ScheduledTask/CommonJobs/DelApiLogTaskJob.cs
Normal file
32
Src/Dlhis.ScheduledTask/CommonJobs/DelApiLogTaskJob.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Dlhis.Entity.Common;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.ScheduledTask.CommonJobs;
|
||||
|
||||
public class DelApiLogTaskJob
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public DelApiLogTaskJob(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task RunAsync()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime todayStart = now.Date;
|
||||
DateTime threeDaysAgoStart = todayStart.AddDays(-3);
|
||||
|
||||
var logs = await _dbContext.ChangeDb("log")
|
||||
.Queryable<ApiLogEntity>()
|
||||
.Where(x => x._ts<= threeDaysAgoStart)
|
||||
.OrderBy(x =>x._ts,OrderByType.Asc)
|
||||
.ToListAsync();
|
||||
|
||||
await _dbContext.ChangeDb("log").DeleteReallyAsync(logs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user