From 84f972a3ab8654acc42245d950182e5212f9f255 Mon Sep 17 00:00:00 2001 From: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com> Date: Wed, 15 Oct 2025 15:56:58 +0800 Subject: [PATCH] fix: report --- lib/common/widgets/dialog/report.dart | 4 +++- lib/http/danmaku.dart | 31 ++++++++++----------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/lib/common/widgets/dialog/report.dart b/lib/common/widgets/dialog/report.dart index ee530fe3..413c8359 100644 --- a/lib/common/widgets/dialog/report.dart +++ b/lib/common/widgets/dialog/report.dart @@ -1,5 +1,6 @@ import 'package:PiliPlus/common/widgets/radio_widget.dart'; import 'package:PiliPlus/utils/extension.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; @@ -124,11 +125,12 @@ Future autoWrapReportDialog( Get.back(); SmartDialog.showToast('举报成功'); } else { - SmartDialog.showToast(data['message']); + SmartDialog.showToast(data['message'].toString()); } } catch (e) { SmartDialog.dismiss(); SmartDialog.showToast('提交失败:$e'); + if (kDebugMode) rethrow; } }, child: const Text('确定'), diff --git a/lib/http/danmaku.dart b/lib/http/danmaku.dart index 1a7bca93..107706ba 100644 --- a/lib/http/danmaku.dart +++ b/lib/http/danmaku.dart @@ -125,27 +125,18 @@ abstract final class DanmakuHttp { data: data, options: Options(contentType: Headers.formUrlEncodedContentType), ); - if (res.data['code'] == 0) { - return { - 'status': true, - 'data': res.data['data']['block'], - }; - } else { - return { - 'status': false, - 'msg': res.data['message'], - }; + return res.data as Map; - /// { - /// 0: "举报已提交", - /// "-1": "举报失败,请先激活账号。", - /// "-2": "举报失败,系统拒绝受理您的举报请求。", - /// "-3": "举报失败,您已经被禁言。", - /// "-4": "您的操作过于频繁,请稍后再试。", - /// "-5": "您已经举报过这条弹幕了。", - /// "-6": "举报失败,系统错误。" - /// } - } + /// res.data['data']['block'] + /// { + /// 0: "举报已提交", + /// "-1": "举报失败,请先激活账号。", + /// "-2": "举报失败,系统拒绝受理您的举报请求。", + /// "-3": "举报失败,您已经被禁言。", + /// "-4": "您的操作过于频繁,请稍后再试。", + /// "-5": "您已经举报过这条弹幕了。", + /// "-6": "举报失败,系统错误。" + /// } } static Future> danmakuRecall({