member_status_info.dart 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import 'package:intl/intl.dart';
  2. import 'package:location/resource/string.gen.dart';
  3. class MemberStatusInfo {
  4. final String? userId;
  5. final bool? trialed;
  6. final int level;
  7. final int endTimestamp;
  8. final bool expired;
  9. final bool permanent;
  10. final int? startTimestamp;
  11. final int? serverTimestamp;
  12. final String? subscriptionGroup;
  13. final int? autoRenewStatus;
  14. final bool? subscriptionExpired;
  15. final String? avatar;
  16. final int? trialEndTimestamp;
  17. MemberStatusInfo({
  18. required this.level,
  19. required this.endTimestamp,
  20. required this.expired,
  21. required this.permanent,
  22. this.userId,
  23. this.trialed,
  24. this.startTimestamp,
  25. this.serverTimestamp,
  26. this.subscriptionGroup,
  27. this.autoRenewStatus,
  28. this.subscriptionExpired,
  29. this.avatar,
  30. this.trialEndTimestamp
  31. });
  32. /// 获取会员等级描述
  33. static String getLevelDesc(MemberStatusInfo? info) {
  34. if (info == null || info.expired == true) {
  35. return "";//'未开通';
  36. }
  37. if (info.level > 0 && info.level < 100) {
  38. return '试用会员';
  39. }
  40. // 根据等级返回描述
  41. switch (info.level) {
  42. case 0:
  43. return "";//'未开通';
  44. case 100:
  45. return '日卡会员';
  46. case 700:
  47. return '周卡会员';
  48. case 3100:
  49. return '月度会员';
  50. case 9200:
  51. return '季度会员';
  52. case 36600:
  53. return '年度会员';
  54. case 3660000:
  55. return '终身会员';
  56. default:
  57. return "";//'未知会员等级';
  58. }
  59. }
  60. }