ITokensManager.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using System;
  2. using WingServerCommon.Log;
  3. using WingServerCommon.Interfaces.OpLog;
  4. namespace WingServerCommon.Interfaces.Cache
  5. {
  6. public interface ITokensManager : IBaseCacheManager<Token>
  7. {
  8. }
  9. public class TokensManager : CacheManager<Token>, ITokensManager
  10. {
  11. public TokensManager() : base()
  12. {
  13. }
  14. }
  15. /// <summary>
  16. /// Internal Server token, just used in server session module
  17. /// </summary>
  18. public class Token : ICacheObject
  19. {
  20. public Token()
  21. {
  22. }
  23. /// <summary>
  24. /// The token version
  25. /// </summary>
  26. /// <value></value>
  27. public int Version { get; set; }
  28. /// <summary>
  29. /// The token string value
  30. /// </summary>
  31. /// <value></value>
  32. public string Code { get; set; }
  33. /// <summary>
  34. /// The Account Type of logined client
  35. /// </summary>
  36. /// <value></value>
  37. public int AccountType { get; set; }
  38. /// <summary>
  39. /// The Account name
  40. /// </summary>
  41. /// <value></value>
  42. public string AccountName { get; set; } = string.Empty;
  43. /// <summary>
  44. /// The plateform the account logined
  45. /// </summary>
  46. /// <value></value>
  47. public int Platform { get; set; }
  48. /// <summary>
  49. /// The login source of account
  50. /// </summary>
  51. /// <value></value>
  52. public int LoginSource { get; set; }
  53. /// <summary>
  54. /// The Client Id(User code , admin code or device code)
  55. /// </summary>
  56. /// <value></value>
  57. public string ClientId { get; set; }
  58. /// <summary>
  59. /// The Login server url
  60. /// </summary>
  61. /// <value></value>
  62. public string LoginServer { get; set; }
  63. /// <summary>
  64. /// Token create time
  65. /// </summary>
  66. /// <value></value>
  67. public DateTime CreateTime { get; set; }
  68. /// <summary>
  69. /// Token expiretion time
  70. /// </summary>
  71. /// <value></value>
  72. public DateTime Expiration { get; set; }
  73. /// <summary>
  74. /// The client ip address
  75. /// </summary>
  76. /// <value></value>
  77. public long IpValue { get; set; }
  78. /// <summary>
  79. /// The token online state
  80. /// </summary>
  81. /// <value></value>
  82. public bool IsOnline { get; set; }
  83. /// <summary>
  84. /// 安装版本
  85. /// </summary>
  86. /// <value></value>
  87. public string InstallVersion { get; set; }
  88. /// <summary>
  89. /// 是否老平台
  90. /// </summary>
  91. /// <value></value>
  92. public bool IsOldPlatform { get; set; }
  93. /// <summary>
  94. /// 老超声机连接方式
  95. /// </summary>
  96. /// <value></value>
  97. public int ProxyType { get; set; }
  98. public override string ToString()
  99. {
  100. return $"Token:{Code}|AccountType:{AccountType}|AccountName:{AccountName}|Platform:{Platform}|LoginSource:{LoginSource}|ClientId:{ClientId}|LoginServer:{LoginServer}|InstallVersion:{InstallVersion}|IsOldPlatform:{IsOldPlatform}|ProxyType:{ProxyType}";
  101. }
  102. }
  103. }