This commit is contained in:
zhutao
2025-11-20 18:00:34 +08:00
parent 701b99b138
commit b7239292d1
45 changed files with 1499 additions and 354 deletions

View File

@@ -0,0 +1,24 @@
class RoomFileDto {
RoomFileDto({
this.fileName = "",
this.fileSize = 0,
this.fileUrl = "",
});
RoomFileDto.fromJson(Map<String, dynamic> json)
: fileName = json['file_name'] ?? "",
fileSize = json['file_size'] ?? 0,
fileUrl = json['file_url'] ?? "";
String fileName;
int fileSize;
String fileUrl;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['file_name'] = fileName;
map['file_size'] = fileSize;
map['file_url'] = fileUrl;
return map;
}
}

View File

@@ -0,0 +1,39 @@
class RoomInfoDto {
RoomInfoDto({
required this.teacherBackground,
required this.roomName,
required this.startTime,
required this.teacherName,
required this.endTime,
required this.id,
});
String teacherBackground;
String roomName;
String startTime;
String teacherName;
String endTime;
int id;
factory RoomInfoDto.fromJson(Map<dynamic, dynamic> json) =>
RoomInfoDto(
teacherBackground: json["teacher_background"],
roomName: json["room_name"],
startTime: json["start_time"],
teacherName: json["teacher_name"],
endTime: json["end_time"],
id: json["id"],
);
Map<dynamic, dynamic> toJson() =>
{
"teacher_background": teacherBackground,
"room_name": roomName,
"start_time": startTime,
"teacher_name": teacherName,
"end_time": endTime,
"id": id,
};
}

View File

@@ -0,0 +1,39 @@
class RoomTypeDto {
final int studyRoomId;
final int teacherId;
final String teacherRtcUid;
final String teacherWsClientId;
final int roomStatus;
final String dataType;
RoomTypeDto({
required this.studyRoomId,
required this.teacherId,
required this.teacherRtcUid,
required this.teacherWsClientId,
required this.roomStatus,
required this.dataType,
});
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map["study_room_id"] = studyRoomId;
map["teacher_id"] = teacherId;
map["teacher_rtc_uid"] = teacherRtcUid;
map["teacher_ws_client_id"] = teacherWsClientId;
map["room_status"] = roomStatus;
map["data_type"] = dataType;
return map;
}
factory RoomTypeDto.fromJson(Map<String, dynamic> json) {
return RoomTypeDto(
studyRoomId: json["study_room_id"] ?? 0,
teacherId: json["teacher_id"] ?? 0,
teacherRtcUid: json["teacher_rtc_uid"] ?? "",
teacherWsClientId: json["teacher_ws_client_id"] ?? "",
roomStatus: json["room_status"] ?? 0,
dataType: json["data_type"] ?? "",
);
}
}

View File

@@ -0,0 +1,67 @@
class RoomUserDto {
final int userId;
final String rtcUid;
final int microphoneStatus;
final int cameraStatus;
final int speekerStatus;
final String wsClientId;
final String userName;
final String avatar;
final int userType;
final List<String> filesList;
final String dataType;
final int handup;
final int online; //0离线1在线
const RoomUserDto({
required this.userId,
required this.rtcUid,
required this.microphoneStatus,
required this.cameraStatus,
required this.speekerStatus,
required this.wsClientId,
required this.userName,
required this.avatar,
required this.userType,
required this.filesList,
required this.dataType,
required this.handup,
required this.online,
});
factory RoomUserDto.fromJson(Map<String, dynamic> json) {
return RoomUserDto(
userId: json["user_id"] ?? 0,
rtcUid: json["rtc_uid"] ?? "",
microphoneStatus: json["microphone_status"] ?? 0,
cameraStatus: json["camera_status"] ?? 0,
speekerStatus: json["speeker_status"] ?? 0,
wsClientId: json["ws_client_id"] ?? "",
userName: json["user_name"] ?? "",
avatar: json["avatar"] ?? "",
userType: json["user_type"] ?? 0,
filesList: json["files"] != null ? List<String>.from(json["files"]) : <String>[],
dataType: json["data_type"] ?? "",
handup: json["handup"] ?? 0,
online: json["online"] ?? 0,
);
}
Map<String, dynamic> toJson() {
return {
"user_id": userId,
"rtc_uid": rtcUid,
"microphone_status": microphoneStatus,
"camera_status": cameraStatus,
"speeker_status": speekerStatus,
"ws_client_id": wsClientId,
"user_name": userName,
"avatar": avatar,
"user_type": userType,
"files": filesList,
"data_type": dataType,
"handup": handup,
"online": online,
};
}
}

View File

@@ -0,0 +1,27 @@
class RtcTokenDto {
RtcTokenDto({
required this.uid,
required this.expiresAt,
required this.channel,
required this.token,
});
String uid;
DateTime expiresAt;
String channel;
String token;
factory RtcTokenDto.fromJson(Map<dynamic, dynamic> json) => RtcTokenDto(
uid: json["uid"],
expiresAt: DateTime.parse(json["expires_at"]),
channel: json["channel"],
token: json["token"],
);
Map<dynamic, dynamic> toJson() => {
"uid": uid,
"expires_at": expiresAt.toIso8601String(),
"channel": channel,
"token": token,
};
}

View File

@@ -0,0 +1,14 @@
class LoginDto {
String accessToken;
LoginDto({required this.accessToken});
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map["accessToken"] = accessToken;
return map;
}
LoginDto.fromJson(dynamic json) : accessToken = json["accessToken"] ?? "";
}

View File

@@ -0,0 +1,60 @@
class UserInfoDto {
UserInfoDto({
required this.accountType,
required this.extraInfo,
required this.name,
required this.tel,
required this.id,
required this.avatar,
});
/// 1学生 2老师
int accountType;
ExtraInfo extraInfo;
String name;
String tel;
int id;
String avatar;
factory UserInfoDto.fromJson(Map<dynamic, dynamic> json) => UserInfoDto(
accountType: json["account_type"],
extraInfo: ExtraInfo.fromJson(json["extra_info"]),
name: json["name"],
tel: json["tel"],
id: json["id"],
avatar: json["avatar"],
);
Map<dynamic, dynamic> toJson() => {
"account_type": accountType,
"extra_info": extraInfo.toJson(),
"name": name,
"tel": tel,
"id": id,
"avatar": avatar,
};
}
class ExtraInfo {
ExtraInfo({
required this.vipEndTime,
required this.vipStartTime,
required this.vipStatus,
});
String vipEndTime;
String vipStartTime;
int vipStatus; // 0:普通用户 1:VIP
factory ExtraInfo.fromJson(Map<dynamic, dynamic> json) => ExtraInfo(
vipEndTime: json["vip_end_time"],
vipStartTime: json["vip_start_time"],
vipStatus: json["vip_status"],
);
Map<dynamic, dynamic> toJson() => {
"vip_end_time": vipEndTime,
"vip_start_time": vipStartTime,
"vip_status": vipStatus,
};
}