3 커밋 42fef02fd3 ... 3446ff5905

작성자 SHA1 메시지 날짜
  zenghong 3446ff5905 Merge branch 'develop_PDFReaderPro_V4.7.0' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderPro_V4.7.0 5 일 전
  zenghong 2de46b952f 【会员系统 】DMG结算界面初始化调整 5 일 전
  zenghong 43b8a58c5b 【会员系统】DMG版结算界面初始化部分调整 5 일 전

+ 6 - 2
PDF Office/PDF Master/AppDelegate.swift

@@ -129,14 +129,18 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
                     }
 #if VERSION_DMG
                     let model = KMProductModel.shared
-                    model.getDMGProductDatas()
+                    model.getDMGProductDatas() { [weak self] success, result in
+                        
+                    }
 #endif
                 }
             }
         } else {
 #if VERSION_DMG
             let model = KMProductModel.shared
-            model.getDMGProductDatas()
+            model.getDMGProductDatas() { [weak self] success, result in
+                
+            }
 #endif
         }
 

+ 51 - 0
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.swift

@@ -150,6 +150,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
     @IBOutlet weak var imageBottomLayout: NSLayoutConstraint!
     @IBOutlet weak var image2BottomLayout: NSLayoutConstraint!
     
+    private var _product_code : String = ""
     private var _dmgProductType: KMDMGProductType = .advanced_annual_subscription_trail
     private var _product_Info: KMListingProductsModel = KMListingProductsModel(id: "23", productName: "PDF Reader Pro Advanced - Annual Plan", price: NSNumber(value: 99.99), maxDeviceNum: 4, displayPrice: NSNumber(value: 0.0), levels: "3", platforms: "Windows,Android,Mac,iOS", productLineId: 1, paymentModel: 1, cycle: 4, cnyPrice: NSNumber(value: 0), displayCnyPrice: NSNumber(value: 0.0), upgradePrice: NSNumber(value: 0.0), code: "advanced-annual-subscription-trail")
 
@@ -254,6 +255,18 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         }
      }
     
+    @objc static func currentCode(_ productCode: String) -> KMPurchaseEmbeddedWindowController {
+        if currentWindowController != nil {
+            currentWindowController.product_code = productCode
+            return currentWindowController
+        } else {
+            let configWC: KMPurchaseEmbeddedWindowController = KMPurchaseEmbeddedWindowController.init(windowNibName: "KMPurchaseEmbeddedWindowController")
+            currentWindowController = configWC;
+            currentWindowController.product_code = productCode
+            return currentWindowController
+        }
+     }
+    
     @objc static func currentFirstTrialWC(_ productId: String) -> KMPurchaseEmbeddedWindowController {
         if currentWindowController != nil {
             currentWindowController.productID = productId
@@ -1767,6 +1780,44 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
     
     // MARK: get & set
     
+    var product_code : String {
+        get {
+            return _product_code
+        }
+        
+        set {
+            _product_code = newValue
+            
+            let model = KMProductModel.shared
+            let products : [KMListingProductsModel] = model.dmgProductDatas?.listingProducts ?? []
+            if products.count > 0 {
+                for product in products {
+                    if product.code == _product_code {
+                        self.product_Info = product;
+                        //更新价格
+                        self.updateProduct_Info()
+                        break
+                    }
+                }
+            } else {
+                model.getDMGProductDatas() { [weak self] success, result in
+                    let products : [KMListingProductsModel] = model.dmgProductDatas?.listingProducts ?? []
+                    if products.count > 0 {
+                        for product in products {
+                            if product.code == self?.product_code {
+                                self?.product_Info = product;
+                                //更新价格
+                                self?.updateProduct_Info()
+                                break
+                            }
+                        }
+                    }
+                }
+            }
+            
+        }
+    }
+    
     var product_Info: KMListingProductsModel {
         get {
             return _product_Info

+ 2 - 1
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -124,11 +124,12 @@ class KMProductModel: ObservableObject {
      @abstract 获取DMG服务器架上所有商品 (得到的价格是原始价格)
      @param
      */
-    func getDMGProductDatas() -> Void {
+    func getDMGProductDatas( _ complete: @escaping KMMemberProductComplete) -> Void {
         checkConnectionAvailable()
         KMMemberCenterManager.manager.getListingProducts(isEducation: 0) { [weak self] success, result in
             guard let productsArrays : KMMemberProductResult = result else { return }
             self?.dmgProductDatas = productsArrays
+            complete(success, result)
         }
         
         if KMMemberInfo.shared.isLogin {

+ 1 - 1
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.swift

@@ -1075,7 +1075,7 @@ class KMProductCompareWC: NSWindowController {
             }
         }
         
-        let embeddedWC = KMPurchaseEmbeddedWindowController.currentWC(product ?? KMListingProductsModel())
+        let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(product?.code ?? "")
         embeddedWC.showWindow(nil)
         embeddedWC.window?.center()
 #else