From 6fa2f8edb802cfbe0ccaea6c7add39ec033be7e6 Mon Sep 17 00:00:00 2001 From: dev01 Date: Sat, 5 Nov 2022 18:18:29 +0800 Subject: [PATCH] =?UTF-8?q?[FrontedWebApi]=20API=20=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/BuildController.cs | 32 +++++++++++++++++++ .../ApiControllers/UserController.cs | 6 ++-- FrontendWebApi/Models/Build.cs | 2 +- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs index 9ad47f9..4739007 100644 --- a/FrontendWebApi/ApiControllers/BuildController.cs +++ b/FrontendWebApi/ApiControllers/BuildController.cs @@ -81,6 +81,38 @@ namespace FrontendWebApi.ApiControllers return Ok(apiResult); } + /// + /// 區域基本資料列表 + /// + /// + [HttpPost] + public async Task>> BuildInfoList() + { + ApiResult> apiResult = new ApiResult>(); + List buildInfo = new List(); + + try + { + var sqlString = @$"SELECT A.priority, A.building_tag, A.full_name, A.ip_address, A.ip_port, (SELECT COUNT(*) FROM floor f WHERE f.deleted = 0 AND f.building_tag = A.building_tag) AS 'floorNum', A.created_at, + A.orgName_3D, A.extName_3D + FROM building A + WHERE A.deleted = 0 + ORDER BY A.priority ASC, A.created_at DESC"; + buildInfo = await backendRepository.GetAllAsync(sqlString); + + apiResult.Code = "0000"; + apiResult.Data = buildInfo; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + /// /// 取得預設的棟別資訊 /// diff --git a/FrontendWebApi/ApiControllers/UserController.cs b/FrontendWebApi/ApiControllers/UserController.cs index 5b926c2..cdd2a14 100644 --- a/FrontendWebApi/ApiControllers/UserController.cs +++ b/FrontendWebApi/ApiControllers/UserController.cs @@ -188,7 +188,7 @@ namespace FrontendWebApi.ApiControllers { "@message_content", sendContent} }; - await backendRepository.AddOneByCustomTable(insertNotify, "background_service_message_notification_task"); + //await backendRepository.AddOneByCustomTable(insertNotify, "background_service_message_notification_task"); apiResult.Code = "0000"; apiResult.Msg = "儲存成功"; @@ -513,7 +513,7 @@ namespace FrontendWebApi.ApiControllers /// /// /// - public async Task>> GetRoleNotAuthPageList(PostRoleAuthFilter post) + public async Task>> GetRoleNotAuthPageList([FromBody] PostRoleAuthFilter post) { ApiResult> apiResult = new ApiResult>(); List authPage = new List(); @@ -558,7 +558,7 @@ namespace FrontendWebApi.ApiControllers /// /// [HttpPost] - public async Task> SaveRoleAuth(PostSaveRoleAuth post) + public async Task> SaveRoleAuth([FromBody] PostSaveRoleAuth post) { ApiResult apiResult = new ApiResult(); diff --git a/FrontendWebApi/Models/Build.cs b/FrontendWebApi/Models/Build.cs index 89e17af..4efb89b 100644 --- a/FrontendWebApi/Models/Build.cs +++ b/FrontendWebApi/Models/Build.cs @@ -221,7 +221,7 @@ namespace FrontendWebApi.Models public class BuildInfo : Actor { - public string Building_guid { get; set; } //區域GUID + public string Building_tag { get; set; } //區域GUID public string Full_name { get; set; } //區域名稱 public string Ip_address { get; set; } //監控主機 IP public byte FloorNum { get; set; } //樓層數量