2 次代码提交 2df1b5b3c4 ... c86df112e4

作者 SHA1 备注 提交日期
  zenghong c86df112e4 Merge branch 'develop_PDFReaderPro_V4.7.0' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderPro_V4.7.0 1 周之前
  zenghong 38b6211c24 【会员系统】DMG 所有可购买商品解析数据结构修改&Crash兼容 1 周之前

+ 19 - 17
PDF Office/PDF Master/MemberCenter/Model/KMMemberCenterManager.swift

@@ -858,7 +858,7 @@ class KMMemberCenterManager: NSObject {
             for dict1 in result_Array {
                 var id = ""
                 var productName = ""
-                var price = ""
+                var price = NSNumber(value: 0.0)
                 var maxDeviceNum = 0
                 var levels = ""
                 var platforms = ""
@@ -866,18 +866,20 @@ class KMMemberCenterManager: NSObject {
                 var paymentModel = 0
                 var cycle = 0
                 var code = ""
-                var cnyPrice = ""
-                if let token = dict1["id"] as? String { id = token }
-                if let token = dict1["productName"] as? String { productName = token }
-                if let token = dict1["price"] as? Double { price = String(format: "%.2f", token) }
-                if let token = dict1["maxDeviceNum"] as? Int { maxDeviceNum = token }
-                if let token = dict1["levels"] as? String { levels = token }
-                if let token = dict1["platforms"] as? String { platforms = token }
-                if let token = dict1["productLineId"] as? Int { productLineId = token }
-                if let token = dict1["paymentModel"] as? Int { paymentModel = token }
-                if let token = dict1["cycle"] as? Int { cycle = token }
-                if let token = dict1["code"] as? String { code = token }
-                if let token = dict1["cnyPrice"] as? String { cnyPrice = token }
+                var cnyPrice = NSNumber(value: 0.0)
+                
+                if let token = dict1["id"] { id = token as? String ?? id }
+                if let token = dict1["productName"] { productName = token as? String ?? productName }
+                if let token = dict1["price"] { price = token as? NSNumber ?? price }
+                if let token = dict1["maxDeviceNum"] { maxDeviceNum = token as? Int ?? maxDeviceNum }
+                if let token = dict1["levels"] { levels = token as? String ?? levels }
+                if let token = dict1["platforms"] { platforms = token as? String ?? platforms }
+                if let token = dict1["productLineId"] { productLineId = token as? Int ?? productLineId }
+                if let token = dict1["paymentModel"] { paymentModel = token as? Int ?? paymentModel }
+                if let token = dict1["cycle"] { cycle = token as? Int ?? cycle }
+                if let token = dict1["code"] { code = token as? String ?? code  }
+                if let token = dict1["cnyPrice"] { cnyPrice = token as? NSNumber ?? cnyPrice }
+
                 let products = KMListingProductsModel(id: id, productName: productName, price: price, maxDeviceNum: maxDeviceNum, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, code: code, cnyPrice: cnyPrice)
                 results.append(products)
             }
@@ -926,7 +928,7 @@ class KMMemberCenterManager: NSObject {
             for dict1 in result_Array {
                 var id = ""
                 var productName = ""
-                var price = ""
+                var price = NSNumber(value: 0.0)
                 var maxDeviceNum = 0
                 var levels = ""
                 var platforms = ""
@@ -934,10 +936,10 @@ class KMMemberCenterManager: NSObject {
                 var paymentModel = 0
                 var cycle = 0
                 var code = ""
-                var cnyPrice = ""
+                var cnyPrice = NSNumber(value: 0.0)
                 if let token = dict1["id"] { id = token as! String }
                 if let token = dict1["productName"] { productName = token as! String }
-                if let token = dict1["price"] { price = token as! String }
+                if let token = dict1["price"] { price = token as! NSNumber }
                 if let token = dict1["maxDeviceNum"] { maxDeviceNum = token as! Int }
                 if let token = dict1["levels"] { levels = token as! String }
                 if let token = dict1["platforms"] { platforms = token as! String }
@@ -945,7 +947,7 @@ class KMMemberCenterManager: NSObject {
                 if let token = dict1["paymentModel"] { paymentModel = token as! Int }
                 if let token = dict1["cycle"] { cycle = token as! Int }
                 if let token = dict1["code"] { code = token as! String }
-                if let token = dict1["cnyPrice"] { cnyPrice = token as! String }
+                if let token = dict1["cnyPrice"] { cnyPrice = token as! NSNumber }
                 let products = KMListingProductsModel(id: id, productName: productName, price: price, maxDeviceNum: maxDeviceNum, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, code: code, cnyPrice: cnyPrice)
                 results.append(products)
             }

+ 3 - 3
PDF Office/PDF Master/MemberCenter/Model/KMMemberProductResult.swift

@@ -84,7 +84,7 @@ class KMMemberProductResult: NSObject {
 class KMListingProductsModel: NSObject {
     var id              : String = "" // 【可选】id
     var productName     : String = "" // 【可选】名称
-    var price           : String = "" // 【可选】价格
+    var price           : NSNumber = NSNumber(value: 0.0) // 【可选】价格
     var maxDeviceNum    : Int = 0 // 【可选】最大可登录设备数
     var levels          : String = "" // 【可选】3高级2标准1免费
     var platforms       : String = "" // 【可选】产品支持平台
@@ -92,11 +92,11 @@ class KMListingProductsModel: NSObject {
     var paymentModel    : Int = 0 // 【可选】付费模式(1自动续订 2单次付费)
     var cycle           : Int = 0 // 【可选】订阅周期:1、月(30天);2、季(90天);3、半年(183天);4、年(365天)
     var code            : String = "" // 【可选】产品code
-    var cnyPrice        : String = "" // 【可选】人民币价格
+    var cnyPrice        : NSNumber = NSNumber(value: 0.0) // 【可选】人民币价格
 //    var displayCnyPrice        : NSNull // 【可选】人民币优惠价格
 //    var displayPrice        : NSNull // 【可选】教育优惠价格
 //    var upgradePrice        : NSNull // 【可选】买断升级订阅价格
-    init(id: String, productName: String, price: String, maxDeviceNum: Int, levels: String, platforms: String, productLineId: Int, paymentModel: Int, cycle: Int, code: String, cnyPrice: String) {
+    init(id: String, productName: String, price: NSNumber, maxDeviceNum: Int, levels: String, platforms: String, productLineId: Int, paymentModel: Int, cycle: Int, code: String, cnyPrice: NSNumber) {
         self.id = id
         self.productName = productName
         self.price = price