fix: 系统消息标记已读
This commit is contained in:
@ -554,4 +554,8 @@ class Api {
|
|||||||
/// 系统通知
|
/// 系统通知
|
||||||
static const String messageSystemAPi =
|
static const String messageSystemAPi =
|
||||||
'${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify';
|
'${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify';
|
||||||
|
|
||||||
|
/// 系统通知标记已读
|
||||||
|
static const String systemMarkRead =
|
||||||
|
'${HttpString.messageBaseUrl}/x/sys-msg/update_cursor';
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,6 @@ class MsgHttp {
|
|||||||
});
|
});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
try {
|
try {
|
||||||
print(res.data['data']['system_notify_list']);
|
|
||||||
return {
|
return {
|
||||||
'status': true,
|
'status': true,
|
||||||
'data': res.data['data']['system_notify_list']
|
'data': res.data['data']['system_notify_list']
|
||||||
@ -312,4 +311,23 @@ class MsgHttp {
|
|||||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 系统消息标记已读
|
||||||
|
static Future systemMarkRead(int cursor) async {
|
||||||
|
String csrf = await Request.getCsrf();
|
||||||
|
var res = await Request().get(Api.systemMarkRead, data: {
|
||||||
|
'csrf': csrf,
|
||||||
|
'cursor': cursor,
|
||||||
|
});
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,20 @@ class MessageSystemController extends GetxController {
|
|||||||
Future queryMessageSystem({String type = 'init'}) async {
|
Future queryMessageSystem({String type = 'init'}) async {
|
||||||
var res = await MsgHttp.messageSystem();
|
var res = await MsgHttp.messageSystem();
|
||||||
if (res['status']) {
|
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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 标记已读
|
||||||
|
void systemMarkRead(int cursor) async {
|
||||||
|
await MsgHttp.systemMarkRead(cursor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user