fix 处理同步时间,调整到5点

This commit is contained in:
2025-05-24 20:29:49 +08:00
parent 55f68d2009
commit ac88ae7a3b
2 changed files with 17 additions and 29 deletions

View File

@@ -48,7 +48,7 @@ public class BalanceRecordUploadBackgroundService : BackgroundService
var balanceRecords = await db.Queryable<LocalBalanceRecordEntity>()
.Where(x => x.TenantId == factory)
.Where(x => !x.IsSync).ToListAsync(stoppingToken);
if (balanceRecords.Any())
{
_logger.LogInformation("上传离线订单");
@@ -104,24 +104,12 @@ public class BalanceRecordUploadBackgroundService : BackgroundService
try
{
if (now is { Hour: 4, Minute: 1 }
if (now is { Hour: 5, Minute: 1 }
&& !_healthCheckService.GetIsOffline()
&& !await db.Queryable<LocalBalanceRecordEntity>().Where(x => !x.IsSync).AnyAsync())
{
await ds.InitAsync(factories);
}
else if (now is { Hour: 15, Minute: 1 }
&& !_healthCheckService.GetIsOffline()
&& !await db.Queryable<LocalBalanceRecordEntity>().Where(x => !x.IsSync).AnyAsync())
{
await ds.InitAsync(factories);
}
else if (now is { Hour: 20, Minute: 1 }
&& !_healthCheckService.GetIsOffline()
&& !await db.Queryable<LocalBalanceRecordEntity>().Where(x => !x.IsSync).AnyAsync())
{
await ds.InitAsync(factories);
}
}
catch (Exception e)
{