383462ef
吴启风
feat: 新增视频专区列表与播放功能
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import 'package:wow_english/common/request/request_client.dart';
import 'package:wow_english/pages/video/zone/video_zone_item.dart';
class VideoDao {
/// 获取已上架的视频列表。
static Future<List<VideoZoneItem>> list() async {
final data = await requestClient.get<List<dynamic>>(Apis.videoList);
return (data ?? const <dynamic>[])
.whereType<Map>()
.map((item) => VideoZoneItem.fromJson(Map<String, dynamic>.from(item)))
.toList();
}
/// 保存视频播放记录。
static Future<void> savePlayRecord({
required int videoId,
required int progressSeconds,
required int durationSeconds,
required bool completed,
}) async {
await requestClient.post(
Apis.videoPlayRecord,
data: {
'videoId': videoId,
'progressSeconds': progressSeconds,
'durationSeconds': durationSeconds,
'completed': completed,
},
);
}
}
|