feat:增加Minio工具类

This commit is contained in:
2025-11-18 20:03:25 +08:00
parent 9a8e1a7419
commit b6995d8dd1
15 changed files with 332 additions and 194 deletions

View File

@@ -9,7 +9,11 @@ class RecipeMaterial {
String name;
String amount;
RecipeMaterial({required this.type, required this.name, required this.amount});
RecipeMaterial({
required this.type,
required this.name,
required this.amount,
});
factory RecipeMaterial.fromJson(Map<String, dynamic> json) =>
_$RecipeMaterialFromJson(json);
@@ -24,9 +28,14 @@ class RecipeStep {
String content;
String imageUrl;
RecipeStep({required this.sort, required this.content, required this.imageUrl});
RecipeStep({
required this.sort,
required this.content,
required this.imageUrl,
});
factory RecipeStep.fromJson(Map<String, dynamic> json) => _$RecipeStepFromJson(json);
factory RecipeStep.fromJson(Map<String, dynamic> json) =>
_$RecipeStepFromJson(json);
Map<String, dynamic> toJson() => _$RecipeStepToJson(this);
}
@@ -56,7 +65,7 @@ class RecipeComment {
/// 成果信息
@JsonSerializable()
class Record {
class FoodRecord {
int? id;
String name;
String category;
@@ -64,7 +73,7 @@ class Record {
String date;
String imageUrl;
Record({
FoodRecord({
this.id,
required this.name,
required this.category,
@@ -73,20 +82,31 @@ class Record {
required this.imageUrl,
});
factory Record.fromJson(Map<String, dynamic> json) => _$RecordFromJson(json);
factory FoodRecord.fromJson(Map<String, dynamic> json) =>
_$RecordFromJson(json);
Map<String, dynamic> toJson() => _$RecordToJson(this);
static FoodRecord getEmpty() {
return FoodRecord(
id: 0,
name: '',
category: '',
person: 0,
date: '',
imageUrl: '',
);
}
}
@JsonSerializable()
class RecipeQuery {
String category;
RecipeQuery({
required this.category
});
RecipeQuery({required this.category});
factory RecipeQuery.fromJson(Map<String, dynamic> json) => _$RecipeQueryFromJson(json);
factory RecipeQuery.fromJson(Map<String, dynamic> json) =>
_$RecipeQueryFromJson(json);
Map<String, dynamic> toJson() => _$RecipeQueryToJson(this);
}
@@ -105,7 +125,7 @@ class Recipe {
String avatar;
List<RecipeMaterial> materialList;
List<RecipeStep> stepList;
List<Record> recordList;
List<FoodRecord> recordList;
List<int> likeList;
int likeCount;
List<int> favouriteList;
@@ -146,7 +166,7 @@ class RecipeSummary {
String category;
double recommendRate;
bool isShare;
List<Record> recordList;
List<FoodRecord> recordList;
int likeCount;
int favouriteCount;
int commentCount;
@@ -169,7 +189,8 @@ class RecipeSummary {
required this.commentCount,
});
factory RecipeSummary.fromJson(Map<String, dynamic> json) => _$RecipeSummaryFromJson(json);
factory RecipeSummary.fromJson(Map<String, dynamic> json) =>
_$RecipeSummaryFromJson(json);
Map<String, dynamic> toJson() => _$RecipeSummaryToJson(this);
}
@@ -187,7 +208,7 @@ class RecipeDetail {
String avatar;
List<RecipeMaterial> materialList;
List<RecipeStep> stepList;
List<Record> recordList;
List<FoodRecord> recordList;
List<int> likeList;
List<int> favouriteList;
List<RecipeComment> commentList;
@@ -210,7 +231,8 @@ class RecipeDetail {
required this.commentList,
});
factory RecipeDetail.fromJson(Map<String, dynamic> json) => _$RecipeDetailFromJson(json);
factory RecipeDetail.fromJson(Map<String, dynamic> json) =>
_$RecipeDetailFromJson(json);
Map<String, dynamic> toJson() => _$RecipeDetailToJson(this);
}