|
|
|
@ -1,9 +1,11 @@ |
|
|
|
import 'dart:convert'; |
|
|
|
|
|
|
|
import 'package:get/get.dart'; |
|
|
|
import 'package:get_storage/get_storage.dart'; |
|
|
|
|
|
|
|
import '../db/sqflite_api.dart'; |
|
|
|
import '../network/api.dart'; |
|
|
|
import '../../models/user_Info.dart'; |
|
|
|
import 'meeting_upload_service.dart'; |
|
|
|
|
|
|
|
class MeetingTaskService extends GetxService { |
|
|
|
@ -81,6 +83,8 @@ class MeetingTaskService extends GetxService { |
|
|
|
'isdistinguishspeaker': isdistinguishspeaker, |
|
|
|
'templateid': templateid, |
|
|
|
}); |
|
|
|
final seconds = await _getMeetingSeconds(id); |
|
|
|
_decrementMeetingIntegral(cost: seconds); |
|
|
|
_taskList.add({ |
|
|
|
'id': id, |
|
|
|
'tasktype': 1, |
|
|
|
@ -207,4 +211,27 @@ class MeetingTaskService extends GetxService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// 获取会议音频秒数 |
|
|
|
Future<int> _getMeetingSeconds(int id) async { |
|
|
|
try { |
|
|
|
final data = await SqfliteApi.getMeetingDetails(id); |
|
|
|
final v = data['seconds']; |
|
|
|
if (v is int) return v; |
|
|
|
if (v is num) return v.toInt(); |
|
|
|
if (v is String) return int.tryParse(v) ?? 0; |
|
|
|
return 0; |
|
|
|
} catch (_) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// 减少用户会议积分 |
|
|
|
void _decrementMeetingIntegral({required int cost}) { |
|
|
|
if (!User.isLoggedIn()) return; |
|
|
|
if (cost <= 0) return; |
|
|
|
final next = User.instance.meetintegral - cost; |
|
|
|
User.instance.updateUserInfo({'meetintegral': next < 0 ? 0 : next}); |
|
|
|
//GetStorage().write('user_info', User.instance.toJson()); |
|
|
|
} |
|
|
|
} |
|
|
|
|