KMMemberCenterResult.swift 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. //
  2. // KMMemberCenterResult.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by wanjun on 2024/10/21.
  6. //
  7. import Cocoa
  8. @objcMembers
  9. class KMMemberCenterResult: NSObject {
  10. var code : Int = 0
  11. var msg : String?
  12. var result : Bool?
  13. var login_Result : KMMemberLoginResult? // 登录
  14. var deviceList_Result : [KMMemberDeviceList]? // 设备列表
  15. var maxDeviceNum : Int? // 设备限制数
  16. var resultStr : String?
  17. var resultInt : Int?
  18. var userInfo : KMMemberUserInfo? //用户信息
  19. var activeVIPs : [KMMemberUserInfoActiveVIP]? // 当前会员状况
  20. var logOff: KMMemberLogOff? // 手动注销
  21. /**
  22. @abstract 新会员系统重置密码 & 验证邮箱(重置密码) & 获取邮箱验证码 & 实时检查邮件验证码
  23. @param code
  24. @param msg
  25. @param result
  26. */
  27. init(code: Int, msg: String, result: Bool) {
  28. self.code = code
  29. self.msg = msg
  30. self.result = result
  31. }
  32. // 邮箱登录
  33. /**
  34. @abstract 邮箱登录
  35. @param code
  36. @param msg
  37. @param result
  38. */
  39. init(loginResult: KMMemberLoginResult) {
  40. self.login_Result = loginResult
  41. }
  42. // 登出用户的指定设备
  43. init(code: Int, msg: String, resultStr: String) {
  44. self.code = code
  45. self.msg = msg
  46. self.resultStr = resultStr
  47. }
  48. // 老带新已邀请人数
  49. init(code: Int, msg: String, resultInt: Int) {
  50. self.code = code
  51. self.msg = msg
  52. self.resultInt = resultInt
  53. }
  54. // 获取用户登录设备列表
  55. init(deviceListResult: [KMMemberDeviceList], maxDeviceNum: Int) {
  56. self.deviceList_Result = deviceListResult
  57. self.maxDeviceNum = maxDeviceNum
  58. }
  59. /**
  60. @abstract 获取用户个人信息
  61. @param complete 回调
  62. */
  63. init(code: Int, msg: String, userInfo: KMMemberUserInfo) {
  64. self.code = code
  65. self.msg = msg
  66. self.userInfo = userInfo
  67. }
  68. /**
  69. @abstract 获取用户当前的会员情况
  70. @param code 返回值
  71. @param msg 返回信息
  72. @param activeVIPs 用户当前的会员情况
  73. */
  74. init(code: Int, msg: String, activeVIPs: [KMMemberUserInfoActiveVIP]) {
  75. self.code = code
  76. self.msg = msg
  77. self.activeVIPs = activeVIPs
  78. }
  79. /**
  80. @abstract 用户手动注销
  81. @param code 返回值
  82. @param msg 返回信息
  83. @param logOff 手动注销时间
  84. */
  85. init(code: Int, msg: String, logOff: KMMemberLogOff) {
  86. self.code = code
  87. self.msg = msg
  88. self.logOff = logOff
  89. }
  90. }
  91. class KMMemberLoginResult: NSObject {
  92. var refreshToken : String?
  93. var accessToken : String?
  94. var tokenType : String?
  95. var expiresIn : String?
  96. var scope : String?
  97. init(refreshToken: String, accessToken: String, tokenType: String, expiresIn: String, scope: String = "") {
  98. self.refreshToken = refreshToken
  99. self.accessToken = accessToken
  100. self.tokenType = tokenType
  101. self.expiresIn = expiresIn
  102. self.scope = scope
  103. }
  104. }
  105. class KMMemberDeviceList: NSObject {
  106. var id: String? // 解绑时需要
  107. var deviceId: String? // 设备Id
  108. var productId: String? // 产品Id
  109. var uniqueSn: String? // 设备唯一标识
  110. var appId: String? // appId
  111. var userId: String?
  112. var device_model: String?
  113. var device_os: String?
  114. var deviceName: String?
  115. var language: String?
  116. var timeZone: String?
  117. var appVersion: String?
  118. var platform: String?
  119. var updatedAt: String?
  120. var createdAt: String?
  121. var validFlag: String?
  122. init(deviceId: String?, productId: String?, uniqueSn: String?, appId: String?, userId: String? = "", device_model: String? = "", device_os: String? = "", deviceName: String? = "", language: String? = "", timeZone: String? = "", appVersion: String? = "", platform: String? = "", updatedAt: String? = "", createdAt: String? = "", validFlag: String? = "") {
  123. self.deviceId = deviceId
  124. self.productId = productId
  125. self.uniqueSn = uniqueSn
  126. self.appId = appId
  127. self.userId = userId
  128. self.device_model = device_model
  129. self.device_os = device_os
  130. self.deviceName = deviceName
  131. self.language = language
  132. self.timeZone = timeZone
  133. self.appVersion = appVersion
  134. self.platform = platform
  135. self.updatedAt = updatedAt
  136. self.createdAt = createdAt
  137. self.validFlag = validFlag
  138. }
  139. }
  140. class KMMemberUserInfo: NSObject {
  141. var id : String = "" // 【必需】用户id
  142. var email : String = "" // 【必需】邮箱
  143. var fullName : String = "" // 【必需】名称
  144. var activeVIP : [KMMemberUserInfoActiveVIP] = [] // 【必需】活跃的会员
  145. var activeAI : [KMMemberUserInfoActiveVIP] = [] // 【必需】活跃的AI
  146. var aiPoint : Int = 0 // 【必需】ai点数
  147. var validFlag : String = "" // 【必需】注销(0), * 正常(1), * 停用(2), * 注销中(5);
  148. // var isHavePwd : String = "" // 【必需】1是0否 是否设置了密码
  149. var isHaveAIDiscount: String = "" // 【必需】1是0否 是否有ai折扣
  150. var canTrail : String = "" // 【必需】1是0否 是否能试用
  151. var avatarUrl: String = "" // 头像
  152. var isFreeAccount: String = "" // 是不是免费账号 1是0否 【新用户】
  153. init(id: String = "", email: String = "", fullName: String = "", activeVIP: [KMMemberUserInfoActiveVIP] = [], activeAI: [KMMemberUserInfoActiveVIP] = [], aiPoint: Int = 0, validFlag: String = ""/*, isHavePwd: String = ""*/, isHaveAIDiscount: String = "", canTrail: String = "") {
  154. self.id = id
  155. self.email = email
  156. self.fullName = fullName
  157. self.activeVIP = activeVIP
  158. self.activeAI = activeAI
  159. self.aiPoint = aiPoint
  160. self.validFlag = validFlag
  161. // self.isHavePwd = isHavePwd
  162. self.isHaveAIDiscount = isHaveAIDiscount
  163. self.canTrail = canTrail
  164. }
  165. }
  166. class KMMemberUserInfoActiveVIP: NSObject {
  167. var id : String = "" // 【可选】id
  168. var userId : String = "" // 【可选】用户id
  169. var status : Int = 0 // 【可选】状态 0注册1订阅中2订阅过期3试用中4试用过期
  170. var endDate : String = "" // 【可选】到期时间
  171. var payType : Int = 0 // 【可选】0未开启自动续订 1自动续订
  172. var productName : String = "" // 【可选】产品名字
  173. var levels : String = "" // 【可选】会员等级 1是免费 2是标准 3是高级
  174. var platforms : String = "" // 【可选】支持的平台
  175. var point : Int = 0 // 【可选】剩余ai点数(svip才有)
  176. var maxDeviceNum : Int = 0 // 【可选】最大登录设备限制数
  177. var paymentModel : String = "" // 【可选】支付方式 付费模式(1自动续订(vip svip) 2单次付费(永久会员))
  178. var isAi : String = "" // 【可选】是否是ai产品(0否1是)
  179. var cycle : Int = 0 // 【必需】订阅周期:1、月(30天);2、季(90天);3、半年(183天);4、年(365天)
  180. var isTrail : String = "" // 【可选】是否是试用订阅
  181. var trailDays : Int = 0 // 【可选】试用订阅状态的时候展示登录天数
  182. convenience init(dict: [String : Any]) {
  183. self.init()
  184. self.id = dict["id"] as? String ?? ""
  185. self.userId = dict["userId"] as? String ?? ""
  186. self.status = dict["status"] as? Int ?? 0
  187. self.endDate = dict["endDate"] as? String ?? ""
  188. self.payType = dict["payType"] as? Int ?? 0
  189. self.productName = dict["productName"] as? String ?? ""
  190. self.levels = dict["levels"] as? String ?? ""
  191. self.platforms = dict["platforms"] as? String ?? ""
  192. self.point = dict["point"] as? Int ?? 0
  193. self.maxDeviceNum = dict["maxDeviceNum"] as? Int ?? 0
  194. self.paymentModel = dict["paymentModel"] as? String ?? ""
  195. self.isAi = dict["isAi"] as? String ?? ""
  196. self.cycle = dict["cycle"] as? Int ?? 0
  197. self.isTrail = dict["isTrail"] as? String ?? ""
  198. self.trailDays = dict["trailDays"] as? Int ?? 0
  199. }
  200. }
  201. class KMMemberLogOff: NSObject {
  202. var currentTime : String? // 【必需】id
  203. var logOffTime : String? // 【必需】用户id
  204. init(currentTime: String? = "", logOffTime: String? = "") {
  205. self.currentTime = currentTime
  206. self.logOffTime = logOffTime
  207. }
  208. }