// // KMAccountRightModel.swift // PDF Reader Pro // // Created by User-Tangchao on 2024/10/24. // import Cocoa class AccountTrialModel: NSObject { // 试用状态 0为试用已过期 1为试用中 var status: Int = 0 // 已试用天数 var triedDay: Int = 0 // 试用产品序列码 var product_code: String? convenience init(dict: [String : Any]) { self.init() self.status = dict["status"] as? Int ?? 0 self.triedDay = dict["triedDay"] as? Int ?? 0 self.product_code = dict["product_code"] as? String } } class AccountRightInfoModel: NSObject { // 权益产品名称 var name: String? // 是否订阅:0=非订阅,1=订阅中,2=已取消订阅 var automatically_subscribe: Int = 0 // 失效时间戳 -1为永久有效 var failure_time: Int = 0 // 页面显示失效时间 var failure_time_text: String? // 产品类型:1='1-Month Plan',2='1-Year Plan',3='Lifetime Plan' var license_id: Int = 0 // 权益状态:1=有效,2=无效 var status: Int = 0 // sku id var sku_id: Int = 0 // 总设备数量 var total_num: Int = 0 // 剩余设备数量 var surplus_num: Int = 0 // 购买链接 var buy_url: String? // 产品序列码 var product_code: String? convenience init(dict: [String : Any]) { self.init() self.name = dict["name"] as? String self.automatically_subscribe = dict["automatically_subscribe"] as? Int ?? 0 self.failure_time = dict["failure_time"] as? Int ?? 0 self.failure_time_text = dict["failure_time_text"] as? String self.license_id = dict["license_id"] as? Int ?? 0 self.status = dict["status"] as? Int ?? 0 self.sku_id = dict["sku_id"] as? Int ?? 0 self.total_num = dict["total_num"] as? Int ?? 0 self.surplus_num = dict["surplus_num"] as? Int ?? 0 self.buy_url = dict["buy_url"] as? String self.product_code = dict["product_code"] as? String } } class AccountRightModel: NSObject { // 当前设备是否为Vip 0为否 1为是(如果用户只买了win的产品,mac端登录就为0) var isVip: Int = 0 // 当前是否有AI权益 0为无 1为有 var hasAiPermissions: Int = 0 // AI购买链接 var aiBuyUrl: String = "" // 有效权益记录 var rightsInterestsData: [AccountRightInfoModel] = [] // 过期权益记录 var expiredBenefits: [AccountRightInfoModel] = [] // 更多权益产品购买数据 var moreBenefits: [ProductListModel] = [] var trialData: AccountTrialModel? var memberInfo: AccountInfoModel? convenience init(dict: [String : Any]) { self.init() self.isVip = dict["isVip"] as? Int ?? 0 self.hasAiPermissions = dict["hasAiPermissions"] as? Int ?? 0 self.aiBuyUrl = dict["aiBuyUrl"] as? String ?? "" if let info = dict["trialData"] as? [String : Any] { self.trialData = AccountTrialModel(dict: info) } if let info = dict["memberInfo"] as? [String : Any] { self.memberInfo = AccountInfoModel(dict: info) } if let array = dict["rightsInterestsData"] as? [Any] { var datas: [AccountRightInfoModel] = [] for data in array { guard let dict = data as? [String : Any] else { continue } let model = AccountRightInfoModel(dict: dict) datas.append(model) } self.rightsInterestsData = datas } if let array = dict["expiredBenefits"] as? [Any] { var datas: [AccountRightInfoModel] = [] for data in array { guard let dict = data as? [String : Any] else { continue } let model = AccountRightInfoModel(dict: dict) datas.append(model) } self.expiredBenefits = datas } if let array = dict["moreBenefits"] as? [Any] { var datas: [ProductListModel] = [] for data in array { guard let dict = data as? [String : Any] else { continue } let model = ProductListModel(dict: dict) datas.append(model) } self.moreBenefits = datas } } }