Skip to content

Commit be4740c

Browse files
committed
切换驱动类型附件字幕URL为读取url接口
1 parent aed2d21 commit be4740c

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

CHANGELOG.MD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
更新日志文档,版本顺序从新到旧,最新版本在最前(上)面。
44

5+
# 1.4.4
6+
PS: 需要服务端版本 >= 1.0.4
7+
8+
- 切换驱动类型附件字幕URL为读取url接口
9+
510
# 1.4.3
611
PS: 需要服务端版本 >= 1.0.4
712

lib/api/attachment/AttachmentApi.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,23 @@ class AttachmentApi {
6161
return "";
6262
}
6363
}
64+
65+
66+
Future<String> findDownUrlByAttachmentId(int attachmentId) async {
67+
String apiUrl =
68+
"/api/v1alpha1/attachment/url/download/id/$attachmentId";
69+
try {
70+
// print("queryParams: $queryParams");
71+
Dio dio = await DioClient.getDio();
72+
var response = await dio.get(apiUrl);
73+
// print("response status code: ${response.statusCode}");
74+
if (response.statusCode != 200) {
75+
return "";
76+
}
77+
return response.data;
78+
} catch (e) {
79+
print(e);
80+
return "";
81+
}
82+
}
6483
}

lib/subject/episode.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,11 @@ class _SubjectEpisodesState extends State<SubjectEpisodesPage> {
186186
var subUrl = '';
187187
if (element.url.startsWith("http")) {
188188
subUrl = element.url;
189-
} else {
189+
} else if(element.url.startsWith("/")) {
190190
subUrl = _apiBaseUrl + element.url;
191+
} else {
192+
// 诸如网盘文件提取码这种情况
193+
subUrl = await AttachmentApi().findDownUrlByAttachmentId(element.attachmentId);
191194
}
192195
subtitleUrls.add(subUrl);
193196
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: ikaros
22
description: ikaros app by flutter
3-
version: 1.4.3
3+
version: 1.4.4
44

55
environment:
66
sdk: '>=2.18.4 <=3.10.5'

0 commit comments

Comments
 (0)