AccountInfo.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. using System;
  2. namespace ZcPeng.weixin.PublicAccount
  3. {
  4. /// <summary>
  5. /// 公众号信息
  6. /// </summary>
  7. public class AccountInfo
  8. {
  9. /// <summary>
  10. /// 原始公众号(注意:不是登陆账号)
  11. /// </summary>
  12. private string userName;
  13. /// <summary>
  14. /// 应用ID
  15. /// </summary>
  16. private string appId;
  17. /// <summary>
  18. /// 应用密匙
  19. /// </summary>
  20. private string appSecret;
  21. /// <summary>
  22. /// 令牌
  23. /// </summary>
  24. private string token;
  25. /// <summary>
  26. /// timeExpire
  27. /// </summary>
  28. private int timeExpire;
  29. /// <summary>
  30. /// 原始公众号(注意:不是登陆账号)
  31. /// </summary>
  32. public string UserName
  33. {
  34. get
  35. {
  36. return userName;
  37. }
  38. set
  39. {
  40. if (string.IsNullOrWhiteSpace(value))
  41. throw new ArgumentNullException("UserName", "原始公众号不能为空。");
  42. userName = value;
  43. }
  44. }
  45. /// <summary>
  46. /// 应用ID
  47. /// </summary>
  48. public string AppId
  49. {
  50. get
  51. {
  52. return appId;
  53. }
  54. set
  55. {
  56. if (string.IsNullOrWhiteSpace(value))
  57. throw new ArgumentNullException("AppId", "应用ID不能为空。");
  58. appId = value;
  59. }
  60. }
  61. /// <summary>
  62. /// 应用密匙
  63. /// </summary>
  64. public string AppSecret
  65. {
  66. get
  67. {
  68. return appSecret;
  69. }
  70. set
  71. {
  72. if (string.IsNullOrWhiteSpace(value))
  73. throw new ArgumentNullException("AppSecret", "应用密匙不能为空。");
  74. appSecret = value;
  75. }
  76. }
  77. /// <summary>
  78. /// 令牌
  79. /// </summary>
  80. public string Token
  81. {
  82. get
  83. {
  84. return token;
  85. }
  86. set
  87. {
  88. //if (string.IsNullOrWhiteSpace(value))
  89. // throw new ArgumentNullException("Token", "令牌不能为空。");
  90. token = value;
  91. }
  92. }
  93. /// <summary>
  94. /// 过期时间
  95. /// </summary>
  96. public int TimeExpire { get; set; }
  97. /// <summary>
  98. /// 消息AES加密密匙
  99. /// </summary>
  100. public string EncodingAESKey { get; set; }
  101. /// <summary>
  102. /// 标题
  103. /// </summary>
  104. public string Caption { get; set; }
  105. /// <summary>
  106. /// 构造函数
  107. /// </summary>
  108. /// <param name="userName">原始公众号</param>
  109. /// <param name="appId">应用id</param>
  110. /// <param name="appSecret">应用密匙</param>
  111. /// <param name="token">令牌</param>
  112. /// <param name="encodingAesKey">消息AES加密密匙</param>
  113. public AccountInfo(string userName, string appId, string appSecret, string token, string encodingAesKey)
  114. {
  115. UserName = userName;
  116. AppId = appId;
  117. AppSecret = appSecret;
  118. Token = token;
  119. EncodingAESKey = encodingAesKey;
  120. Caption = "";
  121. }
  122. /// <summary>
  123. /// 构造函数
  124. /// </summary>
  125. /// <param name="userName">原始公众号</param>
  126. /// <param name="appId">应用id</param>
  127. /// <param name="appSecret">应用密匙</param>
  128. /// <param name="token">令牌</param>
  129. /// <param name="encodingAesKey">消息AES加密密匙</param>
  130. public AccountInfo(string userName, string appId, string appSecret, string token, string encodingAesKey,int expireIn)
  131. {
  132. UserName = userName;
  133. AppId = appId;
  134. AppSecret = appSecret;
  135. Token = token;
  136. EncodingAESKey = encodingAesKey;
  137. Caption = "";
  138. TimeExpire = expireIn;
  139. }
  140. /// <summary>
  141. /// 构造函数
  142. /// </summary>
  143. /// <param name="userName">原始公众号</param>
  144. /// <param name="appId">应用id</param>
  145. /// <param name="appSecret">应用密匙</param>
  146. /// <param name="token">令牌</param>
  147. /// <param name="encodingAesKey">消息AES加密密匙</param>
  148. /// <param name="caption">标题</param>
  149. public AccountInfo(string userName, string appId, string appSecret, string token, string encodingAesKey, string caption)
  150. : this(userName, appId, appSecret, token, encodingAesKey)
  151. {
  152. Caption = caption;
  153. }
  154. }
  155. }