站点增加消息入口

This commit is contained in:
2026-01-16 13:06:35 +08:00
parent 9a97b56505
commit fbcc85af2a
3 changed files with 86 additions and 25 deletions

View File

@@ -151,7 +151,7 @@ class SiteController extends GetxController with BaseControllerMixin {
void onInit() {
super.onInit();
renderData();
msgNotice();
startAutoRefresh();
}
@@ -167,6 +167,27 @@ class SiteController extends GetxController with BaseControllerMixin {
searchController.dispose();
super.onClose();
}
bool isNotice = false;
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) {
String total = result.data["total"].toString();
isNotice = int.parse(total) > 0;
updateUi();
}
}
}
void startAutoRefresh() {
// 先停止已存在的定时器,防止重复启动