From c5985d00943398d86f0730349dec477d775d59e7 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Wed, 11 Dec 2024 11:07:07 +0800 Subject: [PATCH] =?UTF-8?q?admin=E8=B4=A6=E6=88=B7=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E4=B8=8D=E8=83=BD=E5=88=A0=E9=99=A420241211?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Org/Dtos/Company/CompanyDtoInput.cs | 1 + .../Org/Interface/IUserService.cs | 2 +- .../Org/Services/CompanyService.cs | 3 +++ .../Org/Services/UserService.cs | 12 +++++------- BPA.SAAS.Manage.Application/Org/UserServices.cs | 6 +++--- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/BPA.SAAS.Manage.Application/Org/Dtos/Company/CompanyDtoInput.cs b/BPA.SAAS.Manage.Application/Org/Dtos/Company/CompanyDtoInput.cs index 41b2406..76feb9d 100644 --- a/BPA.SAAS.Manage.Application/Org/Dtos/Company/CompanyDtoInput.cs +++ b/BPA.SAAS.Manage.Application/Org/Dtos/Company/CompanyDtoInput.cs @@ -44,5 +44,6 @@ namespace BPA.SAAS.Manage.Application.Org.Dtos.Company /// 所属平台 0 团餐 1门店 2 后厨 3公共 /// public int Type { get; set; } + public string UserId { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/Org/Interface/IUserService.cs b/BPA.SAAS.Manage.Application/Org/Interface/IUserService.cs index 0c541c9..6fe8152 100644 --- a/BPA.SAAS.Manage.Application/Org/Interface/IUserService.cs +++ b/BPA.SAAS.Manage.Application/Org/Interface/IUserService.cs @@ -16,7 +16,7 @@ namespace BPA.SAAS.Manage.Application.Org.Interface Task DeleteUser(List input); Task Enable(string Id); Task Disable(string Id); - Task ResetPwd(string Id); + Task ResetPwd(string id); Task UpdatePwd(UserPwdDtoInput input); Task GetUserRole(string UserId); Task AddUserRole(UserRoleDtoInput input); diff --git a/BPA.SAAS.Manage.Application/Org/Services/CompanyService.cs b/BPA.SAAS.Manage.Application/Org/Services/CompanyService.cs index 5d24d4d..7f8fa66 100644 --- a/BPA.SAAS.Manage.Application/Org/Services/CompanyService.cs +++ b/BPA.SAAS.Manage.Application/Org/Services/CompanyService.cs @@ -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); diff --git a/BPA.SAAS.Manage.Application/Org/Services/UserService.cs b/BPA.SAAS.Manage.Application/Org/Services/UserService.cs index ce1eba3..8d20ad5 100644 --- a/BPA.SAAS.Manage.Application/Org/Services/UserService.cs +++ b/BPA.SAAS.Manage.Application/Org/Services/UserService.cs @@ -136,17 +136,15 @@ namespace BPA.SAAS.Manage.Application.Org.Services /// /// 重置密码 /// - /// + /// /// - public async Task ResetPwd(string Id) + public async Task ResetPwd(string id) { - var user = _db.Queryable().First(t => t.Id == Id); - + var user = _db.Queryable().First(t => t.Id == id); if (user == null) return false; - string pwd = MD5Encryption.Encrypt("123456").ToLower(); - - return await _db.Updateable(t => t.Password == pwd).Where(t => t.Id == Id).ExecuteCommandHasChangeAsync(); + user.Password = MD5Encryption.Encrypt("123456").ToLower(); + return await _db.Updateable(user).ExecuteCommandHasChangeAsync(); } diff --git a/BPA.SAAS.Manage.Application/Org/UserServices.cs b/BPA.SAAS.Manage.Application/Org/UserServices.cs index ce9fcc9..ebb23ea 100644 --- a/BPA.SAAS.Manage.Application/Org/UserServices.cs +++ b/BPA.SAAS.Manage.Application/Org/UserServices.cs @@ -66,12 +66,12 @@ namespace BPA.SAAS.Manage.Application.Org /// /// 重置密码 /// - /// + /// /// [HttpGet("/api/user/resetuserpwd")] - public async Task ResetPwd(string Id) + public async Task ResetPwd(string id) { - return await _userService.ResetPwd(Id); + return await _userService.ResetPwd(id); } /// /// 变更密码