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"; }