Browse Source

Some change

master
fajiao 2 years ago
parent
commit
dbdad53324
  1. 13
      Cis.Application/Core/Center/CameraDataCenter.cs
  2. 1
      Cis.Application/GlobalUsings.cs
  3. 2
      Cis.Application/Startup.cs
  4. 2
      Cis.Application/Sys/Common/SysInfo.cs
  5. 14
      Cis.Web.Entry/Program.cs

13
Cis.Application/Core/Center/CameraDataCenter.cs

@ -1,6 +1,7 @@
using Cis.Application.Cb;
using Cis.Application.Cm;
using Cis.Application.Tb;
using Microsoft.Extensions.Logging;
using System.Collections.Concurrent;
namespace Cis.Application.Core;
@ -13,7 +14,7 @@ public class CameraDataCenter
private readonly SqlSugarRepository<CmMarkLabel> _cmMarkLableRep;
private readonly SqlSugarRepository<TbPtzCamera> _tbPtzCameraRep;
private readonly PtzServerApi _ptzServerApi;
private readonly CameraDataOptions options = App.GetOptions<CameraDataOptions>();
private readonly CameraDataOptions options;
private Thread _thread { get; set; }
@ -50,12 +51,16 @@ public class CameraDataCenter
#endregion Attr
private readonly ILogger<CameraDataCenter> _logger;
public CameraDataCenter()
{
_cbCameraRep = App.GetService<SqlSugarRepository<CbCamera>>();
_cmMarkLableRep = App.GetService<SqlSugarRepository<CmMarkLabel>>();
_tbPtzCameraRep = App.GetService<SqlSugarRepository<TbPtzCamera>>();
_ptzServerApi = App.GetService<PtzServerApi>();
options = App.GetOptions<CameraDataOptions>();
_logger = App.GetService<ILogger<CameraDataCenter>>();
Init();
}
@ -104,7 +109,7 @@ public class CameraDataCenter
}
}
private void RefreshMarkSearcher()
private async void RefreshMarkSearcher()
{
foreach (KeyValuePair<long, MarkSearcherBase> pair in _markSearcherDict)
{
@ -115,7 +120,7 @@ public class CameraDataCenter
ret = _cameraPtzInfoDict.TryGetValue(cameraIp, out PtzInfo ptzInfo);
if (!ret) continue;
markSearcher.UpdateCameraCalcInfo(ptzInfo);
List<MarkLabelCalcResult> resultList = markSearcher.Calc();
List<MarkLabelCalcResult> resultList = await markSearcher.CalcAsync();
_markLabelCalcResultListDict[cameraId] = resultList;
}
}
@ -247,7 +252,7 @@ public class CameraDataCenter
public PtzInfo GetCameraPtzInfo(long cameraId)
{
PtzInfo ptzInfo = null;
bool ret = _cbCameraId2IpDict.TryGetValue(cameraId,out string cameraIp) &&
bool ret = _cbCameraId2IpDict.TryGetValue(cameraId, out string cameraIp) &&
_cameraPtzInfoDict.TryGetValue(cameraIp, out ptzInfo);
return ret ? ptzInfo : null;
}

1
Cis.Application/GlobalUsings.cs

@ -3,6 +3,7 @@ global using Furion;
global using Furion.ConfigurableOptions;
global using Furion.DependencyInjection;
global using Furion.DynamicApiController;
global using Furion.FriendlyException;
global using Microsoft.AspNetCore.Mvc;
global using SqlSugar;
global using System.ComponentModel.DataAnnotations;

2
Cis.Application/Startup.cs

@ -17,7 +17,7 @@ public class Startup : AppStartup
services.AddConfigurableOptions<CameraDataOptions>();
services.AddConfigurableOptions<PtzServerOptions>();
services.AddSingleton<CameraDataCenter>(new CameraDataCenter());
services.AddSingleton(new CameraDataCenter());
}
/// <summary>

2
Cis.Application/Sys/Common/SysInfo.cs

@ -10,7 +10,7 @@ public class SysInfo
/// <summary>
/// Api 分组名
/// </summary>
public const string GroupName = "Sys";
public const string GroupName = "System";
/// <summary>
/// Api 分组排序

14
Cis.Web.Entry/Program.cs

@ -1 +1,13 @@
Serve.Run(RunOptions.Default.WithArgs(args));
Serve.Run(RunOptions.Default.AddWebComponent<WebComponent>().WithArgs(args));
public class WebComponent : IWebComponent
{
public void Load(WebApplicationBuilder builder, ComponentContext componentContext)
{
// ÈÕÖ¾¹ýÂË
builder.Logging.AddFilter((provider, category, logLevel) =>
{
return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u)) && logLevel >= LogLevel.Information;
});
}
}
Loading…
Cancel
Save