login.m.dart 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. class UserSessionInfo {
  2. String? userCode;
  3. String? deviceId;
  4. String? sessionId;
  5. UserSessionInfo({
  6. this.userCode,
  7. this.deviceId,
  8. this.sessionId,
  9. });
  10. factory UserSessionInfo.fromJson(Map<String, dynamic> map) {
  11. return UserSessionInfo(
  12. userCode: map['UserCode'],
  13. deviceId: map['DeviceId'],
  14. sessionId: map['SessionId'],
  15. );
  16. }
  17. Map<String, dynamic> toJson() {
  18. final map = Map<String, dynamic>();
  19. if(userCode != null)
  20. map['UserCode'] = userCode;
  21. if(deviceId != null)
  22. map['DeviceId'] = deviceId;
  23. if(sessionId != null)
  24. map['SessionId'] = sessionId;
  25. return map;
  26. }
  27. }
  28. enum EnumLoginProcessorType {
  29. Official,
  30. Wechat,
  31. Phone,
  32. Email,
  33. Unregistered,
  34. }
  35. class LoginProcessorInfo {
  36. String? userName;
  37. String? password;
  38. String? phone;
  39. String? email;
  40. String? verifyCode;
  41. String? wechatToken;
  42. LoginProcessorInfo({
  43. this.userName,
  44. this.password,
  45. this.phone,
  46. this.email,
  47. this.verifyCode,
  48. this.wechatToken,
  49. });
  50. factory LoginProcessorInfo.fromJson(Map<String, dynamic> map) {
  51. return LoginProcessorInfo(
  52. userName: map['UserName'],
  53. password: map['Password'],
  54. phone: map['Phone'],
  55. email: map['Email'],
  56. verifyCode: map['VerifyCode'],
  57. wechatToken: map['WechatToken'],
  58. );
  59. }
  60. Map<String, dynamic> toJson() {
  61. final map = Map<String, dynamic>();
  62. if(userName != null)
  63. map['UserName'] = userName;
  64. if(password != null)
  65. map['Password'] = password;
  66. if(phone != null)
  67. map['Phone'] = phone;
  68. if(email != null)
  69. map['Email'] = email;
  70. if(verifyCode != null)
  71. map['VerifyCode'] = verifyCode;
  72. if(wechatToken != null)
  73. map['WechatToken'] = wechatToken;
  74. return map;
  75. }
  76. }
  77. class ClientInfo {
  78. String? clientIpAndPort;
  79. String? clientDeviceId;
  80. String? clientSource;
  81. String? clientExtensionInfo;
  82. ClientInfo({
  83. this.clientIpAndPort,
  84. this.clientDeviceId,
  85. this.clientSource,
  86. this.clientExtensionInfo,
  87. });
  88. factory ClientInfo.fromJson(Map<String, dynamic> map) {
  89. return ClientInfo(
  90. clientIpAndPort: map['ClientIpAndPort'],
  91. clientDeviceId: map['ClientDeviceId'],
  92. clientSource: map['ClientSource'],
  93. clientExtensionInfo: map['ClientExtensionInfo'],
  94. );
  95. }
  96. Map<String, dynamic> toJson() {
  97. final map = Map<String, dynamic>();
  98. if(clientIpAndPort != null)
  99. map['ClientIpAndPort'] = clientIpAndPort;
  100. if(clientDeviceId != null)
  101. map['ClientDeviceId'] = clientDeviceId;
  102. if(clientSource != null)
  103. map['ClientSource'] = clientSource;
  104. if(clientExtensionInfo != null)
  105. map['ClientExtensionInfo'] = clientExtensionInfo;
  106. return map;
  107. }
  108. }
  109. class UserLoginInfo {
  110. EnumLoginProcessorType loginType;
  111. LoginProcessorInfo? processorInfo;
  112. ClientInfo? clientInfo;
  113. UserLoginInfo({
  114. this.loginType=EnumLoginProcessorType.Official,
  115. this.processorInfo,
  116. this.clientInfo,
  117. });
  118. factory UserLoginInfo.fromJson(Map<String, dynamic> map) {
  119. return UserLoginInfo(
  120. loginType: EnumLoginProcessorType.values.firstWhere((e) => e.index == map['LoginType']),
  121. processorInfo: map['ProcessorInfo'],
  122. clientInfo: map['ClientInfo'],
  123. );
  124. }
  125. Map<String, dynamic> toJson() {
  126. final map = Map<String, dynamic>();
  127. map['LoginType'] = loginType.index;
  128. if(processorInfo != null)
  129. map['ProcessorInfo'] = processorInfo;
  130. if(clientInfo != null)
  131. map['ClientInfo'] = clientInfo;
  132. return map;
  133. }
  134. }
  135. enum UserInfoStateEnum {
  136. Nonactivated,
  137. Activated,
  138. }
  139. class UserInfo {
  140. String? userCode;
  141. String? userName;
  142. String? phone;
  143. String? email;
  144. String? nickName;
  145. String? fullName;
  146. String? headImageToken;
  147. String? organizationCode;
  148. List<String>? authorityGroups;
  149. List<String>? bindDevices;
  150. int score;
  151. String? lastIP;
  152. UserInfoStateEnum userState;
  153. String? securityQuestion;
  154. String? securityAnswers;
  155. DateTime? createTime;
  156. DateTime? updateTime;
  157. UserInfo({
  158. this.userCode,
  159. this.userName,
  160. this.phone,
  161. this.email,
  162. this.nickName,
  163. this.fullName,
  164. this.headImageToken,
  165. this.organizationCode,
  166. this.authorityGroups,
  167. this.bindDevices,
  168. this.score=0,
  169. this.lastIP,
  170. this.userState=UserInfoStateEnum.Nonactivated,
  171. this.securityQuestion,
  172. this.securityAnswers,
  173. this.createTime,
  174. this.updateTime,
  175. });
  176. factory UserInfo.fromJson(Map<String, dynamic> map) {
  177. return UserInfo(
  178. userCode: map['UserCode'],
  179. userName: map['UserName'],
  180. phone: map['Phone'],
  181. email: map['Email'],
  182. nickName: map['NickName'],
  183. fullName: map['FullName'],
  184. headImageToken: map['HeadImageToken'],
  185. organizationCode: map['OrganizationCode'],
  186. authorityGroups: map['AuthorityGroups'].cast<String>().toList(),
  187. bindDevices: map['BindDevices'].cast<String>().toList(),
  188. score: map['Score'],
  189. lastIP: map['LastIP'],
  190. userState: UserInfoStateEnum.values.firstWhere((e) => e.index == map['UserState']),
  191. securityQuestion: map['SecurityQuestion'],
  192. securityAnswers: map['SecurityAnswers'],
  193. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  194. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  195. );
  196. }
  197. Map<String, dynamic> toJson() {
  198. final map = Map<String, dynamic>();
  199. if(userCode != null)
  200. map['UserCode'] = userCode;
  201. if(userName != null)
  202. map['UserName'] = userName;
  203. if(phone != null)
  204. map['Phone'] = phone;
  205. if(email != null)
  206. map['Email'] = email;
  207. if(nickName != null)
  208. map['NickName'] = nickName;
  209. if(fullName != null)
  210. map['FullName'] = fullName;
  211. if(headImageToken != null)
  212. map['HeadImageToken'] = headImageToken;
  213. if(organizationCode != null)
  214. map['OrganizationCode'] = organizationCode;
  215. if(authorityGroups != null)
  216. map['AuthorityGroups'] = authorityGroups;
  217. if(bindDevices != null)
  218. map['BindDevices'] = bindDevices;
  219. map['Score'] = score;
  220. if(lastIP != null)
  221. map['LastIP'] = lastIP;
  222. map['UserState'] = userState.index;
  223. if(securityQuestion != null)
  224. map['SecurityQuestion'] = securityQuestion;
  225. if(securityAnswers != null)
  226. map['SecurityAnswers'] = securityAnswers;
  227. if(createTime != null)
  228. map['CreateTime'] = createTime;
  229. if(updateTime != null)
  230. map['UpdateTime'] = updateTime;
  231. return map;
  232. }
  233. }