From 54c03916a88894167b0be1b1635aeeef55fe9666 Mon Sep 17 00:00:00 2001 From: pangwenpeng <17302161021@163.com> Date: Wed, 24 Jul 2024 17:58:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E6=97=B6=E9=97=B4=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E5=92=8C=E5=8F=96=E6=9C=80=E8=BF=9130=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- langguanApi/Service/WasherService.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/langguanApi/Service/WasherService.cs b/langguanApi/Service/WasherService.cs index 7cc8907..3bfb6fd 100644 --- a/langguanApi/Service/WasherService.cs +++ b/langguanApi/Service/WasherService.cs @@ -66,6 +66,18 @@ namespace langguanApi.Service entity.StateString=item.State==0?"停止":"运行"; washerHistroyResult.Add(entity); } + if (!string.IsNullOrWhiteSpace(input.startTime)) + { + washerHistroyResult = washerHistroyResult.Where(p => Convert.ToDateTime(p.Time) >= Convert.ToDateTime(input.startTime)).ToList(); + } + if (!string.IsNullOrWhiteSpace(input.endTime)) + { + washerHistroyResult = washerHistroyResult.Where(p => Convert.ToDateTime(p.Time) <= Convert.ToDateTime(input.endTime)).ToList(); + } + if (washerHistroyResult.Any()) + { + washerHistroyResult = washerHistroyResult.OrderByDescending(p => p.Time).Take(30).ToList(); + } return washerHistroyResult; } }