mobile_skt/lib/models/user_info.model.dart

70 lines
1.6 KiB
Dart
Raw Normal View History

2024-03-19 08:59:08 +08:00
import 'package:sk_base_mobile/models/role.model.dart';
class UserInfoModel {
2024-03-19 08:59:08 +08:00
int? id;
String? createdAt;
String? updatedAt;
String? username;
String? nickname;
String? avatar;
2024-03-19 08:59:08 +08:00
String? qq;
String? email;
String? phone;
String? remark;
int? status;
List<RoleModel>? roles;
2024-03-19 08:59:08 +08:00
UserInfoModel(
{this.id,
this.createdAt,
this.updatedAt,
this.username,
this.nickname,
this.avatar,
this.qq,
this.email,
this.phone,
this.remark,
this.status,
this.roles});
UserInfoModel.fromJson(Map<String, dynamic> json) {
2024-03-19 08:59:08 +08:00
id = json['id'];
createdAt = json['createdAt'];
updatedAt = json['updatedAt'];
username = json['username'];
nickname = json['nickname'];
avatar = json['avatar'];
2024-03-19 08:59:08 +08:00
qq = json['qq'];
email = json['email'];
phone = json['phone'];
remark = json['remark'];
status = json['status'];
if (json['roles'] != null) {
roles = <RoleModel>[];
json['roles'].forEach((v) {
roles!.add(RoleModel.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
2024-03-19 08:59:08 +08:00
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['createdAt'] = createdAt;
data['updatedAt'] = updatedAt;
data['username'] = username;
data['nickname'] = nickname;
data['avatar'] = avatar;
2024-03-19 08:59:08 +08:00
data['qq'] = qq;
data['email'] = email;
data['phone'] = phone;
data['remark'] = remark;
data['status'] = status;
if (roles != null) {
data['roles'] = roles!.map((v) => v.toJson()).toList();
}
return data;
}
}