KMMemberProductResult.swift 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. //
  2. // KMMemberProductResult.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by wanjun on 2024/11/4.
  6. //
  7. import Cocoa
  8. class KMMemberProductResult: NSObject {
  9. var code : Int?
  10. var msg : String?
  11. var result : String?
  12. var result_Bool : Bool?
  13. var result_Dict : Bool?
  14. var listingProducts : [KMListingProductsModel]? // 上架中的产品
  15. var batchProductPrice : KMBatchProductPriceModel? // 批量阶段购买价格
  16. var checkCoupon : KMCheckCouponModel? // 商品优惠券
  17. var createOrder : KMCreateOrderModel? // 创建订单(买断、订阅)
  18. /**
  19. @abstract 通用返回字符串
  20. @param code
  21. @param msg
  22. @param result
  23. */
  24. init(code: Int, msg: String, result: String) {
  25. self.code = code
  26. self.msg = msg
  27. self.result = result
  28. }
  29. /**
  30. @abstract 获取上架中的产品
  31. @param code
  32. @param msg
  33. @param listingProducts
  34. */
  35. init(code: Int, msg: String, listingProducts: [KMListingProductsModel]) {
  36. self.code = code
  37. self.msg = msg
  38. self.listingProducts = listingProducts
  39. }
  40. /**
  41. @abstract 批量阶段购买价格
  42. @param code
  43. @param msg
  44. @param batchProductPrice
  45. */
  46. init(code: Int, msg: String, batchProductPrice: KMBatchProductPriceModel) {
  47. self.code = code
  48. self.msg = msg
  49. self.batchProductPrice = batchProductPrice
  50. }
  51. /**
  52. @abstract 商品优惠
  53. @param code
  54. @param msg
  55. @param checkCoupon
  56. */
  57. init(code: Int, msg: String, checkCoupon: KMCheckCouponModel) {
  58. self.code = code
  59. self.msg = msg
  60. self.checkCoupon = checkCoupon
  61. }
  62. /**
  63. @abstract 创建订单(买断、订阅)
  64. @param code
  65. @param msg
  66. @param createOrder
  67. */
  68. init(code: Int, msg: String, createOrder: KMCreateOrderModel) {
  69. self.code = code
  70. self.msg = msg
  71. self.createOrder = createOrder
  72. }
  73. }
  74. class KMListingProductsModel: NSObject {
  75. var id : String = "" // 【可选】id
  76. var productName : String = "" // 【可选】名称
  77. var maxDeviceNum : Int = 0 // 【可选】最大可登录设备数
  78. var levels : String = "" // 【可选】3高级2标准1免费
  79. var platforms : String = "" // 【可选】产品支持平台
  80. var productLineId : Int = 0 // 【可选】所属业务线id (1pdf产品线2compdfkit产品线)
  81. var paymentModel : Int = 0 // 【可选】付费模式(1自动续订 2单次付费)
  82. var cycle : Int = 0 // 【可选】订阅周期:1、月(30天);2、季(90天);3、半年(183天);4、年(365天)
  83. var code : String = "" // 【可选】产品code
  84. var priceString : String? // 【可选】美金价格
  85. var cnyPriceString : String? // 【可选】人民币价格
  86. var displayCnyPriceString : String? // 【可选】人民币优惠价格
  87. var displayPriceString : String? // 【可选】教育优惠价格
  88. var upgradePriceString : String? // 【可选】买断升级订阅价格
  89. var cnyUpgradePriceString : String? // 【可选】买断升级订阅价格
  90. var individualPriceString : String? // 每个单价
  91. var individualCnyPriceString : String? // 每个单价
  92. var totalPrice : String = "" // 【可选】批量购买总价
  93. var cnyTotalPrice : String = "" // 【可选】批量购买优惠总价人民币总价
  94. var verifyofferCode : String = "" // 优惠码
  95. // 优惠卷 价格
  96. var displayAmount: String?
  97. // 优惠卷 价格 [人民币]
  98. var cnyDisplayAmount: String?
  99. init(id: String, productName: String, price: String?, maxDeviceNum: Int, displayPrice: String?, levels: String, platforms: String, productLineId: Int, paymentModel: Int, cycle: Int, cnyPrice: String?, displayCnyPrice: String?, upgradePrice: String?, code: String) {
  100. self.id = id
  101. self.productName = productName
  102. self.priceString = price
  103. self.maxDeviceNum = maxDeviceNum
  104. self.displayPriceString = displayPrice
  105. self.levels = levels
  106. self.platforms = platforms
  107. self.productLineId = productLineId
  108. self.paymentModel = paymentModel
  109. self.cycle = cycle
  110. self.cnyPriceString = cnyPrice
  111. self.displayCnyPriceString = displayCnyPrice
  112. self.upgradePriceString = upgradePrice
  113. self.code = code
  114. self.totalPrice = String(format: "%.2f", Float(price ?? "") ?? 0)
  115. self.cnyTotalPrice = String(format: "%.2f", Float(cnyPrice ?? "") ?? 0)
  116. }
  117. override init() {
  118. }
  119. }
  120. class KMBatchProductPriceModel: NSObject {
  121. var productId : String = "" // 【必需】产品id
  122. var totalPrice : String = "" // 【必需】总价
  123. var price : String = "" // 【必需】总价
  124. var batchPrice : String = "" // 【必需】批量购买优惠后单价
  125. var cnyPrice : String = "" // 【必需】人民币单价
  126. var cnyBatchPrice : String = "" // 【必需】批量购买优惠后人民币单价
  127. var cnyTotalPrice : String = "" // 【必需】cnyTotalPrice
  128. init(productId: String, totalPrice: String, price: String, batchPrice: String, cnyPrice: String, cnyBatchPrice: String, cnyTotalPrice: String) {
  129. self.productId = productId
  130. self.totalPrice = totalPrice
  131. self.price = price
  132. self.batchPrice = batchPrice
  133. self.cnyPrice = cnyPrice
  134. self.cnyBatchPrice = cnyBatchPrice
  135. self.cnyTotalPrice = cnyTotalPrice
  136. }
  137. }
  138. class KMCheckCouponModel: NSObject {
  139. var id : String = "" // 【必需】id
  140. var productName : String = "" // 【必需】名称
  141. var maxDeviceNum : Int = 0 // 【必需】最大可登录设备数
  142. var levels : String = "" // 【必需】3高级2标准1免费
  143. var platforms : String = "" // 【必需】产品支持平台
  144. var productLineId : Int = 0 // 【必需】所属业务线id (1pdf产品线2compdfkit产品线)
  145. var paymentModel : Int = 0 // 【必需】付费模式(1自动续订 2单次付费)
  146. var cycle : Int = 0 // 【必需】订阅周期:1、月(30天);2、季(90天);3、半年(183天);4、年(365天)
  147. var code : String = "" // 【可选】产品code
  148. var priceString : String? // 【必需】价格
  149. var cnyPriceString : String? // 【可选】人民币价格
  150. var displayCnyPriceString : String? // 【可选】人民币优惠价格
  151. var displayPriceString : String? // 【可选】教育优惠价格
  152. var upgradePriceString : String? // 【可选】买断升级订阅价格
  153. var verifyofferCode : String = "" // 优惠码
  154. var upgradecnyPriceString:String?
  155. init(id: String, productName: String, price: String?, maxDeviceNum: Int, displayPrice: String?, levels: String, platforms: String, productLineId: Int, paymentModel: Int, cycle: Int, cnyPrice: String?, displayCnyPrice: String?, upgradePrice: String?, code: String) {
  156. self.id = id
  157. self.productName = productName
  158. self.priceString = price
  159. self.maxDeviceNum = maxDeviceNum
  160. self.displayPriceString = displayPrice
  161. self.levels = levels
  162. self.platforms = platforms
  163. self.productLineId = productLineId
  164. self.paymentModel = paymentModel
  165. self.cycle = cycle
  166. self.cnyPriceString = cnyPrice
  167. self.displayCnyPriceString = displayCnyPrice
  168. self.upgradePriceString = upgradePrice
  169. }
  170. }
  171. /**
  172. 创建 买断/订阅 订单数据模型
  173. */
  174. class KMCreateOrderModel: NSObject {
  175. var thirdOrderNo : String = "" // 【必需】
  176. var orderId : String = "" // 【必需】
  177. var payHref : String = "" // 【必需】
  178. var qrCode : String = "" // 【必需】
  179. init(thirdOrderNo: String, orderId: String, payHref: String, qrCode: String) {
  180. self.thirdOrderNo = thirdOrderNo
  181. self.orderId = orderId
  182. self.payHref = payHref
  183. self.qrCode = qrCode
  184. }
  185. }
  186. /**
  187. 获取订单列表
  188. */
  189. class KMOrderListModel: NSObject {
  190. var id : String = ""
  191. var appId : String = ""
  192. var subscriptionId : String = ""
  193. var tradeNo : String = ""
  194. var thirdOrderNo : String = ""
  195. var price : Int = 0
  196. var payment : Int = 0
  197. var status : Int = 0
  198. var createdAt : String = ""
  199. var updatedAt : String = ""
  200. var result : String = ""
  201. var pagePayUrl : String = ""
  202. var invoiceNo : String = ""
  203. var thirdTradeNo : String = ""
  204. var productId : String = ""
  205. var discount : String = ""
  206. var reducedPrice : String = ""
  207. var isVpp : String = ""
  208. var type : Int = 0
  209. var detailType : String = ""
  210. var userId : String = ""
  211. var email : String = ""
  212. var payNumber : Int = 0
  213. var isEducation : Int = 0
  214. var subscriptionType : Int = 0
  215. var paymentModel : Int = 0
  216. }