account_controller.dart 885 B

12345678910111213141516171819202122232425262728293031323334
  1. import 'package:get/get.dart';
  2. import '../../../../utils/device_manager.dart';
  3. class AccountController extends GetxController {
  4. // 是否是会员(true: Premium, false: Free)
  5. final isPremium = true.obs;
  6. // UID
  7. String uid = '';
  8. // Free 用户剩余时间
  9. final freeTime = '01:60:59 / Days';
  10. // Premium 用户有效期
  11. final validTerm = 'Year / 2026-12-12';
  12. // 设备授权数量
  13. final deviceCount = 1;
  14. final maxDeviceCount = 4;
  15. /// 切换会员状态(用于测试)
  16. void togglePremium() {
  17. isPremium.value = !isPremium.value;
  18. }
  19. @override
  20. void onInit() {
  21. super.onInit();
  22. uid = DeviceManager.getCacheDeviceId().length > 12
  23. ? '${DeviceManager.getCacheDeviceId().substring(0, 6)}***${DeviceManager.getCacheDeviceId().substring(DeviceManager.getCacheDeviceId().length - 6)}'
  24. : DeviceManager.getCacheDeviceId();
  25. }
  26. }