user.dart 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import 'package:freezed_annotation/freezed_annotation.dart';
  2. import 'package:flutter/foundation.dart';
  3. import '../channelplan/channel_plan_list.dart';
  4. part 'user.freezed.dart';
  5. part 'user.g.dart';
  6. @freezed
  7. class User with _$User {
  8. const factory User({
  9. String? country,
  10. String? countryName,
  11. String? userIp,
  12. String? accessToken,
  13. String? refreshToken,
  14. String? accountKey,
  15. String? accountPassword,
  16. int? createTime, // API 返回 int 类型的时间戳
  17. bool? geographyEea,
  18. int? memberLevel, // 1设备用户 2注册用户
  19. int? userLevel, // 1试用 2免费 3会员 9999内部
  20. int? expireTime, // VIP套餐到期时间
  21. int? remainTime, // VIP套餐剩余时间
  22. bool? isExpired, // VIP套餐是否过期
  23. bool? isTestUser, // 是否是测试用户
  24. bool? isSubscribeUser, // 是否是连续订阅用户
  25. Account? account,
  26. //isSubscribeUser=false 时返回最后一次购买套餐信息
  27. //isSubscribeUser=true 时返回当前订阅套餐信息
  28. ChannelPlan? planInfo, // userLevel=3时生效
  29. bool? activated, // 是否激活
  30. }) = _User;
  31. factory User.fromJson(Map<String, Object?> json) => _$UserFromJson(json);
  32. }
  33. @freezed
  34. class Account with _$Account {
  35. const factory Account({
  36. String? username,
  37. String? phone,
  38. String? email,
  39. String? wechat,
  40. String? qq,
  41. String? google,
  42. String? apple,
  43. }) = _Account;
  44. factory Account.fromJson(Map<String, Object?> json) =>
  45. _$AccountFromJson(json);
  46. }