Browse Source

admin账户修改为不能删除20241211

kitchenmanage
gwbvipvip 2 weeks ago
parent
commit
c5985d0094
5 changed files with 13 additions and 11 deletions
  1. +1
    -0
      BPA.SAAS.Manage.Application/Org/Dtos/Company/CompanyDtoInput.cs
  2. +1
    -1
      BPA.SAAS.Manage.Application/Org/Interface/IUserService.cs
  3. +3
    -0
      BPA.SAAS.Manage.Application/Org/Services/CompanyService.cs
  4. +5
    -7
      BPA.SAAS.Manage.Application/Org/Services/UserService.cs
  5. +3
    -3
      BPA.SAAS.Manage.Application/Org/UserServices.cs

+ 1
- 0
BPA.SAAS.Manage.Application/Org/Dtos/Company/CompanyDtoInput.cs View File

@@ -44,5 +44,6 @@ namespace BPA.SAAS.Manage.Application.Org.Dtos.Company
/// 所属平台 0 团餐 1门店 2 后厨 3公共
/// </summary>
public int Type { get; set; }
public string UserId { get; set; }
}
}

+ 1
- 1
BPA.SAAS.Manage.Application/Org/Interface/IUserService.cs View File

@@ -16,7 +16,7 @@ namespace BPA.SAAS.Manage.Application.Org.Interface
Task<bool> DeleteUser(List<string> input);
Task<bool> Enable(string Id);
Task<bool> Disable(string Id);
Task<bool> ResetPwd(string Id);
Task<bool> ResetPwd(string id);
Task<bool> UpdatePwd(UserPwdDtoInput input);
Task<UserRoleDtoInput> GetUserRole(string UserId);
Task<bool> AddUserRole(UserRoleDtoInput input);


+ 3
- 0
BPA.SAAS.Manage.Application/Org/Services/CompanyService.cs View File

@@ -48,9 +48,12 @@ namespace BPA.SAAS.Manage.Application.Org.Services
var user = userList.FirstOrDefault(a => a.Account == t.Phone);
if (user != null)
{
t.UserId = user.Id;
var userRoles = userRoleList.Where(t => t.SysUserId == user.Id).Select(t => t.SysRoleId).ToList();
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)
.ToPageListAsync(input.Current, input.PageSize, total);


+ 5
- 7
BPA.SAAS.Manage.Application/Org/Services/UserService.cs View File

@@ -136,17 +136,15 @@ namespace BPA.SAAS.Manage.Application.Org.Services
/// <summary>
/// 重置密码
/// </summary>
/// <param name="Id"></param>
/// <param name="id"></param>
/// <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)
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();

}



+ 3
- 3
BPA.SAAS.Manage.Application/Org/UserServices.cs View File

@@ -66,12 +66,12 @@ namespace BPA.SAAS.Manage.Application.Org
/// <summary>
/// 重置密码
/// </summary>
/// <param name="Id"></param>
/// <param name="id"></param>
/// <returns></returns>
[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>
/// 变更密码


Loading…
Cancel
Save