mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 私信已读状态更新+补充部分api
This commit is contained in:
@@ -328,7 +328,22 @@ class Api {
|
||||
// 获取指定分组下的up
|
||||
static const String followUpGroup = '/x/relation/tag';
|
||||
|
||||
// 获取消息中心未读信息
|
||||
static const String msgFeedUnread = '/x/msgfeed/unread';
|
||||
//https://api.bilibili.com/x/msgfeed/reply?platform=web&build=0&mobi_app=web
|
||||
static const String msgFeedReply = '/x/msgfeed/reply';
|
||||
//https://api.bilibili.com/x/msgfeed/at?platform=web&build=0&mobi_app=web
|
||||
static const String msgFeedAt = '/x/msgfeed/at';
|
||||
//https://api.bilibili.com/x/msgfeed/like?platform=web&build=0&mobi_app=web
|
||||
static const String msgFeedLike = '/x/msgfeed/like';
|
||||
//https://message.bilibili.com/x/sys-msg/query_user_notify?csrf=31b0caa533cea4d1a1bd2e921f045ec6&csrf=31b0caa533cea4d1a1bd2e921f045ec6&page_size=20&build=0&mobi_app=web
|
||||
static const String msgSysUserNotify = '${HttpString.messageBaseUrl}/x/sys-msg/query_user_notify';
|
||||
//https://message.bilibili.com/x/sys-msg/query_unified_notify?csrf=31b0caa533cea4d1a1bd2e921f045ec6&csrf=31b0caa533cea4d1a1bd2e921f045ec6&page_size=10&build=0&mobi_app=web
|
||||
static const String msgSysUnifiedNotify = '${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify';
|
||||
|
||||
// 系统信息光标更新(已读标记)
|
||||
//https://message.bilibili.com/x/sys-msg/update_cursor?csrf=31b0caa533cea4d1a1bd2e921f045ec6&csrf=31b0caa533cea4d1a1bd2e921f045ec6&cursor=1705288500000000000&has_up=0&build=0&mobi_app=web
|
||||
static const String msgSysUpdateCursor = '${HttpString.messageBaseUrl}/x/sys-msg/update_cursor';
|
||||
|
||||
/// 私聊
|
||||
/// 'https://api.vc.bilibili.com/session_svr/v1/session_svr/get_sessions?
|
||||
@@ -372,7 +387,7 @@ class Api {
|
||||
/// mobi_app: web
|
||||
/// csrf_token:
|
||||
/// csrf:
|
||||
static const String updateAck =
|
||||
static const String ackSessionMsg =
|
||||
'${HttpString.tUrl}/session_svr/v1/session_svr/update_ack';
|
||||
|
||||
// 获取某个动态详情
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -102,4 +102,35 @@ class MsgHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future ackSessionMsg({
|
||||
int? talkerId,
|
||||
int? ackSeqno,
|
||||
}) async {
|
||||
String csrf = await Request.getCsrf();
|
||||
Map params = await WbiSign().makSign({
|
||||
'talker_id': talkerId,
|
||||
'session_type': 1,
|
||||
'ack_seqno': ackSeqno,
|
||||
'build': 0,
|
||||
'mobi_app': 'web',
|
||||
'csrf_token': csrf,
|
||||
'csrf': csrf
|
||||
});
|
||||
var res = await Request().get(Api.ackSessionMsg, data: params);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'date': [],
|
||||
'msg': "message: ${res.data['message']},"
|
||||
" msg: ${res.data['msg']},"
|
||||
" code: ${res.data['code']}",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/msg.dart';
|
||||
import 'package:pilipala/models/msg/session.dart';
|
||||
@@ -25,4 +26,19 @@ class WhisperDetailController extends GetxController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Future ackSessionMsg() async {
|
||||
if (messageList.isEmpty){
|
||||
return;
|
||||
}
|
||||
var res = await MsgHttp.ackSessionMsg(
|
||||
talkerId: talkerId,
|
||||
ackSeqno: messageList.last.msgSeqno,
|
||||
);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast("已读成功");
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ class _WhisperDetailPageState extends State<WhisperDetailPage> {
|
||||
final Map data = snapshot.data as Map;
|
||||
if (data['status']) {
|
||||
List messageList = _whisperDetailController.messageList;
|
||||
_whisperDetailController.ackSessionMsg();
|
||||
return Obx(
|
||||
() => messageList.isEmpty
|
||||
? const SizedBox()
|
||||
|
||||
Reference in New Issue
Block a user