From 2434aa96ff73e3d157186add3dba13914efb6e37 Mon Sep 17 00:00:00 2001 From: yanghongwei Date: Mon, 1 Jul 2024 21:18:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=95=B0=E6=8D=AE=E6=8B=BC?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- langguanApi.xml | 5 +++++ langguanApi/Controllers/HJ212Controller.cs | 5 ++++- langguanApi/Service/AlertService.cs | 12 ++++++------ langguanApi/Service/HomeService.cs | 6 +++++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/langguanApi.xml b/langguanApi.xml index 47f306b..e9c28e8 100644 --- a/langguanApi.xml +++ b/langguanApi.xml @@ -1716,6 +1716,11 @@ 注册日期 + + + 货物类型 + + 新加 diff --git a/langguanApi/Controllers/HJ212Controller.cs b/langguanApi/Controllers/HJ212Controller.cs index 316db85..cec687b 100644 --- a/langguanApi/Controllers/HJ212Controller.cs +++ b/langguanApi/Controllers/HJ212Controller.cs @@ -9,7 +9,10 @@ namespace langguanApi.Controllers public class HJ212Controller : ControllerBase { private readonly Hj212Service _hj212Service; - + /// + /// 构造函数 + /// + /// public HJ212Controller(Hj212Service hj212Service) { _hj212Service = hj212Service; diff --git a/langguanApi/Service/AlertService.cs b/langguanApi/Service/AlertService.cs index 2d11ab8..59c88a9 100644 --- a/langguanApi/Service/AlertService.cs +++ b/langguanApi/Service/AlertService.cs @@ -38,17 +38,17 @@ namespace langguanApi.Service /// 首页数据,最近7天的 /// /// - public async Task IndexData(int num = 50) + public async Task> IndexData(int num = 50) { Expression> exp = filter => filter.IsDelete == false; return (await base.GetListWithExp(exp)) .OrderByDescending(s => s.CreateDateTime) .Take(num) - .Select(s => new + .Select(s => new alarm { - s.AlertContent, - s.deviceName, - s.CreateDateTime + AlarmName = s.deviceName, + DeviceName = s.deviceName, + Time = s.CreateDateTime.ToString("yyyy-MM-dd HH:mm:ss"), }).ToList(); } /// @@ -66,7 +66,7 @@ namespace langguanApi.Service Dictionary dic = new Dictionary() { }; dic.Add("BeginTime", start.Value.ToString("yyyy-MM-dd HH:mm:ss")); dic.Add("EndTime", end.Value.ToString("yyyy-MM-dd HH:mm:ss")); - var AlermResp = await _httpProxy.Get>(dic,_configuration.GetValue("Apis:AlertUrl")); + var AlermResp = await _httpProxy.Get>(dic, _configuration.GetValue("Apis:AlertUrl")); if (AlermResp.code == 0) { var romte = AlermResp.data.List.Select(s => new Alert diff --git a/langguanApi/Service/HomeService.cs b/langguanApi/Service/HomeService.cs index bd254f2..669e058 100644 --- a/langguanApi/Service/HomeService.cs +++ b/langguanApi/Service/HomeService.cs @@ -71,6 +71,10 @@ namespace langguanApi.Service var rateResp = await _httpProxy.Get>>(null, _configuration.GetValue("Apis:RateUrl")); var rate = rateResp.data.ToList().Take(6); var AlermResp = await _httpProxy.Get>(null, _configuration.GetValue("Apis:AlertUrl")); + if (AlermResp.code == 0 && AlermResp.data.List.Any()) + { + alerts.AddRange(AlermResp.data.List); + } // alerts += await _httpProxy.Get(null, _configuration.GetValue("Apis:AlertUrl")); // alerts += await _httpProxy.Get(null, _configuration.GetValue("Apis:RateUrl")); @@ -103,7 +107,7 @@ namespace langguanApi.Service ariQuality, rate, trend, - alerts= AlermResp.data.List, + alerts, cleanData, today, getViewTop = "",