opt: reply err msg

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-30 10:58:31 +08:00
parent 1df6ed8ce2
commit bde7c73424
4 changed files with 6 additions and 6 deletions

View File

@@ -112,6 +112,8 @@ class GrpcRepo {
e.details?.firstOrNull?.getFieldOrNull(2), e.details?.firstOrNull?.getFieldOrNull(2),
allowMalformed: true, allowMalformed: true,
); );
msg = msg.replaceAll(
RegExp(r"[^a-zA-Z0-9\u4e00-\u9fa5,.;!?,。;!?]"), '');
if (msg.isNotEmpty) { if (msg.isNotEmpty) {
return {'status': false, 'msg': msg}; return {'status': false, 'msg': msg};
} else { } else {

View File

@@ -64,7 +64,8 @@ class ReplyHttp {
if (res['status']) { if (res['status']) {
return LoadingState.success(res['data']); return LoadingState.success(res['data']);
} else { } else {
return LoadingState.error(res['msg']); return LoadingState.error(
'${res['msg'].startsWith('gRPC Error') ? '如无法加载评论:\n关闭代理\n或设置中关闭使用gRPC加载评论\n\n' : ''}${res['msg']}');
} }
} }

View File

@@ -40,13 +40,12 @@ class FavVideoCardH extends StatelessWidget {
onTap!(); onTap!();
return; return;
} }
int? seasonId;
String? epId; String? epId;
if (videoItem.ogv != null && if (videoItem.ogv != null &&
(videoItem.ogv['type_name'] == '番剧' || (videoItem.ogv['type_name'] == '番剧' ||
videoItem.ogv['type_name'] == '国创')) { videoItem.ogv['type_name'] == '国创')) {
videoItem.cid = await SearchHttp.ab2c(bvid: bvid); videoItem.cid = await SearchHttp.ab2c(bvid: bvid);
seasonId = videoItem.ogv['season_id']; dynamic seasonId = videoItem.ogv['season_id'];
epId = videoItem.epId; epId = videoItem.epId;
Utils.viewBangumi(seasonId: seasonId, epId: epId); Utils.viewBangumi(seasonId: seasonId, epId: epId);
return; return;
@@ -63,7 +62,6 @@ class FavVideoCardH extends StatelessWidget {
'bvid': bvid, 'bvid': bvid,
'cid': videoItem.cid.toString(), 'cid': videoItem.cid.toString(),
'epId': epId ?? '', 'epId': epId ?? '',
if (seasonId != null) 'seasonId': seasonId.toString(),
}; };
// if (seasonId != null) { // if (seasonId != null) {
// parameters['seasonId'] = seasonId.toString(); // parameters['seasonId'] = seasonId.toString();

View File

@@ -277,8 +277,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
callback: _videoReplyController.onReload, callback: _videoReplyController.onReload,
), ),
Error() => HttpError( Error() => HttpError(
errMsg: errMsg: loadingState.errMsg,
'如无法加载评论:\n1.关闭代理\n2.设置中关闭使用gRPC加载评论\n\n${loadingState.errMsg}',
callback: _videoReplyController.onReload, callback: _videoReplyController.onReload,
), ),
LoadingState() => throw UnimplementedError(), LoadingState() => throw UnimplementedError(),