login.m.dart 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. }
  32. class LoginProcessorInfo {
  33. String? userName;
  34. String? password;
  35. String? wechatToken;
  36. LoginProcessorInfo({
  37. this.userName,
  38. this.password,
  39. this.wechatToken,
  40. });
  41. factory LoginProcessorInfo.fromJson(Map<String, dynamic> map) {
  42. return LoginProcessorInfo(
  43. userName: map['UserName'],
  44. password: map['Password'],
  45. wechatToken: map['WechatToken'],
  46. );
  47. }
  48. Map<String, dynamic> toJson() {
  49. final map = Map<String, dynamic>();
  50. if(userName != null)
  51. map['UserName'] = userName;
  52. if(password != null)
  53. map['Password'] = password;
  54. if(wechatToken != null)
  55. map['WechatToken'] = wechatToken;
  56. return map;
  57. }
  58. }
  59. class ClientInfo {
  60. String? clientIpAndPort;
  61. String? clientDeviceId;
  62. String? clientSource;
  63. String? clientExtensionInfo;
  64. ClientInfo({
  65. this.clientIpAndPort,
  66. this.clientDeviceId,
  67. this.clientSource,
  68. this.clientExtensionInfo,
  69. });
  70. factory ClientInfo.fromJson(Map<String, dynamic> map) {
  71. return ClientInfo(
  72. clientIpAndPort: map['ClientIpAndPort'],
  73. clientDeviceId: map['ClientDeviceId'],
  74. clientSource: map['ClientSource'],
  75. clientExtensionInfo: map['ClientExtensionInfo'],
  76. );
  77. }
  78. Map<String, dynamic> toJson() {
  79. final map = Map<String, dynamic>();
  80. if(clientIpAndPort != null)
  81. map['ClientIpAndPort'] = clientIpAndPort;
  82. if(clientDeviceId != null)
  83. map['ClientDeviceId'] = clientDeviceId;
  84. if(clientSource != null)
  85. map['ClientSource'] = clientSource;
  86. if(clientExtensionInfo != null)
  87. map['ClientExtensionInfo'] = clientExtensionInfo;
  88. return map;
  89. }
  90. }
  91. class UserLoginInfo {
  92. EnumLoginProcessorType loginType;
  93. LoginProcessorInfo? processorInfo;
  94. ClientInfo? clientInfo;
  95. UserLoginInfo({
  96. this.loginType=EnumLoginProcessorType.Official,
  97. this.processorInfo,
  98. this.clientInfo,
  99. });
  100. factory UserLoginInfo.fromJson(Map<String, dynamic> map) {
  101. return UserLoginInfo(
  102. loginType: EnumLoginProcessorType.values.firstWhere((e) => e.index == map['LoginType']),
  103. processorInfo: map['ProcessorInfo'],
  104. clientInfo: map['ClientInfo'],
  105. );
  106. }
  107. Map<String, dynamic> toJson() {
  108. final map = Map<String, dynamic>();
  109. map['LoginType'] = loginType.index;
  110. if(processorInfo != null)
  111. map['ProcessorInfo'] = processorInfo;
  112. if(clientInfo != null)
  113. map['ClientInfo'] = clientInfo;
  114. return map;
  115. }
  116. }
  117. class UserInfo {
  118. String? userCode;
  119. String? userName;
  120. String? secretPassword;
  121. String? phone;
  122. String? email;
  123. String? nickName;
  124. String? fullName;
  125. String? headImageToken;
  126. String? organizationCode;
  127. List<String>? authorityGroups;
  128. List<String>? bindDevices;
  129. int score;
  130. String? lastIP;
  131. String? id;
  132. DateTime? createTime;
  133. DateTime? updateTime;
  134. bool isDelete;
  135. UserInfo({
  136. this.userCode,
  137. this.userName,
  138. this.secretPassword,
  139. this.phone,
  140. this.email,
  141. this.nickName,
  142. this.fullName,
  143. this.headImageToken,
  144. this.organizationCode,
  145. this.authorityGroups,
  146. this.bindDevices,
  147. this.score=0,
  148. this.lastIP,
  149. this.id,
  150. this.createTime,
  151. this.updateTime,
  152. this.isDelete=false,
  153. });
  154. factory UserInfo.fromJson(Map<String, dynamic> map) {
  155. return UserInfo(
  156. userCode: map['UserCode'],
  157. userName: map['UserName'],
  158. secretPassword: map['SecretPassword'],
  159. phone: map['Phone'],
  160. email: map['Email'],
  161. nickName: map['NickName'],
  162. fullName: map['FullName'],
  163. headImageToken: map['HeadImageToken'],
  164. organizationCode: map['OrganizationCode'],
  165. authorityGroups: map['AuthorityGroups'].cast<String>().toList(),
  166. bindDevices: map['BindDevices'].cast<String>().toList(),
  167. score: map['Score'],
  168. lastIP: map['LastIP'],
  169. id: map['Id'],
  170. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  171. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  172. isDelete: map['IsDelete'],
  173. );
  174. }
  175. Map<String, dynamic> toJson() {
  176. final map = Map<String, dynamic>();
  177. if(userCode != null)
  178. map['UserCode'] = userCode;
  179. if(userName != null)
  180. map['UserName'] = userName;
  181. if(secretPassword != null)
  182. map['SecretPassword'] = secretPassword;
  183. if(phone != null)
  184. map['Phone'] = phone;
  185. if(email != null)
  186. map['Email'] = email;
  187. if(nickName != null)
  188. map['NickName'] = nickName;
  189. if(fullName != null)
  190. map['FullName'] = fullName;
  191. if(headImageToken != null)
  192. map['HeadImageToken'] = headImageToken;
  193. if(organizationCode != null)
  194. map['OrganizationCode'] = organizationCode;
  195. if(authorityGroups != null)
  196. map['AuthorityGroups'] = authorityGroups;
  197. if(bindDevices != null)
  198. map['BindDevices'] = bindDevices;
  199. map['Score'] = score;
  200. if(lastIP != null)
  201. map['LastIP'] = lastIP;
  202. if(id != null)
  203. map['Id'] = id;
  204. if(createTime != null)
  205. map['CreateTime'] = createTime;
  206. if(updateTime != null)
  207. map['UpdateTime'] = updateTime;
  208. map['IsDelete'] = isDelete;
  209. return map;
  210. }
  211. }