Browse Source

[fix]: 完善一些不足

master
fajiao 2 years ago
parent
commit
ed3384fcb2
  1. 6
      Cis.Application/Cb/Service/CbCameraService.cs
  2. 261
      Cis.Application/Cis.Application.xml
  3. 36
      Cis.Application/Cm/Service/CmMarkGroupService.cs
  4. 35
      Cis.Application/Cm/Service/CmMarkLabelService.cs
  5. 5
      Cis.Application/Core/Service/MarkSearchService.cs
  6. 36
      Cis.Application/Sys/Service/SysDictDataService.cs
  7. 35
      Cis.Application/Sys/Service/SysDictTypeService.cs
  8. 36
      Cis.Application/Tb/Service/TbPtzCameraService.cs
  9. 3
      Cis.Core/CoreConfig.json
  10. 2
      Cis.Core/Extension/ObjectExtension.cs
  11. 14
      Cis.Web.Core/Startup.cs
  12. 23
      Cis.Web.Entry/Properties/launchSettings.json

6
Cis.Application/Cb/Service/CbCameraService.cs

@ -15,12 +15,14 @@ public class CbCameraService : IDynamicApiController, ITransient
_cbCameraRep = cbCameraRep; _cbCameraRep = cbCameraRep;
} }
[HttpGet]
public async Task<CbCamera> Get(long id) public async Task<CbCamera> Get(long id)
{ {
CbCamera entity = await _cbCameraRep.GetByIdAsync(id); CbCamera entity = await _cbCameraRep.GetByIdAsync(id);
return entity; return entity;
} }
[HttpGet]
public async Task<List<CbCamera>> GetList(string queryJson = "") public async Task<List<CbCamera>> GetList(string queryJson = "")
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
@ -29,6 +31,7 @@ public class CbCameraService : IDynamicApiController, ITransient
return list; return list;
} }
[HttpGet]
public async Task<List<CbCamera>> GetPageList(string queryJson, string pagination) public async Task<List<CbCamera>> GetPageList(string queryJson, string pagination)
{ {
Pagination pageObj = pagination.ToObject<Pagination>(); Pagination pageObj = pagination.ToObject<Pagination>();
@ -38,16 +41,19 @@ public class CbCameraService : IDynamicApiController, ITransient
return list; return list;
} }
[HttpPost]
public async Task Add(CbCamera entity) public async Task Add(CbCamera entity)
{ {
await _cbCameraRep.InsertAsync(entity); await _cbCameraRep.InsertAsync(entity);
} }
[HttpPost]
public async Task Update(CbCamera entity) public async Task Update(CbCamera entity)
{ {
await _cbCameraRep.UpdateAsync(entity); await _cbCameraRep.UpdateAsync(entity);
} }
[HttpPost]
public async Task Delete(CbCamera entity) public async Task Delete(CbCamera entity)
{ {
await _cbCameraRep.DeleteAsync(entity); await _cbCameraRep.DeleteAsync(entity);

261
Cis.Application/Cis.Application.xml

@ -134,6 +134,16 @@
标记标签表 标记标签表
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Cm.CmMarkLabel.CbCameraId">
<summary>
相机 Id
</summary>
</member>
<member name="P:Cis.Application.Cm.CmMarkLabel.CmMarkGroupId">
<summary>
标记组 Id
</summary>
</member>
<member name="P:Cis.Application.Cm.CmMarkLabel.Name"> <member name="P:Cis.Application.Cm.CmMarkLabel.Name">
<summary> <summary>
名称 名称
@ -141,17 +151,17 @@
</member> </member>
<member name="P:Cis.Application.Cm.CmMarkLabel.PanPosition"> <member name="P:Cis.Application.Cm.CmMarkLabel.PanPosition">
<summary> <summary>
Pan 位置 Pan 坐标
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Cm.CmMarkLabel.TiltPosition"> <member name="P:Cis.Application.Cm.CmMarkLabel.TiltPosition">
<summary> <summary>
Tilt 位置 Tilt 坐标
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Cm.CmMarkLabel.ZoomPosition"> <member name="P:Cis.Application.Cm.CmMarkLabel.ZoomPosition">
<summary> <summary>
Zoom 位置 Zoom 坐标
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Cm.CmMarkLabel.Remark"> <member name="P:Cis.Application.Cm.CmMarkLabel.Remark">
@ -159,45 +169,88 @@
备注 备注
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Cm.CmMarkLabel.CbCameraId"> <member name="T:Cis.Application.Cm.CmMarkGroupService">
<summary> <summary>
相机 Id 标记分组服务
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Cm.CmMarkLabel.CmMarkGroupId"> <member name="T:Cis.Application.Cm.CmMarkLabelService">
<summary> <summary>
标记组 Id 标记标签服务
</summary> </summary>
</member> </member>
<member name="T:Cis.Application.Cm.CmMarkGroupService"> <member name="P:Cis.Application.Core.MarkSearcherBase._cameraCalcInfo">
<summary> <summary>
标记分组服务 当前相机参数信息
</summary> </summary>
</member> </member>
<member name="T:Cis.Application.Cm.CmMarkLabelService"> <member name="P:Cis.Application.Core.MarkSearcherBase.mliListLock">
<summary> <summary>
标记标签服务 _markLabelInfoList 锁对象,写锁
</summary> </summary>
</member> </member>
<member name="T:Cis.Application.Core.PtzInfo"> <member name="P:Cis.Application.Core.MarkSearcherBase._markLabelInfoDict">
<summary> <summary>
Ptz 信息 需要计算的 markLabelInfo 列表
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Core.PtzInfo.Pan"> <member name="P:Cis.Application.Core.MarkSearcherBase.World2CameraMatrix">
<summary> <summary>
Pan 世界坐标转化为相机坐标矩阵
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Core.PtzInfo.Tilt"> <member name="M:Cis.Application.Core.MarkSearcherBase.Calc">
<summary> <summary>
Tilt 计算标签位置过程
</summary> </summary>
<returns></returns>
</member> </member>
<member name="P:Cis.Application.Core.PtzInfo.Zoom"> <member name="M:Cis.Application.Core.MarkSearcherBase.IsCameraRotate(Cis.Application.Core.PtzInfo)">
<summary>
判断相机是否进行了转动,转动了则需要重新计算世界坐标到相机坐标的转换矩阵
</summary>
<param name="newInfo"></param>
<returns></returns>
</member>
<member name="M:Cis.Application.Core.MarkSearcherBase.ConvertWorldToCamera(Cis.Application.Core.CameraCalcInfo)">
<summary>
获取将世界坐标系中的点转化为相机坐标系中的点的转换矩阵
</summary>
<param name="cameraCalcInfo"></param>
<returns></returns>
</member>
<member name="M:Cis.Application.Core.MarkSearcherBase.ConvertCameraToWorld(Cis.Application.Core.MarkLabelCalcInfo)">
<summary>
获取将相机坐标系中的点转化为世界坐标系中的点的转换矩阵
</summary>
<param name="labelCalcInfo"></param>
<returns></returns>
</member>
<member name="M:Cis.Application.Core.MarkSearcherBase.CalcSensor">
<summary>
此方法计算在球机zoom值最小的情况下成像矩阵中的 f 本质为获取像元大小
尝试方案1:通过计算的方式来获取
尝试方案2:通过张友定相机标定的方法来生成成像矩阵中的 f
</summary>
</member>
<member name="M:Cis.Application.Core.MarkSearcherBase.ConvertPanPosToAngle(System.Double)">
<summary>
将Pan值转化为角度
</summary>
<returns></returns>
</member>
<member name="M:Cis.Application.Core.MarkSearcherBase.ConvertTiltPosToAngle(System.Double,System.Double)">
<summary>
将Tilt转化为角度
</summary>
<returns></returns>
</member>
<member name="M:Cis.Application.Core.MarkSearcherBase.GetFOfMatrixByZoomPos(System.Double)">
<summary> <summary>
Zoom 根据当前zoom值获取相机矩阵参数
</summary> </summary>
<param name="zoomPos"></param>
<returns></returns>
</member> </member>
<member name="T:Cis.Application.Core.IPtzApi"> <member name="T:Cis.Application.Core.IPtzApi">
<summary> <summary>
@ -209,6 +262,65 @@
Ptz Api Ptz Api
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Core.CameraDataCenter._cbCameraId2IpDict">
<summary>
(cbCameraId, cbCameraIp)
</summary>
</member>
<member name="P:Cis.Application.Core.CameraDataCenter._tbPtzCameraDict">
<summary>
(cameraIp, TbPtzCamera)
</summary>
</member>
<member name="P:Cis.Application.Core.CameraDataCenter._cameraPtzInfoDict">
<summary>
(cameraIp, PtzInfo)
</summary>
</member>
<member name="P:Cis.Application.Core.CameraDataCenter.msDictLock">
<summary>
_markSearcherDict 锁对象,写锁
</summary>
</member>
<member name="P:Cis.Application.Core.CameraDataCenter._markSearcherDict">
<summary>
(cbCameraId, MarkSearcherBase)
</summary>
</member>
<member name="P:Cis.Application.Core.CameraDataCenter._markLabelCalcResultListDict">
<summary>
(cameraId, List(MarkLabelCalcResult))
</summary>
</member>
<member name="M:Cis.Application.Core.CameraDataCenter.WorkLoop">
<summary>
循环运行
</summary>
</member>
<member name="M:Cis.Application.Core.CameraDataCenter.ActiveCamera(System.Int64)">
<summary>
激活 cbCamera 进入运算
</summary>
<param name="cameraId"></param>
<returns></returns>
</member>
<member name="M:Cis.Application.Core.CameraDataCenter.DeActiveCamera(System.Int64)">
<summary>
解除 cbCamera 进入运算
</summary>
<param name="cameraId"></param>
<returns></returns>
</member>
<member name="P:Cis.Application.Core.CameraDataOptions.LazyInit">
<summary>
是否懒加载
</summary>
</member>
<member name="P:Cis.Application.Core.CameraDataOptions.LoopInterval">
<summary>
循环间隔,单位毫秒
</summary>
</member>
<member name="T:Cis.Application.Core.PtzServerOptions"> <member name="T:Cis.Application.Core.PtzServerOptions">
<summary> <summary>
PtzServer选项 PtzServer选项
@ -229,6 +341,117 @@
服务端口 服务端口
</summary> </summary>
</member> </member>
<member name="T:Cis.Application.Core.CameraCalcInfo">
<summary>
相机计算信息
</summary>
</member>
<member name="P:Cis.Application.Core.CameraCalcInfo.Id">
<summary>
Camera Id
</summary>
</member>
<member name="P:Cis.Application.Core.CameraCalcInfo.PtzInfo">
<summary>
Ptz 信息
</summary>
</member>
<member name="P:Cis.Application.Core.CameraCalcInfo.ImageWidth">
<summary>
图像的宽度
</summary>
</member>
<member name="P:Cis.Application.Core.CameraCalcInfo.ImageHeight">
<summary>
图像的高度
</summary>
</member>
<member name="P:Cis.Application.Core.CameraCalcInfo.MinFocusX">
<summary>
最小焦距
</summary>
</member>
<member name="T:Cis.Application.Core.PtzInfo">
<summary>
Ptz 信息
</summary>
</member>
<member name="P:Cis.Application.Core.PtzInfo.Pan">
<summary>
Pan 坐标
</summary>
</member>
<member name="P:Cis.Application.Core.PtzInfo.Tilt">
<summary>
Tilt 坐标
</summary>
</member>
<member name="P:Cis.Application.Core.PtzInfo.Zoom">
<summary>
Zoom 坐标
</summary>
</member>
<member name="T:Cis.Application.Core.MarkLabelCalcInfo">
<summary>
标记标签计算信息
</summary>
</member>
<member name="P:Cis.Application.Core.MarkLabelCalcInfo.Id">
<summary>
MarkLabel Id
</summary>
</member>
<member name="P:Cis.Application.Core.MarkLabelCalcInfo.PtzInfo">
<summary>
Ptz 信息
</summary>
</member>
<member name="P:Cis.Application.Core.MarkLabelCalcInfo.CanvasWidth">
<summary>
画布宽度
</summary>
</member>
<member name="P:Cis.Application.Core.MarkLabelCalcInfo.CanvasHeight">
<summary>
画布高度
</summary>
</member>
<member name="P:Cis.Application.Core.MarkLabelCalcInfo.CanvasLeft">
<summary>
画布 left 距离
</summary>
</member>
<member name="P:Cis.Application.Core.MarkLabelCalcInfo.CanvasTop">
<summary>
画布 top 距离
</summary>
</member>
<member name="T:Cis.Application.Core.MarkLabelCalcResult">
<summary>
标记标签计算结果
</summary>
</member>
<member name="P:Cis.Application.Core.MarkLabelCalcResult.Id">
<summary>
MarkLabel Id
</summary>
</member>
<member name="P:Cis.Application.Core.MarkLabelCalcResult.InFlag">
<summary>
true 显示(在当前视频画面里面)
false 不显示(不在当前视频画面里面)
</summary>
</member>
<member name="P:Cis.Application.Core.MarkLabelCalcResult.CanvasLeft">
<summary>
画布 left 距离
</summary>
</member>
<member name="P:Cis.Application.Core.MarkLabelCalcResult.CanvasTop">
<summary>
画布 top 距离
</summary>
</member>
<member name="M:Cis.Application.Startup.ConfigureServices(Microsoft.Extensions.DependencyInjection.IServiceCollection)"> <member name="M:Cis.Application.Startup.ConfigureServices(Microsoft.Extensions.DependencyInjection.IServiceCollection)">
<summary> <summary>
配置应用所需服务,在该方法中可以添加应用所需要的功能或服务 配置应用所需服务,在该方法中可以添加应用所需要的功能或服务

36
Cis.Application/Cm/Service/CmMarkGroupService.cs

@ -15,12 +15,32 @@ public class CmMarkGroupService : IDynamicApiController, ITransient
_cmMarkGroupRep = cmMarkGroupRep; _cmMarkGroupRep = cmMarkGroupRep;
} }
[HttpPost]
public async Task Add(CmMarkGroup entity)
{
await _cmMarkGroupRep.InsertAsync(entity);
}
[HttpPost]
public async Task Update(CmMarkGroup entity)
{
await _cmMarkGroupRep.UpdateAsync(entity);
}
[HttpPost]
public async Task Delete(CmMarkGroup entity)
{
await _cmMarkGroupRep.DeleteAsync(entity);
}
[HttpGet]
public async Task<CmMarkGroup> Get(long id) public async Task<CmMarkGroup> Get(long id)
{ {
CmMarkGroup entity = await _cmMarkGroupRep.GetByIdAsync(id); CmMarkGroup entity = await _cmMarkGroupRep.GetByIdAsync(id);
return entity; return entity;
} }
[HttpGet]
public async Task<List<CmMarkGroup>> GetList(string queryJson) public async Task<List<CmMarkGroup>> GetList(string queryJson)
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
@ -29,6 +49,7 @@ public class CmMarkGroupService : IDynamicApiController, ITransient
return list; return list;
} }
[HttpGet]
public async Task<List<CmMarkGroup>> GetPageList(string queryJson, string pagination) public async Task<List<CmMarkGroup>> GetPageList(string queryJson, string pagination)
{ {
Pagination pageObj = pagination.ToObject<Pagination>(); Pagination pageObj = pagination.ToObject<Pagination>();
@ -37,19 +58,4 @@ public class CmMarkGroupService : IDynamicApiController, ITransient
.ToPageListAsync(pageObj.Index, pageObj.Size); .ToPageListAsync(pageObj.Index, pageObj.Size);
return list; return list;
} }
public async Task Add(CmMarkGroup entity)
{
await _cmMarkGroupRep.InsertAsync(entity);
}
public async Task Update(CmMarkGroup entity)
{
await _cmMarkGroupRep.UpdateAsync(entity);
}
public async Task Delete(CmMarkGroup entity)
{
await _cmMarkGroupRep.DeleteAsync(entity);
}
} }

35
Cis.Application/Cm/Service/CmMarkLabelService.cs

@ -15,12 +15,32 @@ public class CmMarkLabelService : IDynamicApiController, ITransient
_cmMarkLabelRep = cmMarkLabelRep; _cmMarkLabelRep = cmMarkLabelRep;
} }
[HttpPost]
public async Task Add(CmMarkLabel entity)
{
await _cmMarkLabelRep.InsertAsync(entity);
}
[HttpPost]
public async Task Update(CmMarkLabel entity)
{
await _cmMarkLabelRep.UpdateAsync(entity);
}
[HttpPost]
public async Task Delete(CmMarkLabel entity)
{
await _cmMarkLabelRep.DeleteAsync(entity);
}
[HttpGet]
public async Task<CmMarkLabel> Get(long id) public async Task<CmMarkLabel> Get(long id)
{ {
CmMarkLabel entity = await _cmMarkLabelRep.GetByIdAsync(id); CmMarkLabel entity = await _cmMarkLabelRep.GetByIdAsync(id);
return entity; return entity;
} }
[HttpGet]
public async Task<List<CmMarkLabel>> GetList(string queryJson = "") public async Task<List<CmMarkLabel>> GetList(string queryJson = "")
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
@ -29,6 +49,7 @@ public class CmMarkLabelService : IDynamicApiController, ITransient
return list; return list;
} }
[HttpGet]
public async Task<List<CmMarkLabel>> GetPageList(string queryJson, string pagination) public async Task<List<CmMarkLabel>> GetPageList(string queryJson, string pagination)
{ {
Pagination pageObj = pagination.ToObject<Pagination>(); Pagination pageObj = pagination.ToObject<Pagination>();
@ -38,18 +59,4 @@ public class CmMarkLabelService : IDynamicApiController, ITransient
return list; return list;
} }
public async Task Add(CmMarkLabel entity)
{
await _cmMarkLabelRep.InsertAsync(entity);
}
public async Task Update(CmMarkLabel entity)
{
await _cmMarkLabelRep.UpdateAsync(entity);
}
public async Task Delete(CmMarkLabel entity)
{
await _cmMarkLabelRep.DeleteAsync(entity);
}
} }

5
Cis.Application/Core/Service/MarkSearchService.cs

@ -16,26 +16,31 @@ public class MarkSearchService : IDynamicApiController, ITransient
_cameraDataCenter = cameraDataCenter; _cameraDataCenter = cameraDataCenter;
} }
[HttpPost]
public async Task<bool> ActivateCamera(long cameraId) public async Task<bool> ActivateCamera(long cameraId)
{ {
return await _cameraDataCenter.ActiveCameraAsync(cameraId); return await _cameraDataCenter.ActiveCameraAsync(cameraId);
} }
[HttpPost]
public async Task<bool> DeActiveCamera(long cameraId) public async Task<bool> DeActiveCamera(long cameraId)
{ {
return await _cameraDataCenter.DeActiveCameraAsync(cameraId); return await _cameraDataCenter.DeActiveCameraAsync(cameraId);
} }
[HttpPost]
public async Task<bool> AddCameraMarkLabel(long cameraId, long markLabelId) public async Task<bool> AddCameraMarkLabel(long cameraId, long markLabelId)
{ {
return await _cameraDataCenter.AddCameraMarkLabelAsync(cameraId, markLabelId); return await _cameraDataCenter.AddCameraMarkLabelAsync(cameraId, markLabelId);
} }
[HttpPost]
public async Task<bool> DeleteCameraMarkLabel(long cameraId, long markLabelId) public async Task<bool> DeleteCameraMarkLabel(long cameraId, long markLabelId)
{ {
return await _cameraDataCenter.DeleteCameraMarkLabelAsync(cameraId, markLabelId); return await _cameraDataCenter.DeleteCameraMarkLabelAsync(cameraId, markLabelId);
} }
[HttpGet]
public async Task<List<MarkLabelCalcResult>> GetMarkLabelCalcResultList(long cameraId) public async Task<List<MarkLabelCalcResult>> GetMarkLabelCalcResultList(long cameraId)
{ {
return await _cameraDataCenter.GetMarkLabelCalcResultListAsync(cameraId); return await _cameraDataCenter.GetMarkLabelCalcResultListAsync(cameraId);

36
Cis.Application/Sys/Service/SysDictDataService.cs

@ -15,12 +15,32 @@ public class SysDictDataService : IDynamicApiController, ITransient
_sysDictDataRep = sysDictDataRep; _sysDictDataRep = sysDictDataRep;
} }
[HttpPost]
public async Task Add(SysDictData entity)
{
await _sysDictDataRep.InsertAsync(entity);
}
[HttpPost]
public async Task Update(SysDictData entity)
{
await _sysDictDataRep.UpdateAsync(entity);
}
[HttpPost]
public async Task Delete(SysDictData entity)
{
await _sysDictDataRep.DeleteAsync(entity);
}
[HttpGet]
public async Task<SysDictData> Get(long id) public async Task<SysDictData> Get(long id)
{ {
SysDictData entity = await _sysDictDataRep.GetByIdAsync(id); SysDictData entity = await _sysDictDataRep.GetByIdAsync(id);
return entity; return entity;
} }
[HttpGet]
public async Task<List<SysDictData>> GetList(string queryJson) public async Task<List<SysDictData>> GetList(string queryJson)
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
@ -29,6 +49,7 @@ public class SysDictDataService : IDynamicApiController, ITransient
return list; return list;
} }
[HttpGet]
public async Task<List<SysDictData>> GetPageList(string queryJson, string pagination) public async Task<List<SysDictData>> GetPageList(string queryJson, string pagination)
{ {
Pagination pageObj = pagination.ToObject<Pagination>(); Pagination pageObj = pagination.ToObject<Pagination>();
@ -37,19 +58,4 @@ public class SysDictDataService : IDynamicApiController, ITransient
.ToPageListAsync(pageObj.Index, pageObj.Size); .ToPageListAsync(pageObj.Index, pageObj.Size);
return list; return list;
} }
public async Task Add(SysDictData entity)
{
await _sysDictDataRep.InsertAsync(entity);
}
public async Task Update(SysDictData entity)
{
await _sysDictDataRep.UpdateAsync(entity);
}
public async Task Delete(SysDictData entity)
{
await _sysDictDataRep.DeleteAsync(entity);
}
} }

35
Cis.Application/Sys/Service/SysDictTypeService.cs

@ -16,12 +16,32 @@ public class SysDictTypeService : IDynamicApiController, ITransient
_sysDictTypeRep = sysDictTypeRep; _sysDictTypeRep = sysDictTypeRep;
} }
[HttpPost]
public async Task Add(SysDictType entity)
{
await _sysDictTypeRep.InsertAsync(entity);
}
[HttpPost]
public async Task Update(SysDictType entity)
{
await _sysDictTypeRep.UpdateAsync(entity);
}
[HttpPost]
public async Task Delete(SysDictType entity)
{
await _sysDictTypeRep.DeleteAsync(entity);
}
[HttpGet]
public async Task<SysDictType> Get(long id) public async Task<SysDictType> Get(long id)
{ {
SysDictType entity = await _sysDictTypeRep.GetByIdAsync(id); SysDictType entity = await _sysDictTypeRep.GetByIdAsync(id);
return entity; return entity;
} }
[HttpGet]
public async Task<List<SysDictType>> GetList(string queryJson) public async Task<List<SysDictType>> GetList(string queryJson)
{ {
JObject queryObj = queryJson.ToJObject(); JObject queryObj = queryJson.ToJObject();
@ -30,6 +50,7 @@ public class SysDictTypeService : IDynamicApiController, ITransient
return list; return list;
} }
[HttpGet]
public async Task<List<SysDictType>> GetPageList(string queryJson, string pagination) public async Task<List<SysDictType>> GetPageList(string queryJson, string pagination)
{ {
Pagination pageObj = pagination.ToObject<Pagination>(); Pagination pageObj = pagination.ToObject<Pagination>();
@ -39,18 +60,4 @@ public class SysDictTypeService : IDynamicApiController, ITransient
return list; return list;
} }
public async Task Add(SysDictType entity)
{
await _sysDictTypeRep.InsertAsync(entity);
}
public async Task Update(SysDictType entity)
{
await _sysDictTypeRep.UpdateAsync(entity);
}
public async Task Delete(SysDictType entity)
{
await _sysDictTypeRep.DeleteAsync(entity);
}
} }

36
Cis.Application/Tb/Service/TbPtzCameraService.cs

@ -11,12 +11,32 @@ public class TbPtzCameraService : ITransient
_tbPtzCameraRep = tbPtzCameraRep; _tbPtzCameraRep = tbPtzCameraRep;
} }
[HttpPost]
public async Task Add(TbPtzCamera entity)
{
await _tbPtzCameraRep.InsertAsync(entity);
}
[HttpPost]
public async Task Update(TbPtzCamera entity)
{
await _tbPtzCameraRep.UpdateAsync(entity);
}
[HttpPost]
public async Task Delete(TbPtzCamera entity)
{
await _tbPtzCameraRep.DeleteAsync(entity);
}
[HttpGet]
public async Task<TbPtzCamera> Get(int id) public async Task<TbPtzCamera> Get(int id)
{ {
TbPtzCamera entity = await _tbPtzCameraRep.GetByIdAsync(id); TbPtzCamera entity = await _tbPtzCameraRep.GetByIdAsync(id);
return entity; return entity;
} }
[HttpGet]
public async Task<List<TbPtzCamera>> GetList(string queryJson = "") public async Task<List<TbPtzCamera>> GetList(string queryJson = "")
{ {
JObject queryObj = !string.IsNullOrEmpty(queryJson) ? queryJson.ToJObject() : default; JObject queryObj = !string.IsNullOrEmpty(queryJson) ? queryJson.ToJObject() : default;
@ -25,6 +45,7 @@ public class TbPtzCameraService : ITransient
return list; return list;
} }
[HttpGet]
public async Task<List<TbPtzCamera>> GetPageList(string pagination, string queryJson = "") public async Task<List<TbPtzCamera>> GetPageList(string pagination, string queryJson = "")
{ {
Pagination pageObj = pagination.ToObject<Pagination>(); Pagination pageObj = pagination.ToObject<Pagination>();
@ -33,19 +54,4 @@ public class TbPtzCameraService : ITransient
.ToPageListAsync(pageObj.Index, pageObj.Size); .ToPageListAsync(pageObj.Index, pageObj.Size);
return list; return list;
} }
public async Task Add(TbPtzCamera entity)
{
await _tbPtzCameraRep.InsertAsync(entity);
}
public async Task Update(TbPtzCamera entity)
{
await _tbPtzCameraRep.UpdateAsync(entity);
}
public async Task Delete(TbPtzCamera entity)
{
await _tbPtzCameraRep.DeleteAsync(entity);
}
} }

3
Cis.Core/CoreConfig.json

@ -67,8 +67,7 @@
"CorsAccessorSettings": { "CorsAccessorSettings": {
"WithExposedHeaders": [ "WithExposedHeaders": [
"access-token", "access-token",
"x-access-token", "x-access-token"
"environment"
] ]
} }
} }

2
Cis.Core/Extension/ObjectExtension.cs

@ -125,7 +125,7 @@ public static class ObjectExtension
/// <returns></returns> /// <returns></returns>
public static JObject ToJObject(this string Json) public static JObject ToJObject(this string Json)
{ {
return Json == null ? JObject.Parse("{}") : JObject.Parse(Json.Replace("&nbsp;", "")); return string.IsNullOrEmpty(Json) ? JObject.Parse("{}") : JObject.Parse(Json.Replace("&nbsp;", ""));
} }
/// <summary> /// <summary>

14
Cis.Web.Core/Startup.cs

@ -32,6 +32,19 @@ public class Startup : AppStartup
services.AddJwt<JwtHandler>(); services.AddJwt<JwtHandler>();
// 允许跨域 // 允许跨域
services.AddCorsAccessor(); services.AddCorsAccessor();
// 添加 https 跨域时请执行以下方法(关键方法 SetIsOriginAllowed),发现 http 和 https 仅能存在一个 跨域
// 同时启用 http 和 https,猜测需要通过设置 WithOrigins
// 参考 https://furion.baiqian.ltd/docs/cors?_highlight=corsaccessorsettings#165-corsaccessorsettings-%E9%85%8D%E7%BD%AE
// 以及 http://www.manongjc.com/detail/26-gmogyzvnnewpkml.html
//services.AddCors(options =>
//{
// options.AddPolicy("CorsPolicy", opt => opt
// .SetIsOriginAllowed(_ => true)
// .AllowAnyHeader()
// .AllowAnyMethod()
// .AllowCredentials()
// );
//});
// 远程请求 // 远程请求
services.AddRemoteRequest(); services.AddRemoteRequest();
// 任务调度 // 任务调度
@ -100,6 +113,7 @@ public class Startup : AppStartup
app.UseRouting(); app.UseRouting();
app.UseCorsAccessor(); app.UseCorsAccessor();
//app.UseCors("CorsPolicy");
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();

23
Cis.Web.Entry/Properties/launchSettings.json

@ -1,12 +1,4 @@
{ {
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:58595",
"sslPort": 44326
}
},
"profiles": { "profiles": {
"IIS Express": { "IIS Express": {
"commandName": "IISExpress", "commandName": "IISExpress",
@ -17,12 +9,21 @@
}, },
"Cis.Web.Entry": { "Cis.Web.Entry": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true, "launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5000;http://*:5000;"
//"applicationUrl": "https://localhost:5001;https://*:5001;"
} }
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:58595",
"sslPort": 44326
} }
} }
} }
Loading…
Cancel
Save