From 3048e36d2f8697d2758ab22549f2941dc38b1c79 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Thu, 6 Mar 2025 16:27:51 +0800 Subject: [PATCH] mod: requery dm Signed-off-by: bggRGjQaUbCoE --- lib/http/danmaku.dart | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/http/danmaku.dart b/lib/http/danmaku.dart index 74143ab2..8c15a2c1 100644 --- a/lib/http/danmaku.dart +++ b/lib/http/danmaku.dart @@ -9,12 +9,23 @@ class DanmakuHttp { required int cid, required int segmentIndex, required bool mergeDanmaku, + int queryCount = 1, }) async { // 构建参数对象 final response = await GrpcRepo.dmSegMobile(cid: cid, segmentIndex: segmentIndex); if (!response['status']) { - return DmSegMobileReply(); + if (queryCount >= 3) { + return DmSegMobileReply(); + } else { + await Future.delayed(const Duration(seconds: 1)); + return await queryDanmaku( + cid: cid, + segmentIndex: segmentIndex, + mergeDanmaku: mergeDanmaku, + queryCount: ++queryCount, + ); + } } DmSegMobileReply data = response['data']; if (mergeDanmaku && data.elems.isNotEmpty) {