feat: 删除已观看历史记录 issues #81

This commit is contained in:
guozhigq
2023-09-11 17:36:05 +08:00
parent 0e39453558
commit ef38844798
5 changed files with 67 additions and 4 deletions

View File

@ -121,4 +121,24 @@ class HistoryController extends GetxController {
},
);
}
// 删除某条历史记录
Future delHistory(kid) async {
var res = await UserHttp.delHistory(kid);
if (res['status']) {
historyList.removeWhere((e) => e.kid == kid);
SmartDialog.showToast(res['msg']);
}
}
// 删除已看历史记录
Future onDelHistory() async {
List<HisListItem> result =
historyList.where((e) => e.progress == -1).toList();
for (HisListItem i in result) {
await UserHttp.delHistory(i.kid);
historyList.removeWhere((e) => e.kid == i.kid);
}
SmartDialog.showToast('操作完成');
}
}