[後台][水電報表] 後端部分判斷微調

This commit is contained in:
dev01 2023-05-15 12:49:15 +08:00
parent 61c0f90979
commit 67943d276b

View File

@ -166,7 +166,7 @@ namespace FrontendWebApi.ApiControllers
apiResult.Msg = "棟別沒有被選取"; apiResult.Msg = "棟別沒有被選取";
return BadRequest(apiResult); return BadRequest(apiResult);
} }
else if (input.tableType == null || tableType.Contains(input.tableType)) else if (input.tableType == null || !tableType.Contains(input.tableType))
{ {
apiResult.Code = "9999"; apiResult.Code = "9999";
apiResult.Msg = "表單類別錯誤"; apiResult.Msg = "表單類別錯誤";
@ -177,7 +177,7 @@ namespace FrontendWebApi.ApiControllers
{ {
var startTime = input.tableType == "day" || input.tableType == "week" var startTime = input.tableType == "day" || input.tableType == "week"
? input.startTime + "-01" ? input.startTime + "-01"
: input.tableType == "month" || input.tableType == "month" ? input.startTime + "-01-01" : input.tableType == "month" || input.tableType == "year" ? input.startTime + "-01-01"
: null; : null;
var endTime = input.tableType == "day" || input.tableType == "week" 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.startTime.Split("-")[0] + "-" + (Int32.Parse(input.startTime.Split("-")[1]) + 1).ToString().PadLeft(2, '0') + "-01"