From eb79a6e12ee59a56be81c12521a561115e180a3c Mon Sep 17 00:00:00 2001 From: dev02 Date: Sat, 17 Feb 2024 10:18:22 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B3=AC=E8=99=9F=E5=88=AA=E9=99=A4=E6=96=B0=E5=A2=9E=E5=95=8F?= =?UTF-8?q?=E9=A1=8C,=20=E8=AA=BF=E6=95=B4=E6=AC=8A=E9=99=90=E7=A9=BA?= =?UTF-8?q?=E7=AE=A1=E6=96=B0=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Controllers/LoginController.cs | 2 +- Backend/Controllers/UserInfoController.cs | 7 +++-- .../ApiControllers/BuildController.cs | 31 +++++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Backend/Controllers/LoginController.cs b/Backend/Controllers/LoginController.cs index 4b5362c..902beb2 100644 --- a/Backend/Controllers/LoginController.cs +++ b/Backend/Controllers/LoginController.cs @@ -60,7 +60,7 @@ namespace Backend.Controllers EDFunction edFunction = new EDFunction(); try { - userInfo = await userInfoRepository.GetOneByAccountAsync(login.Account); + userInfo = await backendRepository.GetOneAsync($"select * from userinfo where account = '{login.Account}' and deleted = 0"); if (userInfo == null) { diff --git a/Backend/Controllers/UserInfoController.cs b/Backend/Controllers/UserInfoController.cs index b75b797..39056d4 100644 --- a/Backend/Controllers/UserInfoController.cs +++ b/Backend/Controllers/UserInfoController.cs @@ -121,8 +121,8 @@ namespace Backend.Controllers #region 新增使用者 //判斷帳號 是否已存在 - var exist = await backendRepository.HasExistsWithGuid(post.Account, "userinfo", "account"); - if (exist) + var exist = await backendRepository.GetOneAsync($"select userinfo_guid from userinfo where account = '{post.Account}' and deleted = 0"); + if (!string.IsNullOrEmpty(exist)) { apiResult.Code = "9986"; apiResult.Msg = "該帳號已被註冊,請重新輸入"; @@ -136,7 +136,8 @@ namespace Backend.Controllers const string chars = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789"; string random_password = new string(Enumerable.Repeat(chars, 8).Select(s => s[random.Next(chars.Length)]).ToArray()); - var newPassword = edFunction.GetSHA256Encryption(random_password); + //var newPassword = edFunction.GetSHA256Encryption(random_password); + var newPassword = edFunction.GetSHA256Encryption("123456"); //產生一組GUID var guid = Guid.NewGuid(); //使用者GUID diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs index 9048aff..2d0d5a8 100644 --- a/FrontendWebApi/ApiControllers/BuildController.cs +++ b/FrontendWebApi/ApiControllers/BuildController.cs @@ -296,6 +296,37 @@ namespace FrontendWebApi.ApiControllers } } } + + #region extra progress for DataAnalyst and HistorySearch + var extraMenus = await backendRepository.GetAllAsync($@"SELECT distinct + b.building_tag, + b.full_name, + b.ip_address, + b.priority + FROM + ( + SELECT * + FROM role_auth ra + WHERE ra.role_guid = (SELECT ui.role_guid from userinfo ui where account = '{account}') + ) ra + join auth_page ap on ra.AuthCode = ap.AuthCode + join building b on ap.building_tag = b.building_tag and b.deleted = 0 + where ap.AuthType = 1 and (ap.showview = 'DataAnalyst' or ap.showview = 'HistorySearch')"); + + if (extraMenus.Any()) + { + foreach (var menu in extraMenus) + { + if (!buildingMenus.Any(x => x.building_tag == menu.building_tag)) + { + menu.common = new List(); + menu.main_system = new List(); + buildingMenus.Add(menu); + } + } + } + #endregion + apiResult.Data = buildingMenus; apiResult.Code = "0000"; }