初始化
This commit is contained in:
20
lib/data/models/api_dto.dart
Normal file
20
lib/data/models/api_dto.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
class ApiDto<T> {
|
||||
final int code;
|
||||
final String message;
|
||||
final T data;
|
||||
|
||||
ApiDto({
|
||||
required this.code,
|
||||
required this.message,
|
||||
required this.data
|
||||
});
|
||||
|
||||
|
||||
factory ApiDto.fromJson(Map<String, dynamic> json) {
|
||||
return ApiDto<T>(
|
||||
code: json['code'],
|
||||
message: json['message'],
|
||||
data: json['data'],
|
||||
);
|
||||
}
|
||||
}
|
||||
24
lib/data/models/common/qiu_token_dto.dart
Normal file
24
lib/data/models/common/qiu_token_dto.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
class QiuTokenDto {
|
||||
String? uploadUrl;
|
||||
String? upToken;
|
||||
String? fileKey;
|
||||
String? domain;
|
||||
|
||||
QiuTokenDto({this.uploadUrl, this.upToken, this.fileKey, this.domain});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map["upload_url"] = uploadUrl;
|
||||
map["up_token"] = upToken;
|
||||
map["file_key"] = fileKey;
|
||||
map["domain"] = domain;
|
||||
return map;
|
||||
}
|
||||
|
||||
QiuTokenDto.fromJson(dynamic json){
|
||||
uploadUrl = json["upload_url"] ?? "";
|
||||
upToken = json["up_token"] ?? "";
|
||||
fileKey = json["file_key"] ?? "";
|
||||
domain = json["domain"] ?? "";
|
||||
}
|
||||
}
|
||||
43
lib/data/models/common/version_dto.dart
Normal file
43
lib/data/models/common/version_dto.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
class VersionDto {
|
||||
VersionDto({
|
||||
required this.latestVersion,
|
||||
required this.updatedAt,
|
||||
required this.downloadUrl,
|
||||
required this.updateContent,
|
||||
required this.createdAt,
|
||||
required this.lowVersion,
|
||||
required this.id,
|
||||
required this.downloadSize,
|
||||
});
|
||||
|
||||
String latestVersion;
|
||||
DateTime updatedAt;
|
||||
String downloadUrl;
|
||||
List<String> updateContent;
|
||||
DateTime createdAt;
|
||||
String lowVersion;
|
||||
int id;
|
||||
String downloadSize;
|
||||
|
||||
factory VersionDto.fromJson(Map<dynamic, dynamic> json) => VersionDto(
|
||||
latestVersion: json["latest_version"],
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
downloadUrl: json["download_url"],
|
||||
updateContent: List<String>.from(json["update_content"].map((x) => x)),
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
lowVersion: json["low_version"],
|
||||
id: json["id"],
|
||||
downloadSize: json["download_size"],
|
||||
);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => {
|
||||
"latest_version": latestVersion,
|
||||
"updated_at": updatedAt.toIso8601String(),
|
||||
"download_url": downloadUrl,
|
||||
"update_content": List<dynamic>.from(updateContent.map((x) => x)),
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"low_version": lowVersion,
|
||||
"id": id,
|
||||
"download_size": downloadSize,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user