[FrontedWebApi] API 調整

This commit is contained in:
dev01 2022-11-05 18:18:29 +08:00
parent b97f7ce6de
commit 6fa2f8edb8
3 changed files with 36 additions and 4 deletions

View File

@ -81,6 +81,38 @@ namespace FrontendWebApi.ApiControllers
return Ok(apiResult);
}
/// <summary>
/// 區域基本資料列表
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult<List<BuildInfo>>> BuildInfoList()
{
ApiResult<List<BuildInfo>> apiResult = new ApiResult<List<BuildInfo>>();
List<BuildInfo> buildInfo = new List<BuildInfo>();
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<BuildInfo>(sqlString);
apiResult.Code = "0000";
apiResult.Data = buildInfo;
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return apiResult;
}
/// <summary>
/// 取得預設的棟別資訊
/// </summary>

View File

@ -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
/// </summary>
/// <param name="post"></param>
/// <returns></returns>
public async Task<ApiResult<List<AuthPage>>> GetRoleNotAuthPageList(PostRoleAuthFilter post)
public async Task<ApiResult<List<AuthPage>>> GetRoleNotAuthPageList([FromBody] PostRoleAuthFilter post)
{
ApiResult<List<AuthPage>> apiResult = new ApiResult<List<AuthPage>>();
List<AuthPage> authPage = new List<AuthPage>();
@ -558,7 +558,7 @@ namespace FrontendWebApi.ApiControllers
/// <param name="post"></param>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult<string>> SaveRoleAuth(PostSaveRoleAuth post)
public async Task<ApiResult<string>> SaveRoleAuth([FromBody] PostSaveRoleAuth post)
{
ApiResult<string> apiResult = new ApiResult<string>();

View File

@ -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; } //樓層數量