Verification.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using LC.Newtonsoft.Json;
  2. using TapTap.AntiAddiction;
  3. namespace TapTap.AntiAddiction.Model
  4. {
  5. public class VerificationResult
  6. {
  7. [JsonProperty("age_limit")]
  8. internal int AgeLimit { get; private set; }
  9. [JsonProperty("status")]
  10. internal int Status { get; private set; }
  11. [JsonProperty("anti_addiction_token")]
  12. internal string AntiAddictionToken { get; private set; }
  13. [JsonProperty("has_auth_record")]
  14. internal bool HasAuthRecord { get; private set; }
  15. internal VerificationResult() { }
  16. internal VerificationResult(VerificationResult other)
  17. {
  18. AgeLimit = other.AgeLimit;
  19. Status = other.Status;
  20. AntiAddictionToken = other.AntiAddictionToken;
  21. HasAuthRecord = other.HasAuthRecord;
  22. }
  23. }
  24. internal class VerificationResponse
  25. {
  26. [JsonProperty("type")]
  27. internal string Type { get; private set; }
  28. [JsonProperty("message")]
  29. internal VerificationResult Result { get; private set; }
  30. }
  31. internal class ServerVerificationResponse : BaseResponse
  32. {
  33. [JsonProperty("data")]
  34. internal VerificationResult Result;
  35. [JsonProperty("code")]
  36. internal string Code { get; private set; }
  37. [JsonProperty("msg")]
  38. internal string Message { get; private set; }
  39. }
  40. internal class LocalVerification : VerificationResult
  41. {
  42. [JsonProperty("user_id")]
  43. internal string UserId { get; set; }
  44. [JsonProperty("region")] internal Region Region = Region.China;
  45. internal LocalVerification() { }
  46. internal LocalVerification(VerificationResult obj) : base(obj) { }
  47. /// <summary>
  48. /// 是否已认证
  49. /// </summary>
  50. internal bool IsVerified => Status == 0;
  51. /// <summary>
  52. /// 是否在认证中
  53. /// /// </summary>
  54. internal bool IsVerifing => Status == 1;
  55. /// <summary>
  56. /// 是否是成人
  57. /// </summary>
  58. internal bool IsAdult => AgeLimit == 18;
  59. }
  60. }