[後端] 修改賬號刪除新增問題, 調整權限空管新需求
This commit is contained in:
parent
f166793f04
commit
eb79a6e12e
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
|
@ -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";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user