From 4b176f5c2cf07600780a880403f48f9428951b5f Mon Sep 17 00:00:00 2001 From: tanlongsheng <252620078@qq.com> Date: Wed, 9 Jul 2025 14:59:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8A=E4=BC=A0=E9=9F=B3?= =?UTF-8?q?=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/meeting/meeting_upload_service.dart | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/data/services/meeting/meeting_upload_service.dart b/lib/data/services/meeting/meeting_upload_service.dart index 294a13bd4..85ac61dac 100644 --- a/lib/data/services/meeting/meeting_upload_service.dart +++ b/lib/data/services/meeting/meeting_upload_service.dart @@ -1,10 +1,13 @@ import 'package:get/get.dart'; +import 'package:get_storage/get_storage.dart'; import '../../../core/utils/logger.dart'; import '../../../core/utils/upload_oss.dart'; import '../db/sqflite_api.dart'; class MeetingUploadService extends GetxService { + final GetStorage _storage = GetStorage(); + RxInt meetingId = 0.obs; RxDouble uploadProgress = 0.0.obs; RxList uploadList = [].obs; @@ -18,7 +21,10 @@ class MeetingUploadService extends GetxService { _getUploadList(); } - void _getUploadList() {} + void _getUploadList() { + uploadList.value = _storage.read("upload_list") ?? []; + _executeUpload(); + } void addUpload(int id, String filePath, String rootDir) async { uploadList.add({ @@ -27,6 +33,11 @@ class MeetingUploadService extends GetxService { 'rootdir': rootDir, 'audiourl': '', }); + _storage.write("upload_list", uploadList); + _executeUpload(); + } + + void _executeUpload() async { if (_isUpload) return; _isUpload = true; _handled = 0; @@ -48,6 +59,8 @@ class MeetingUploadService extends GetxService { {'audiourl': audiourl}, ); element['audiourl'] = audiourl; + uploadProgress.value = 0.0; + _storage.write("upload_list", uploadList); } catch (e) { Logger.error('Upload failed: $e'); } @@ -65,6 +78,7 @@ class MeetingUploadService extends GetxService { if (uploadData.isNotEmpty) { if (isDeleteTask || uploadData['audiourl'].isNotEmpty) { uploadList.remove(uploadData); + _storage.write("upload_list", uploadList); if (uploadList.isEmpty) { _handled = 0; }