31 lines
1006 B
C#
31 lines
1006 B
C#
using Microsoft.Extensions.Hosting;
|
|
using SJZY.Expand.ABP.Core.Logger;
|
|
using SJZY.Track.Domain.Aggregates.OrderAggregate;
|
|
|
|
namespace SJZY.Track.Application.BackgroundServices;
|
|
|
|
public class OrderPullStatusScanner : BackgroundService
|
|
{
|
|
private readonly IOrderRepository _orderRepository;
|
|
|
|
public OrderPullStatusScanner(IOrderRepository orderRepository)
|
|
{
|
|
_orderRepository = orderRepository;
|
|
}
|
|
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
{
|
|
var count = await _orderRepository.UpdatePullStatusBySilenceAsync();
|
|
if (count > 0)
|
|
{
|
|
LogHelper.Info($"{nameof(OrderPullStatusScanner)}本次扫描更新了{count}条订单拉取状态");
|
|
}
|
|
|
|
// real del
|
|
count = await _orderRepository.ClearPullStatusAsync();
|
|
LogHelper.Info($"{nameof(OrderPullStatusScanner)}本次扫描删除了{count}条订单拉取状态");
|
|
|
|
await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken);
|
|
}
|
|
}
|