文案ok
This commit is contained in:
21
lib/api/dto/daily_tip_dto.dart
Normal file
21
lib/api/dto/daily_tip_dto.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
class DailyTipDto {
|
||||
int? id;
|
||||
String? title;
|
||||
String? content;
|
||||
|
||||
DailyTipDto({this.id, this.title, this.content});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map["id"] = id;
|
||||
map["title"] = title;
|
||||
map["content"] = content;
|
||||
return map;
|
||||
}
|
||||
|
||||
DailyTipDto.fromJson(dynamic json) {
|
||||
id = json["id"] ?? 0;
|
||||
title = json["title"] ?? "";
|
||||
content = json["content"] ?? "";
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,21 @@ class PlanStepDto {
|
||||
stepExplain = json["step_explain"];
|
||||
stepStatus = json["step_status"];
|
||||
}
|
||||
|
||||
/// 浅拷贝(只复制字段,不生成新 id)
|
||||
PlanStepDto copyWith({
|
||||
int? id,
|
||||
String? stepIcon,
|
||||
String? stepContent,
|
||||
String? stepExplain,
|
||||
int? stepStatus,
|
||||
}) => PlanStepDto(
|
||||
id: id ?? this.id,
|
||||
stepIcon: stepIcon ?? this.stepIcon,
|
||||
stepContent: stepContent ?? this.stepContent,
|
||||
stepExplain: stepExplain ?? this.stepExplain,
|
||||
stepStatus: stepStatus ?? this.stepStatus,
|
||||
);
|
||||
}
|
||||
|
||||
class PlanDetailDto {
|
||||
|
||||
8
lib/api/endpoints/other.dart
Normal file
8
lib/api/endpoints/other.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
import 'package:plan/api/dto/daily_tip_dto.dart';
|
||||
import 'package:plan/api/network/request.dart';
|
||||
|
||||
///获取每日一句列表
|
||||
Future<List<DailyTipDto>> getDailyTipList() async {
|
||||
var res = await Request().get("/daily_tips");
|
||||
return (res as List).map((e) => DailyTipDto.fromJson(e)).toList();
|
||||
}
|
||||
@@ -15,7 +15,7 @@ Future<int> initPlanApi(String need, int agentId) async {
|
||||
|
||||
///保存用户计划
|
||||
Future<void> savePlanApi({
|
||||
required String planId,
|
||||
required int planId,
|
||||
required String summary,
|
||||
required String dialog,
|
||||
required List<PlanStepDto> steps,
|
||||
@@ -45,7 +45,7 @@ Future<void> editPlanSummaryApi(int planId, String summary) async {
|
||||
}
|
||||
|
||||
///获取计划详情
|
||||
Future<PlanDetailDto> getPlanDetailApi(String planId) async {
|
||||
Future<PlanDetailDto> getPlanDetailApi(int planId) async {
|
||||
var res = await Request().get("/plan/plan_detail", {
|
||||
"plan_id": planId,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user