feat: danmaku api (#1530)

This commit is contained in:
My-Responsitories
2025-10-12 18:41:40 +08:00
committed by GitHub
parent 88d207cc24
commit e5f0742bf6
12 changed files with 426 additions and 20 deletions

View File

@@ -666,4 +666,41 @@ abstract final class LiveHttp {
return Error(res.data['message']);
}
}
static Future<LoadingState<Null>> liveDmReport({
required Object roomId,
required int mid,
required String msg,
required String reason,
required int reasonId,
required String id,
}) async {
final csrf = Accounts.main.csrf;
final data = {
'id': 0,
'roomid': roomId,
'tuid': mid,
'msg': msg,
'reason': reason,
'sign': '',
'reason_id': reasonId,
'token': '',
'dm_type': '0',
'id_str': id,
'csrf_token': csrf,
'csrf': csrf,
'visit_id': '',
'ts': DateTime.now().millisecondsSinceEpoch ~/ 1000,
};
final res = await Request().post(
Api.liveDmReport,
data: data,
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return const Success(null); // {"id": num}
} else {
return Error(res.data['message']);
}
}
}