平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

82 regels
1.4 KiB

  1. //
  2. namespace SafeCampus.System;
  3. /// <summary>
  4. /// 当前登录用户信息
  5. /// </summary>
  6. public class UserManager
  7. {
  8. /// <summary>
  9. /// 当前用户Id
  10. /// </summary>
  11. public static long UserId
  12. {
  13. get
  14. {
  15. return (App.User?.FindFirst(ClaimConst.USER_ID)?.Value).ToLong();
  16. }
  17. }
  18. /// <summary>
  19. /// 当前用户账号
  20. /// </summary>
  21. public static string UserAccount
  22. {
  23. get
  24. {
  25. return App.User?.FindFirst(ClaimConst.ACCOUNT)?.Value;
  26. }
  27. }
  28. /// <summary>
  29. /// 当前用户昵称
  30. /// </summary>
  31. public static string Name
  32. {
  33. get
  34. {
  35. return App.User?.FindFirst(ClaimConst.NAME)?.Value;
  36. }
  37. }
  38. /// <summary>
  39. /// 是否超级管理员
  40. /// </summary>
  41. public static bool SuperAdmin
  42. {
  43. get
  44. {
  45. return (App.User?.FindFirst(ClaimConst.IS_SUPER_ADMIN)?.Value).ToBoolean();
  46. }
  47. }
  48. /// <summary>
  49. /// 机构ID
  50. /// </summary>
  51. public static long OrgId
  52. {
  53. get
  54. {
  55. return (App.User?.FindFirst(ClaimConst.ORG_ID)?.Value).ToLong();
  56. }
  57. }
  58. public static long? TenantId
  59. {
  60. get
  61. {
  62. //如果有租户ID则返回租户ID,否则返回null
  63. return (App.User?.FindFirst(ClaimConst.TENANT_ID)?.Value).ToLong();
  64. }
  65. }
  66. }