session.m.dart 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. class SessionInfo {
  2. String? userCode;
  3. String? deviceId;
  4. String? sessionId;
  5. String? id;
  6. DateTime? createTime;
  7. DateTime? updateTime;
  8. bool isDelete;
  9. SessionInfo({
  10. this.userCode,
  11. this.deviceId,
  12. this.sessionId,
  13. this.id,
  14. this.createTime,
  15. this.updateTime,
  16. this.isDelete=false,
  17. });
  18. factory SessionInfo.fromJson(Map<String, dynamic> map) {
  19. return SessionInfo(
  20. userCode: map['UserCode'],
  21. deviceId: map['DeviceId'],
  22. sessionId: map['SessionId'],
  23. id: map['Id'],
  24. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  25. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  26. isDelete: map['IsDelete'],
  27. );
  28. }
  29. Map<String, dynamic> toJson() {
  30. final map = Map<String, dynamic>();
  31. if(userCode != null)
  32. map['UserCode'] = userCode;
  33. if(deviceId != null)
  34. map['DeviceId'] = deviceId;
  35. if(sessionId != null)
  36. map['SessionId'] = sessionId;
  37. if(id != null)
  38. map['Id'] = id;
  39. if(createTime != null)
  40. map['CreateTime'] = createTime;
  41. if(updateTime != null)
  42. map['UpdateTime'] = updateTime;
  43. map['IsDelete'] = isDelete;
  44. return map;
  45. }
  46. }
  47. class SessionClientInfo {
  48. String? clientIpAndPort;
  49. String? clientDeviceId;
  50. String? clientSource;
  51. String? clientExtensionInfo;
  52. SessionClientInfo({
  53. this.clientIpAndPort,
  54. this.clientDeviceId,
  55. this.clientSource,
  56. this.clientExtensionInfo,
  57. });
  58. factory SessionClientInfo.fromJson(Map<String, dynamic> map) {
  59. return SessionClientInfo(
  60. clientIpAndPort: map['ClientIpAndPort'],
  61. clientDeviceId: map['ClientDeviceId'],
  62. clientSource: map['ClientSource'],
  63. clientExtensionInfo: map['ClientExtensionInfo'],
  64. );
  65. }
  66. Map<String, dynamic> toJson() {
  67. final map = Map<String, dynamic>();
  68. if(clientIpAndPort != null)
  69. map['ClientIpAndPort'] = clientIpAndPort;
  70. if(clientDeviceId != null)
  71. map['ClientDeviceId'] = clientDeviceId;
  72. if(clientSource != null)
  73. map['ClientSource'] = clientSource;
  74. if(clientExtensionInfo != null)
  75. map['ClientExtensionInfo'] = clientExtensionInfo;
  76. return map;
  77. }
  78. }