fix: 系统消息标记已读

This commit is contained in:
guozhigq
2024-08-25 22:07:42 +08:00
parent 9082f0299d
commit 0803444d74
3 changed files with 36 additions and 2 deletions

View File

@ -8,8 +8,20 @@ class MessageSystemController extends GetxController {
Future queryMessageSystem({String type = 'init'}) async {
var res = await MsgHttp.messageSystem();
if (res['status']) {
systemItems.addAll(res['data']);
if (type == 'init') {
systemItems.value = res['data'];
} else {
systemItems.addAll(res['data']);
}
if (systemItems.isNotEmpty) {
systemMarkRead(systemItems.first.cursor!);
}
}
return res;
}
// 标记已读
void systemMarkRead(int cursor) async {
await MsgHttp.systemMarkRead(cursor);
}
}