From 9202b7edf81ea14201a0d9a3b065e5101a745d15 Mon Sep 17 00:00:00 2001 From: dev02 Date: Mon, 25 Dec 2023 09:23:45 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=99=82=E9=96=93=E8=AE=8A=E6=9B=B4=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/HydroMeterController.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/FrontendWebApi/ApiControllers/HydroMeterController.cs b/FrontendWebApi/ApiControllers/HydroMeterController.cs index f87c8f9..b9d840d 100644 --- a/FrontendWebApi/ApiControllers/HydroMeterController.cs +++ b/FrontendWebApi/ApiControllers/HydroMeterController.cs @@ -67,11 +67,7 @@ namespace FrontendWebApi.ApiControllers ? input.startTime + "-01" : input.tableType == "month" || input.tableType == "year" ? input.startTime + "-01-01" : null; - var endTime = input.tableType == "day" || input.tableType == "week" - ? input.startTime.Split("-")[0] + "-" + (Int32.Parse(input.startTime.Split("-")[1]) + 1).ToString().PadLeft(2, '0') + "-01" - : input.tableType == "month" ? (Int32.Parse(input.startTime.Split("-")[0]) + 1) + "-01-01" - : input.tableType == "year" ? (Int32.Parse(input.endTime) + 1).ToString() + "-01-01" - : null; + var endTime = DateTime.Parse(startTime).AddMonths(1).ToString("yyyy-MM-dd"); string sqlWhere = ""; string sqlGroup = ""; string sqlAvgRawData = ""; @@ -239,11 +235,7 @@ namespace FrontendWebApi.ApiControllers ? input.startTime + "-01" : input.tableType == "month" || input.tableType == "year" ? input.startTime + "-01-01" : null; - var endTime = input.tableType == "day" || input.tableType == "week" - ? input.startTime.Split("-")[0] + "-" + (Int32.Parse(input.startTime.Split("-")[1]) + 1).ToString().PadLeft(2, '0') + "-01" - : input.tableType == "month" ? (Int32.Parse(input.startTime.Split("-")[0]) + 1) + "-01-01" - : input.tableType == "year" ? (Int32.Parse(input.endTime) + 1).ToString() + "-01-01" - : null; + var endTime = DateTime.Parse(startTime).AddMonths(1).ToString("yyyy-MM-dd"); string sqlWhere = ""; string sqlGroup = ""; string sqlAvgRawData = "";