61 lines
1.8 KiB
C#
61 lines
1.8 KiB
C#
using Furion;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Ewide.Nbzs.BackWorkerService
|
|
{
|
|
public class Worker : BackgroundService
|
|
{
|
|
public SqlSugarClient db;
|
|
private readonly ILogger<Worker> _logger;
|
|
|
|
public Worker(ILogger<Worker> logger)
|
|
{
|
|
_logger = logger;
|
|
List<ConnectionConfig> connectConfigList = new()
|
|
{
|
|
new ConnectionConfig
|
|
{
|
|
ConnectionString = App.Configuration["SqlServerConnectionString:DefaultConnection"],
|
|
DbType = DbType.SqlServer,
|
|
IsAutoCloseConnection = true,
|
|
InitKeyType = InitKeyType.Attribute,
|
|
ConfigId = "0"
|
|
}
|
|
};
|
|
db = new SqlSugarClient(connectConfigList);
|
|
}
|
|
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
{
|
|
while (!stoppingToken.IsCancellationRequested)
|
|
{
|
|
ExecProcess();
|
|
//var asd = db.Queryable<Ewide.NbzsZheliban.Entity.zjzwfwTickets>().ToList();
|
|
var asd = db.Queryable<Ewide.NbzsZheliban.Entity.InvestigateTable>().ToList();
|
|
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
|
await Task.Delay(1000, stoppingToken);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Ö´ÐÐÈÎÎñ ÿÃë
|
|
/// </summary>
|
|
private void ExecProcess()
|
|
{
|
|
Thread.Sleep(3000);
|
|
}
|
|
|
|
private void ExecPushProcess()
|
|
{
|
|
|
|
|
|
}
|
|
}
|
|
}
|