SysUserService.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Microsoft.AspNetCore.Http;
  2. using ERP.Core.Dto;
  3. using ERP.Core.Entity;
  4. using ERP.Core.Repository;
  5. using ERP.Framework.Constants;
  6. using ERP.Framework.WebApi;
  7. namespace ERP.Core.Service
  8. {
  9. public class SysUserService
  10. {
  11. private SysUserRepository SysUserRepository;
  12. public SysUserService(SysUserRepository SysUserRepository)
  13. {
  14. this.SysUserRepository = SysUserRepository;
  15. }
  16. public async Task<LoginUser> GetUserInfo(string loginName)
  17. {
  18. var user = SysUserRepository.FirstOrDefault(t => t.UserName == loginName);
  19. //if (user == null)
  20. //{
  21. // throw new Exception(string.Format(_localizer["User.NotExist"], loginName)));
  22. //}
  23. //CheckUserStatus(user);
  24. //var roleList = SysRoleRepository.SelectRoleListByUserId(user.Id);
  25. //var roleKeyList = roleList.Select(t => t.RoleKey).ToList();
  26. //var permissions = new List<string>();
  27. //if (roleList.Any(t => t.RoleKey == FrameworkConstant.Admin))
  28. //{
  29. // permissions.Add(FrameworkConstant.AdminPermission);
  30. //}
  31. //else
  32. //{
  33. // var roleIds = roleList.Select(t => t.Id).ToList();
  34. // permissions = SysMenuRepository.SelectPermissionsByRoleIds(roleIds);
  35. //}
  36. return new LoginUser();
  37. }
  38. private void CheckUserStatus(SysUser user)
  39. {
  40. //if (user.UserStatus == UserStatusEnum.Enable)
  41. //{
  42. // return;
  43. //}
  44. //else if (user.UserStatus == UserStatusEnum.Disable)
  45. //{
  46. // throw new RpcException(new Status(StatusCode.Unknown, string.Format(_localizer["User.Bloked"], user.LoginName)));
  47. //}
  48. //else if (user.UserStatus == UserStatusEnum.Effact)
  49. //{
  50. // CheckEffective(user.EffectiveDate, user.LoginName);
  51. //}
  52. //else if (user.UserStatus == UserStatusEnum.Expiry)
  53. //{
  54. // CheckExpiry(user.ExpiryDate, user.LoginName);
  55. //}
  56. //else if (user.UserStatus == UserStatusEnum.Temporary)
  57. //{
  58. // CheckEffective(user.EffectiveDate, user.LoginName);
  59. // CheckExpiry(user.ExpiryDate, user.LoginName);
  60. //}
  61. }
  62. }
  63. }