消息中心,待测试

This commit is contained in:
2026-01-08 15:33:40 +08:00
parent 7d9c879a4e
commit baee5dba83
5 changed files with 145 additions and 57 deletions

View File

@@ -31,6 +31,7 @@ class MineController extends GetxController with BaseControllerMixin {
}
String rate = "";
String rating = "";
String accident = "";
String historyBreakRules = "";
String vin = "";
@@ -38,6 +39,7 @@ class MineController extends GetxController with BaseControllerMixin {
String violationTotal = "0";
String violationScore = "0";
String violationDispose = "0";
bool isNotice = false;
void renderData() async {
if (StorageService.to.hasVehicleInfo) {
@@ -56,6 +58,8 @@ class MineController extends GetxController with BaseControllerMixin {
_fetchCompletionRate(), // 请求1完成率
_fetchAccidentCount(), // 请求2事故数
_fetchBreakRulesCount(), // 请求3违章数
_rating(), // 司机评分
_msgNotice(), // 红点消息
]);
} catch (e, stackTrace) {
showErrorToast("加载数据失败,请稍后重试 $e");
@@ -65,6 +69,37 @@ class MineController extends GetxController with BaseControllerMixin {
}
}
Future<void> _msgNotice() async {
final Map<String, dynamic> requestData = {
'appFlag': 1,
'isRead': 1,
'pageNum': 1,
'pageSize': 5,
};
final response = await HttpService.to.get(
'appointment/unread_notice/page',
params: requestData,
);
if (response != null) {
final result = BaseModel.fromJson(response.data);
if (result.code == 0 && result.data != null) {
int total = result.data["total"] ?? 0;
isNotice = total > 0;
}
}
}
Future<void> _rating() async {
final response = await HttpService.to.get('appointment/rating/driver');
if (response != null) {
final result = BaseModel.fromJson(response.data);
if (result.code == 0 && result.data != null) {
rating = result.data.toString();
}
}
}
Future<void> _fetchCompletionRate() async {
final response = await HttpService.to.get(
'appointment/orderAddHyd/driverAppointmentCompletionRate?phone=${StorageService.to.phone}',