This commit is contained in:
張家睿 2024-02-21 09:10:28 +08:00
commit e91066df9c
3 changed files with 36 additions and 4 deletions

View File

@ -60,7 +60,7 @@ namespace Backend.Controllers
EDFunction edFunction = new EDFunction(); EDFunction edFunction = new EDFunction();
try try
{ {
userInfo = await userInfoRepository.GetOneByAccountAsync<UserInfo>(login.Account); userInfo = await backendRepository.GetOneAsync<UserInfo>($"select * from userinfo where account = '{login.Account}' and deleted = 0");
if (userInfo == null) if (userInfo == null)
{ {

View File

@ -121,8 +121,8 @@ namespace Backend.Controllers
#region 使 #region 使
//判斷帳號 是否已存在 //判斷帳號 是否已存在
var exist = await backendRepository.HasExistsWithGuid(post.Account, "userinfo", "account"); var exist = await backendRepository.GetOneAsync<string>($"select userinfo_guid from userinfo where account = '{post.Account}' and deleted = 0");
if (exist) if (!string.IsNullOrEmpty(exist))
{ {
apiResult.Code = "9986"; apiResult.Code = "9986";
apiResult.Msg = "該帳號已被註冊,請重新輸入"; apiResult.Msg = "該帳號已被註冊,請重新輸入";
@ -136,7 +136,8 @@ namespace Backend.Controllers
const string chars = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789"; const string chars = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789";
string random_password = new string(Enumerable.Repeat(chars, 8).Select(s => s[random.Next(chars.Length)]).ToArray()); 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 //產生一組GUID
var guid = Guid.NewGuid(); //使用者GUID var guid = Guid.NewGuid(); //使用者GUID

View File

@ -296,6 +296,37 @@ namespace FrontendWebApi.ApiControllers
} }
} }
} }
#region extra progress for DataAnalyst and HistorySearch
var extraMenus = await backendRepository.GetAllAsync<Building>($@"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<string>();
menu.main_system = new List<Main_system>();
buildingMenus.Add(menu);
}
}
}
#endregion
apiResult.Data = buildingMenus; apiResult.Data = buildingMenus;
apiResult.Code = "0000"; apiResult.Code = "0000";
} }