diff --git a/docs/研发/v1.0任务分解.xlsx b/docs/研发/v1.0任务分解.xlsx index 8700cac1..205a0d81 100644 Binary files a/docs/研发/v1.0任务分解.xlsx and b/docs/研发/v1.0任务分解.xlsx differ diff --git a/projects/IoT.Shared/Application/Domain/Entities/LiveRecord.cs b/projects/IoT.Shared/Application/Domain/Entities/LiveRecord.cs index d857fca5..6cb21815 100644 --- a/projects/IoT.Shared/Application/Domain/Entities/LiveRecord.cs +++ b/projects/IoT.Shared/Application/Domain/Entities/LiveRecord.cs @@ -7,6 +7,7 @@ namespace Application.Domain.Entities public class LiveRecord : BaseEntity { public string DeviceNumber { get; set; } + public string DeviceName { get; set; } public string Name { get; set; } public string Value { get; set; } } diff --git a/projects/IoT.Shared/Application/Models/EditLiveRecordModel.cs b/projects/IoT.Shared/Application/Models/EditLiveRecordModel.cs new file mode 100644 index 00000000..5e9f415f --- /dev/null +++ b/projects/IoT.Shared/Application/Models/EditLiveRecordModel.cs @@ -0,0 +1,25 @@ +using Infrastructure.Application; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace Application.Models +{ + [Display(Name = "回放")] + public class EditLiveRecordModel : EditModel + { + [Display(Name = "设备编号")] + [ReadOnly(true)] + public string DeviceNumber { get; set; } + + [Display(Name = "设备名称")] + [ReadOnly(true)] + public string DeviceName { get; set; } + + [Display(Name = "名称")] + public string Name { get; set; } + + [Display(Name = "文件")] + [ReadOnly(true)] + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/projects/IoT.Shared/Application/Models/ApiSearchModel.cs b/projects/IoT.Shared/Application/Models/SearchApiModel.cs similarity index 83% rename from projects/IoT.Shared/Application/Models/ApiSearchModel.cs rename to projects/IoT.Shared/Application/Models/SearchApiModel.cs index 8aa0ecd8..b9db5161 100644 --- a/projects/IoT.Shared/Application/Models/ApiSearchModel.cs +++ b/projects/IoT.Shared/Application/Models/SearchApiModel.cs @@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations; namespace Application.Models { - public class ApiSearchModel : PagedListModel + public class SearchApiModel : PagedListModel { [DataType("SelectList")] [Display(Name = "产品")] diff --git a/projects/IoT.Shared/Application/Models/DataSearchModel.cs b/projects/IoT.Shared/Application/Models/SearchDataModel.cs similarity index 87% rename from projects/IoT.Shared/Application/Models/DataSearchModel.cs rename to projects/IoT.Shared/Application/Models/SearchDataModel.cs index 39958006..31368c34 100644 --- a/projects/IoT.Shared/Application/Models/DataSearchModel.cs +++ b/projects/IoT.Shared/Application/Models/SearchDataModel.cs @@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations; namespace Application.Models { - public class DataSearchModel : PagedListModel + public class SearchDataModel : PagedListModel { [DataType("SelectList")] [Display(Name = "节点")] diff --git a/projects/IoT.Shared/Application/Models/DeviceSearchMode.cs b/projects/IoT.Shared/Application/Models/SearchDeviceMode.cs similarity index 89% rename from projects/IoT.Shared/Application/Models/DeviceSearchMode.cs rename to projects/IoT.Shared/Application/Models/SearchDeviceMode.cs index 762dca90..7d043ddb 100644 --- a/projects/IoT.Shared/Application/Models/DeviceSearchMode.cs +++ b/projects/IoT.Shared/Application/Models/SearchDeviceMode.cs @@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations; namespace Application.Models { - public class DeviceSearchMode : PagedListModel + public class SearchDeviceMode : PagedListModel { [DataType("SelectList")] [Display(Name = "节点")] diff --git a/projects/IoT.Shared/Application/Models/SearchLiveRecordModel.cs b/projects/IoT.Shared/Application/Models/SearchLiveRecordModel.cs new file mode 100644 index 00000000..c7a7f616 --- /dev/null +++ b/projects/IoT.Shared/Application/Models/SearchLiveRecordModel.cs @@ -0,0 +1,15 @@ +using Infrastructure.Application; +using System.ComponentModel.DataAnnotations; + +namespace Application.Models +{ + public class SearchLiveRecordModel : PagedListModel + { + [DataType("SelectList")] + [Display(Name = "摄像头")] + public string DeviceNumber { get; set; } + + [Display(Name = "关键词")] + public string Keyword { get; set; } + } +} \ No newline at end of file diff --git a/projects/IoT.Shared/Areas/Admin/Controlls/AjaxController.cs b/projects/IoT.Shared/Areas/Admin/Controlls/AjaxController.cs index ddacc137..2276a0e1 100644 --- a/projects/IoT.Shared/Areas/Admin/Controlls/AjaxController.cs +++ b/projects/IoT.Shared/Areas/Admin/Controlls/AjaxController.cs @@ -252,6 +252,16 @@ namespace IoT.Shared.Areas.Admin.Controlls #endregion Api + public SelectList GetCameraSelectList(string deviceNumber) + { + var list = this._deviceRepo.ReadOnlyTable() + .Where(o => o.Product.Number == "onvifcamera") + .WhereIf(!string.IsNullOrEmpty(deviceNumber), o => o.Number == deviceNumber) + .Select(o => new { Id = o.Number, Name = o.DisplayName }) + .ToList(); + return new SelectList(list, "Id", "Name", deviceNumber); + } + public JsonResult CronValid(string cron) { try diff --git a/projects/IoT.Shared/Areas/Admin/Controlls/ApiController.cs b/projects/IoT.Shared/Areas/Admin/Controlls/ApiController.cs index 5fd36598..c6cb438d 100644 --- a/projects/IoT.Shared/Areas/Admin/Controlls/ApiController.cs +++ b/projects/IoT.Shared/Areas/Admin/Controlls/ApiController.cs @@ -12,7 +12,7 @@ namespace IoT.Shared.Areas.Admin.Controlls { [Authorize] [Area(nameof(Admin))] - public class ApiController : CrudController + public class ApiController : CrudController { private readonly AjaxController _ajax; @@ -26,7 +26,7 @@ namespace IoT.Shared.Areas.Admin.Controlls return query.Include(o => o.Product); } - public override IQueryable Query(ApiSearchModel model, IQueryable query) + public override IQueryable Query(SearchApiModel model, IQueryable query) { ViewData.SelectList(o => model.ProductId, () => this._ajax.GetProductSelectList(model.ProductId)); return query.WhereIf(model.ProductId.HasValue, o => o.ProductId == model.ProductId.Value) diff --git a/projects/IoT.Shared/Areas/Admin/Controlls/DataController.cs b/projects/IoT.Shared/Areas/Admin/Controlls/DataController.cs index a9d29b44..57f6b934 100644 --- a/projects/IoT.Shared/Areas/Admin/Controlls/DataController.cs +++ b/projects/IoT.Shared/Areas/Admin/Controlls/DataController.cs @@ -12,7 +12,7 @@ namespace IoT.Shared.Areas.Admin.Controlls { [Authorize] [Area(nameof(Admin))] - public class DataController : SharedController + public class DataController : SharedController { private readonly IRepository _nodeRepo; private readonly AjaxController _ajax; @@ -28,7 +28,7 @@ namespace IoT.Shared.Areas.Admin.Controlls return query.Include(o => o.Device).ThenInclude(o => o.Node); } - public override IQueryable Query(DataSearchModel model, IQueryable query) + public override IQueryable Query(SearchDataModel model, IQueryable query) { ViewData.SelectList(o => model.NodeId, () => this._ajax.GetNodeSelectList(model.NodeId)); ViewData.SelectList(o => model.DeviceId, () => this._ajax.GetDeviceSelectList(model.NodeId.Value, model.DeviceId), model.NodeId.HasValue); diff --git a/projects/IoT.Shared/Areas/Admin/Controlls/DeviceController.cs b/projects/IoT.Shared/Areas/Admin/Controlls/DeviceController.cs index d74695d1..80af9261 100644 --- a/projects/IoT.Shared/Areas/Admin/Controlls/DeviceController.cs +++ b/projects/IoT.Shared/Areas/Admin/Controlls/DeviceController.cs @@ -12,7 +12,7 @@ namespace IoT.Shared.Areas.Admin.Controlls { [Authorize] [Area(nameof(Admin))] - public class DeviceController : SharedController + public class DeviceController : SharedController { private readonly AjaxController _ajax; @@ -26,7 +26,7 @@ namespace IoT.Shared.Areas.Admin.Controlls return query.Include(o => o.Product).Include(o => o.Node); } - public override IQueryable Query(DeviceSearchMode model, IQueryable query) + public override IQueryable Query(SearchDeviceMode model, IQueryable query) { if (model == null) { diff --git a/projects/IoT.Shared/Areas/Admin/Controlls/LiveRecordController.cs b/projects/IoT.Shared/Areas/Admin/Controlls/LiveRecordController.cs new file mode 100644 index 00000000..8e4b6cd2 --- /dev/null +++ b/projects/IoT.Shared/Areas/Admin/Controlls/LiveRecordController.cs @@ -0,0 +1,32 @@ +using System.Linq; +using Application.Domain.Entities; +using Application.Models; +using Infrastructure.Application; +using Infrastructure.Data; +using Infrastructure.Extensions; +using Infrastructure.Web.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace IoT.Shared.Areas.Admin.Controlls +{ + [Authorize] + [Area(nameof(Admin))] + public class LiveRecordController : CrudController + { + private readonly AjaxController _ajax; + + public LiveRecordController(IRepository repo, AjaxController ajax) : base(repo) + { + this._ajax = ajax; + } + + public override IQueryable Query(SearchLiveRecordModel model, IQueryable query) + { + ViewData.SelectList(o => model.DeviceNumber, () => this._ajax.GetCameraSelectList(model.DeviceNumber)); + return query + .WhereIf(!string.IsNullOrEmpty(model.DeviceNumber), o => o.DeviceNumber == model.DeviceNumber) + .WhereIf(!string.IsNullOrEmpty(model.Keyword), o => o.DeviceName.Contains(model.Keyword) || o.Name.Contains(model.Keyword)); + } + } +} \ No newline at end of file diff --git a/projects/IoTCenter/Areas/Admin/Views/LiveRecord/Details.cshtml b/projects/IoTCenter/Areas/Admin/Views/LiveRecord/Details.cshtml new file mode 100644 index 00000000..28231515 --- /dev/null +++ b/projects/IoTCenter/Areas/Admin/Views/LiveRecord/Details.cshtml @@ -0,0 +1,20 @@ +@model EditLiveRecordModel +@{ + HtmlTitle = Model.Name; +} + +@section scripts{ + + +} \ No newline at end of file diff --git a/projects/IoTCenter/Areas/Admin/Views/Shared/_Menu.cshtml b/projects/IoTCenter/Areas/Admin/Views/Shared/_Menu.cshtml index 14a70153..de097001 100644 --- a/projects/IoTCenter/Areas/Admin/Views/Shared/_Menu.cshtml +++ b/projects/IoTCenter/Areas/Admin/Views/Shared/_Menu.cshtml @@ -24,6 +24,7 @@
  • 接口管理
  • 参数管理
  • 命令管理
  • +
  • 回放管理
  • 场景管理
  • 场景命令管理
  • 定时器管理
  • diff --git a/projects/IoTCenter/Controllers/AppController.cs b/projects/IoTCenter/Controllers/AppController.cs index 37ae3d67..94cc0a58 100644 --- a/projects/IoTCenter/Controllers/AppController.cs +++ b/projects/IoTCenter/Controllers/AppController.cs @@ -268,8 +268,9 @@ namespace IoTCenter.Controllers this._liveRecordRepo.Add(new LiveRecord { DeviceNumber = deviceNumber, - Name = $"{device?.DisplayName}回放{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}", - Value = $"video{result["file"].Substring(result["file"].LastIndexOf('/'))}" + DeviceName = device?.DisplayName, + Name = $"回放{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}", + Value = $"/video{result["file"].Substring(result["file"].LastIndexOf('/'))}" }); this._liveRecordRepo.SaveChanges(); } diff --git a/publish/src/linux-x64/publish/apps/srs/conf/srs.conf b/publish/src/linux-x64/publish/apps/srs/conf/srs.conf index c4af8cfb..e8e597f8 100644 --- a/publish/src/linux-x64/publish/apps/srs/conf/srs.conf +++ b/publish/src/linux-x64/publish/apps/srs/conf/srs.conf @@ -36,8 +36,8 @@ vhost __defaultVhost__ { dvr { enabled off; dvr_path ./objs/nginx/html/[app].[stream].[timestamp].flv; - dvr_plan session; - dvr_duration 30; + dvr_plan segment; + dvr_duration 600; dvr_wait_keyframe on; time_jitter full; }