KMMemberProductResult.swift 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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 price : NSNumber = NSNumber(value: 0.0) // 【可选】美金价格
  85. var cnyPrice : NSNumber = NSNumber(value: 0.0) // 【可选】人民币价格
  86. var displayCnyPrice : NSNumber = NSNumber(value: 0.0) // 【可选】人民币优惠价格
  87. var displayPrice : NSNumber = NSNumber(value: 0.0) // 【可选】教育优惠价格
  88. var upgradePrice : NSNumber = NSNumber(value: 0.0) // 【可选】买断升级订阅价格
  89. var totalPrice : String = "" // 【可选】批量购买总价
  90. var cnyTotalPrice : String = "" // 【可选】批量购买总价人民币总价
  91. init(id: String, productName: String, price: NSNumber, maxDeviceNum: Int, displayPrice: NSNumber, levels: String, platforms: String, productLineId: Int, paymentModel: Int, cycle: Int, cnyPrice: NSNumber, displayCnyPrice: NSNumber, upgradePrice: NSNumber, code: String) {
  92. self.id = id
  93. self.productName = productName
  94. self.price = price
  95. self.maxDeviceNum = maxDeviceNum
  96. self.displayPrice = displayPrice
  97. self.levels = levels
  98. self.platforms = platforms
  99. self.productLineId = productLineId
  100. self.paymentModel = paymentModel
  101. self.cycle = cycle
  102. self.cnyPrice = cnyPrice
  103. self.displayCnyPrice = displayCnyPrice
  104. self.upgradePrice = upgradePrice
  105. self.code = code
  106. self.totalPrice = String(format: "%.2@", price)
  107. self.cnyTotalPrice = String(format: "%.2@", cnyPrice)
  108. }
  109. override init() {
  110. }
  111. }
  112. class KMBatchProductPriceModel: NSObject {
  113. var productId : String = "" // 【必需】产品id
  114. var totalPrice : String = "" // 【必需】总价
  115. var price : String = "" // 【必需】总价
  116. var batchPrice : String = "" // 【必需】批量购买优惠后单价
  117. var cnyPrice : String = "" // 【必需】人民币单价
  118. var cnyBatchPrice : String = "" // 【必需】批量购买优惠后人民币单价
  119. var cnyTotalPrice : String = "" // 【必需】cnyTotalPrice
  120. init(productId: String, totalPrice: String, price: String, batchPrice: String, cnyPrice: String, cnyBatchPrice: String, cnyTotalPrice: String) {
  121. self.productId = productId
  122. self.totalPrice = totalPrice
  123. self.price = price
  124. self.batchPrice = batchPrice
  125. self.cnyPrice = cnyPrice
  126. self.cnyBatchPrice = cnyBatchPrice
  127. self.cnyTotalPrice = cnyTotalPrice
  128. }
  129. }
  130. class KMCheckCouponModel: NSObject {
  131. var id : String = "" // 【必需】id
  132. var productName : String = "" // 【必需】名称
  133. var maxDeviceNum : Int = 0 // 【必需】最大可登录设备数
  134. var levels : String = "" // 【必需】3高级2标准1免费
  135. var platforms : String = "" // 【必需】产品支持平台
  136. var productLineId : Int = 0 // 【必需】所属业务线id (1pdf产品线2compdfkit产品线)
  137. var paymentModel : Int = 0 // 【必需】付费模式(1自动续订 2单次付费)
  138. var cycle : Int = 0 // 【必需】订阅周期:1、月(30天);2、季(90天);3、半年(183天);4、年(365天)
  139. var code : String = "" // 【可选】产品code
  140. var price : NSNumber = NSNumber(value: 0.0) // 【必需】价格
  141. var cnyPrice : NSNumber = NSNumber(value: 0.0) // 【可选】人民币价格
  142. var displayCnyPrice : NSNumber = NSNumber(value: 0.0) // 【可选】人民币优惠价格
  143. var displayPrice : NSNumber = NSNumber(value: 0.0) // 【可选】教育优惠价格
  144. var upgradePrice : NSNumber = NSNumber(value: 0.0) // 【可选】买断升级订阅价格
  145. init(id: String, productName: String, price: NSNumber, maxDeviceNum: Int, displayPrice: NSNumber, levels: String, platforms: String, productLineId: Int, paymentModel: Int, cycle: Int, cnyPrice: NSNumber, displayCnyPrice: NSNumber, upgradePrice: NSNumber, code: String) {
  146. self.id = id
  147. self.productName = productName
  148. self.price = price
  149. self.maxDeviceNum = maxDeviceNum
  150. self.displayPrice = displayPrice
  151. self.levels = levels
  152. self.platforms = platforms
  153. self.productLineId = productLineId
  154. self.paymentModel = paymentModel
  155. self.cycle = cycle
  156. self.cnyPrice = cnyPrice
  157. self.displayCnyPrice = displayCnyPrice
  158. self.upgradePrice = upgradePrice
  159. }
  160. }
  161. /**
  162. 创建 买断/订阅 订单数据模型
  163. */
  164. class KMCreateOrderModel: NSObject {
  165. var thirdOrderNo : String = "" // 【必需】
  166. var orderId : String = "" // 【必需】
  167. var payHref : String = "" // 【必需】
  168. init(thirdOrderNo: String, orderId: String, payHref: String) {
  169. self.thirdOrderNo = thirdOrderNo
  170. self.orderId = orderId
  171. self.payHref = payHref
  172. }
  173. }
  174. /**
  175. 获取订单列表
  176. */
  177. class KMOrderListModel: NSObject {
  178. var id : String = ""
  179. var appId : String = ""
  180. var subscriptionId : String = ""
  181. var tradeNo : String = ""
  182. var thirdOrderNo : String = ""
  183. var price : Int = 0
  184. var payment : Int = 0
  185. var status : Int = 0
  186. var createdAt : String = ""
  187. var updatedAt : String = ""
  188. var result : String = ""
  189. var pagePayUrl : String = ""
  190. var invoiceNo : String = ""
  191. var thirdTradeNo : String = ""
  192. var productId : String = ""
  193. var discount : String = ""
  194. var reducedPrice : String = ""
  195. var isVpp : String = ""
  196. var type : Int = 0
  197. var detailType : String = ""
  198. var userId : String = ""
  199. var email : String = ""
  200. var payNumber : Int = 0
  201. var isEducation : Int = 0
  202. var subscriptionType : Int = 0
  203. var paymentModel : Int = 0
  204. }