@@ -44,5 +44,6 @@ namespace BPA.SAAS.Manage.Application.Org.Dtos.Company | |||||
/// 所属平台 0 团餐 1门店 2 后厨 3公共 | /// 所属平台 0 团餐 1门店 2 后厨 3公共 | ||||
/// </summary> | /// </summary> | ||||
public int Type { get; set; } | public int Type { get; set; } | ||||
public string UserId { get; set; } | |||||
} | } | ||||
} | } |
@@ -16,7 +16,7 @@ namespace BPA.SAAS.Manage.Application.Org.Interface | |||||
Task<bool> DeleteUser(List<string> input); | Task<bool> DeleteUser(List<string> input); | ||||
Task<bool> Enable(string Id); | Task<bool> Enable(string Id); | ||||
Task<bool> Disable(string Id); | Task<bool> Disable(string Id); | ||||
Task<bool> ResetPwd(string Id); | |||||
Task<bool> ResetPwd(string id); | |||||
Task<bool> UpdatePwd(UserPwdDtoInput input); | Task<bool> UpdatePwd(UserPwdDtoInput input); | ||||
Task<UserRoleDtoInput> GetUserRole(string UserId); | Task<UserRoleDtoInput> GetUserRole(string UserId); | ||||
Task<bool> AddUserRole(UserRoleDtoInput input); | Task<bool> AddUserRole(UserRoleDtoInput input); | ||||
@@ -48,9 +48,12 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||||
var user = userList.FirstOrDefault(a => a.Account == t.Phone); | var user = userList.FirstOrDefault(a => a.Account == t.Phone); | ||||
if (user != null) | if (user != null) | ||||
{ | { | ||||
t.UserId = user.Id; | |||||
var userRoles = userRoleList.Where(t => t.SysUserId == user.Id).Select(t => t.SysRoleId).ToList(); | var userRoles = userRoleList.Where(t => t.SysUserId == user.Id).Select(t => t.SysRoleId).ToList(); | ||||
t.SysRoleId = userRoles.Any() ? userRoles[0] : null; | t.SysRoleId = userRoles.Any() ? userRoles[0] : null; | ||||
} | } | ||||
if (t.AdminName == "admin") | |||||
t.UserId = userList.FirstOrDefault(t => t.Account == "admin")?.Id; | |||||
}) | }) | ||||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | .OrderBy(a => a.CreateAt, OrderByType.Desc) | ||||
.ToPageListAsync(input.Current, input.PageSize, total); | .ToPageListAsync(input.Current, input.PageSize, total); | ||||
@@ -136,17 +136,15 @@ namespace BPA.SAAS.Manage.Application.Org.Services | |||||
/// <summary> | /// <summary> | ||||
/// 重置密码 | /// 重置密码 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="Id"></param> | |||||
/// <param name="id"></param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<bool> ResetPwd(string Id) | |||||
public async Task<bool> ResetPwd(string id) | |||||
{ | { | ||||
var user = _db.Queryable<BPA_Users>().First(t => t.Id == Id); | |||||
var user = _db.Queryable<BPA_Users>().First(t => t.Id == id); | |||||
if (user == null) | if (user == null) | ||||
return false; | return false; | ||||
string pwd = MD5Encryption.Encrypt("123456").ToLower(); | |||||
return await _db.Updateable<BPA_Users>(t => t.Password == pwd).Where(t => t.Id == Id).ExecuteCommandHasChangeAsync(); | |||||
user.Password = MD5Encryption.Encrypt("123456").ToLower(); | |||||
return await _db.Updateable(user).ExecuteCommandHasChangeAsync(); | |||||
} | } | ||||
@@ -66,12 +66,12 @@ namespace BPA.SAAS.Manage.Application.Org | |||||
/// <summary> | /// <summary> | ||||
/// 重置密码 | /// 重置密码 | ||||
/// </summary> | /// </summary> | ||||
/// <param name="Id"></param> | |||||
/// <param name="id"></param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpGet("/api/user/resetuserpwd")] | [HttpGet("/api/user/resetuserpwd")] | ||||
public async Task<bool> ResetPwd(string Id) | |||||
public async Task<bool> ResetPwd(string id) | |||||
{ | { | ||||
return await _userService.ResetPwd(Id); | |||||
return await _userService.ResetPwd(id); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 变更密码 | /// 变更密码 | ||||