diff --git a/FrontendWebApi/ApiControllers/TenantBillController.cs b/FrontendWebApi/ApiControllers/TenantBillController.cs index b78f3a8..d2a85d8 100644 --- a/FrontendWebApi/ApiControllers/TenantBillController.cs +++ b/FrontendWebApi/ApiControllers/TenantBillController.cs @@ -109,6 +109,7 @@ namespace FrontendWebApi.ApiControllers apiResult.Msg = "新增用戶失敗。"; if (exception.Message.Contains($" for key 'PRIMARY'")) { + apiResult.Code = "0001"; apiResult.Msg = "已有相同使用者。"; } Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); @@ -143,6 +144,7 @@ namespace FrontendWebApi.ApiControllers apiResult.Msg = "修改失敗。"; if (exception.Message.Contains($"a foreign key constraint")) { + apiResult.Code = "0001"; apiResult.Msg = "水電報表仍有該用戶,無法修改名稱。"; } Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); @@ -170,6 +172,7 @@ namespace FrontendWebApi.ApiControllers apiResult.Msg = "刪除用戶失敗。"; if (exception.Message.Contains($"a foreign key constraint")) { + apiResult.Code = "0001"; apiResult.Msg = "水電報表仍有該用戶,無法刪除。"; } Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); @@ -250,13 +253,13 @@ namespace FrontendWebApi.ApiControllers } if (start_timestamp == "") { - apiResult.Code = "9999"; + apiResult.Code = "0001"; apiResult.Msg = "請選擇起始日期。"; return apiResult; } if (end_timestamp == "") { - apiResult.Code = "9999"; + apiResult.Code = "0001"; apiResult.Msg = "請選擇結束日期。"; return apiResult; } @@ -300,7 +303,7 @@ namespace FrontendWebApi.ApiControllers // $"updated_at = '{updated_at}', " + // $"tenant_guid = '{tb.tenant_guid}' " + // $"WHERE device_number = '{tb.device_number}'"; - apiResult.Code = "9999"; + apiResult.Code = "0001"; apiResult.Msg = "請選擇同一個月份"; return apiResult; }