feat: 系统消息
This commit is contained in:
@ -548,4 +548,8 @@ class Api {
|
||||
|
||||
/// 收到的赞
|
||||
static const String messageLikeAPi = '/x/msgfeed/like';
|
||||
|
||||
/// 系统通知
|
||||
static const String messageSystemAPi =
|
||||
'${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify';
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ class HttpString {
|
||||
static const String appBaseUrl = 'https://app.bilibili.com';
|
||||
static const String liveBaseUrl = 'https://api.live.bilibili.com';
|
||||
static const String passBaseUrl = 'https://passport.bilibili.com';
|
||||
static const String messageBaseUrl = 'https://message.bilibili.com';
|
||||
static const List<int> validateStatusCodes = [
|
||||
302,
|
||||
304,
|
||||
|
@ -3,6 +3,7 @@ import 'dart:math';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:pilipala/models/msg/like.dart';
|
||||
import 'package:pilipala/models/msg/reply.dart';
|
||||
import 'package:pilipala/models/msg/system.dart';
|
||||
import '../models/msg/account.dart';
|
||||
import '../models/msg/session.dart';
|
||||
import '../utils/wbi_sign.dart';
|
||||
@ -149,7 +150,7 @@ class MsgHttp {
|
||||
'msg[msg_status]': 0,
|
||||
'msg[content]': jsonEncode(content),
|
||||
'msg[timestamp]': DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||
'msg[new_face_version]': 0,
|
||||
'msg[new_face_version]': 1,
|
||||
'msg[dev_id]': getDevId(),
|
||||
'from_firework': 0,
|
||||
'build': 0,
|
||||
@ -287,4 +288,28 @@ class MsgHttp {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
|
||||
static Future messageSystem() async {
|
||||
var res = await Request().get(Api.messageSystemAPi, data: {
|
||||
'csrf': await Request.getCsrf(),
|
||||
'page_size': 20,
|
||||
'build': 0,
|
||||
'mobi_app': 'web',
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
try {
|
||||
print(res.data['data']['system_notify_list']);
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data']['system_notify_list']
|
||||
.map<MessageSystemModel>((e) => MessageSystemModel.fromJson(e))
|
||||
.toList(),
|
||||
};
|
||||
} catch (err) {
|
||||
return {'status': false, 'date': [], 'msg': err.toString()};
|
||||
}
|
||||
} else {
|
||||
return {'status': false, 'date': [], 'msg': res.data['message']};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user