feat: repost dynamic

This commit is contained in:
bggRGjQaUbCoE
2024-09-30 12:55:22 +08:00
parent 161d3244ba
commit 6077e51a4a
6 changed files with 336 additions and 17 deletions

View File

@@ -619,4 +619,8 @@ class Api {
static const String removeSysMsg = '/x/sys-msg/del_notify_list';
static const String setTop = '/session_svr/v1/session_svr/set_top';
static const String createDynamic = '/x/dynamic/feed/create/dyn';
static const String removeDynamic = '/dynamic_svr/v1/dynamic_svr/rm_dynamic';
}

View File

@@ -143,6 +143,49 @@ class MsgHttp {
}
}
static Future createDynamic({
dynamic mid,
dynamic dynIdStr,
dynamic rawText,
}) async {
String csrf = await Request.getCsrf();
var res = await Request().post(
Api.createDynamic,
queryParameters: {
'platform': 'web',
'csrf': csrf,
'x-bili-device-req-json[platform]': 'web',
'x-bili-device-req-json[device]': 'pc',
'x-bili-web-req-json[spm_id]': 333.999,
},
data: {
"dyn_req": {
"content": {
"contents": [
{"raw_text": rawText, "type": 1, "biz_id": ""}
]
},
"scene": 4,
"attach_card": null,
"upload_id":
"${mid}_${DateTime.now().millisecondsSinceEpoch ~/ 1000}_${Random().nextInt(9000) + 1000}",
"meta": {
"app_meta": {"from": "create.dynamic.web", "mobi_app": "web"}
}
},
"web_repost_src": {"dyn_id_str": dynIdStr}
},
);
if (res.data['code'] == 0) {
return {'status': true};
} else {
return {
'status': false,
'msg': res.data['message'],
};
}
}
static Future removeMsg(
dynamic talkerId,
) async {