mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: uploadBfs
This commit is contained in:
@@ -233,13 +233,16 @@ class MsgHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future uploadBfs(
|
||||
static Future uploadBfs({
|
||||
dynamic path,
|
||||
) async {
|
||||
String? category,
|
||||
String? biz,
|
||||
}) async {
|
||||
String csrf = await Request.getCsrf();
|
||||
Map<String, dynamic> data = await WbiSign().makSign({
|
||||
'file_up': await MultipartFile.fromFile(path),
|
||||
'category': 'daily',
|
||||
if (category != null) 'category': category,
|
||||
if (biz != null) 'biz': biz,
|
||||
'csrf': csrf,
|
||||
});
|
||||
var res = await Request().post(
|
||||
|
||||
@@ -269,7 +269,10 @@ class _CreatePanelState extends State<CreatePanel> {
|
||||
pics = [];
|
||||
for (int i = 0; i < _pathList.length; i++) {
|
||||
SmartDialog.showLoading(msg: '正在上传图片: ${i + 1}/${_pathList.length}');
|
||||
dynamic result = await MsgHttp.uploadBfs(_pathList[i]);
|
||||
dynamic result = await MsgHttp.uploadBfs(
|
||||
path: _pathList[i],
|
||||
category: 'daily',
|
||||
);
|
||||
if (result['status']) {
|
||||
int imageSize = await File(_pathList[i]).length();
|
||||
pics.add({
|
||||
|
||||
@@ -477,7 +477,10 @@ class _ReplyPageState extends State<ReplyPage>
|
||||
pictures = [];
|
||||
for (int i = 0; i < _pathList.length; i++) {
|
||||
SmartDialog.showLoading(msg: '正在上传图片: ${i + 1}/${_pathList.length}');
|
||||
dynamic result = await MsgHttp.uploadBfs(_pathList[i]);
|
||||
dynamic result = await MsgHttp.uploadBfs(
|
||||
path: _pathList[i],
|
||||
category: 'daily',
|
||||
);
|
||||
if (result['status']) {
|
||||
int imageSize = await File(_pathList[i]).length();
|
||||
pictures.add({
|
||||
|
||||
@@ -315,7 +315,10 @@ class _WhisperDetailPageState extends State<WhisperDetailPage> {
|
||||
);
|
||||
if (pickedFile != null) {
|
||||
SmartDialog.showLoading(msg: '正在上传图片');
|
||||
dynamic result = await MsgHttp.uploadBfs(pickedFile.path);
|
||||
dynamic result = await MsgHttp.uploadBfs(
|
||||
path: pickedFile.path,
|
||||
biz: 'im',
|
||||
);
|
||||
if (result['status']) {
|
||||
int imageSize = await File(pickedFile.path).length();
|
||||
String mimeType = lookupMimeType(pickedFile.path)
|
||||
|
||||
Reference in New Issue
Block a user