Просмотр исходного кода

Merge branch 'develop_PDFReaderPro_V4.7.0' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderPro_V4.7.0

wangshuai 1 неделя назад
Родитель
Сommit
ae9641cfd5

+ 5 - 0
PDF Office/PDF Master/MemberCenter/Model/KMMemberInfo.swift

@@ -647,6 +647,11 @@ import Cocoa
                 if KMMemberInfo.shared.canTrail && KMMemberInfo.shared.vip_levels == "1" {
                     return .lite_type1
                 }
+                
+                if(KMMemberInfo.shared.canTrail == false && KMMemberInfo.shared.vip_levels == "1" && KMMemberInfo.shared.vip_status != 2) { //试用过期
+                    return .lite_type3
+                }
+                
                 if KMMemberInfo.shared.vip_status == 3 {
                     return .lite_type2
                 } else if KMMemberInfo.shared.vip_status == 4 {

+ 72 - 14
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -165,6 +165,56 @@ class KMProductModel: ObservableObject {
         
     }
     
+    
+    /**
+     @abstract 获取DMG产品价格(美元)
+     */
+    func getDMGPrice(productCode: String) -> String {
+        guard let productModels = dmgProductDatas?.listingProducts else { return "" }
+        for model in productModels {
+            if model.code == "productCode" {
+                return model.price.stringValue
+            }
+        }
+        return ""
+    }
+    /**
+     @abstract 获取DMG产品价格(人民币)
+     */
+    func getDMGCNYPrice(productCode: String) -> String {
+        guard let productModels = dmgProductDatas?.listingProducts else { return "" }
+        for model in productModels {
+            if model.code == "productCode" {
+                return model.cnyPrice.stringValue
+            }
+        }
+        return ""
+    }
+    /**
+     @abstract 获取DMG产品折扣价格(美元)
+     */
+    func getDMGDisplayPrice(productCode: String) -> String {
+        guard let productModels = dmgProductDatas?.listingProducts else { return "" }
+        for model in productModels {
+            if model.code == "productCode" {
+                return model.displayPrice.stringValue
+            }
+        }
+        return ""
+    }
+    /**
+     @abstract 获取DMG产品折扣价格(人民币)
+     */
+    func getDMGDisplayCNYPrice(productCode: String) -> String {
+        guard let productModels = dmgProductDatas?.listingProducts else { return "" }
+        for model in productModels {
+            if model.code == "productCode" {
+                return model.displayCnyPrice.stringValue
+            }
+        }
+        return ""
+    }
+    
     /**
      @abstract 获取登录用户价格(建立订单时需要用到)
      @param productId 购买的产品id
@@ -460,38 +510,46 @@ class KMProductModel: ObservableObject {
                 return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.price()
             }
         } else if type == .pdfReaderProStandard_dmg {
-            return "79.99"
+            return getDMGPrice(productCode: "PDF Reader Pro Standard - Annual Plan")
         } else if type == .pdfReaderProAdvanced_dmg {
-            return "99.99"
+            return getDMGPrice(productCode: "PDF Reader Pro Advanced - Annual Plan")
         } else if type == .pdfReaderProPermanent_dmg {
-            return "119.99"
+            return getDMGPrice(productCode: "PDF Reader Pro Permanent")
         } else if type == .pdfReaderProAIAnnual_dmg {
-            return "125.99"
+            return getDMGPrice(productCode: "PDF Reader Pro AI - Annual Plan")
         } else if type == .pdfReaderProAIMonthly_dmg {
-            return "14.99"
+            return getDMGPrice(productCode: "PDF Reader Pro AI - Monthly Plan")
         } else if type == .pdfToOffice_dmg {
-            return "29.99"
+            return getDMGPrice(productCode: "PDF to Office")
         } else if type == .add2Device_dmg {
-            return "39.99"
+            return getDMGPrice(productCode: "Add 2-Device · Advanced Annual")
         } else if type == .add3Device_dmg {
-            return "49.99"
+            return getDMGPrice(productCode: "Add 3-Device · Advanced Annual")
         }
         return ""
     }
     
     func appstorePurchaseAction(_ tag: Int, _ complete: @escaping AppstorePurchaseComplete) -> Void {
         if state == .dmg_Base {
-            if tag == 0 {
-                
+            var code = ""
+            if tag == 1 {
+                code = "PDF Reader Pro Standard - Annual Plan"
             } else if tag == 3 {
-                
+                code = "PDF Reader Pro Permanent"
             } else {
-                
+                code = "PDF Reader Pro Advanced - Annual Plan"
             }
+            let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
+            embeddedWC.showWindow(nil)
+            embeddedWC.window?.center()
         } else if state == .dmg_Upgrades1 {
-            
+            let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode("Add 2-Device · Advanced Annual")
+            embeddedWC.showWindow(nil)
+            embeddedWC.window?.center()
         } else if state == .dmg_Upgrades2 {
-            
+            let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode("Add 3-Device · Advanced Annual")
+            embeddedWC.showWindow(nil)
+            embeddedWC.window?.center()
         } else if state == .lite_Base {
             if tag == 0 {
                 if isPurchaseSwitch { membershipPurchase(.fourDevicesAllAccessPackNew12months_lite) }

+ 0 - 29
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.swift

@@ -1061,39 +1061,10 @@ class KMProductCompareWC: NSWindowController {
     }
     
     @IBAction func appstorePurchaseAction(_ sender: NSButton) {
-#if VERSION_DMG
-        let model = KMProductModel.shared
-        
-        var product : KMListingProductsModel?
-        let productsWithMember : [KMListingProductsModel] = model.dmgLastGetProductPriceInfos?.listingProducts ?? []
-        let products : [KMListingProductsModel] = model.dmgProductDatas?.listingProducts ?? []
-        if KMMemberInfo.shared.isLogin {
-            if productsWithMember.count > 0{
-                product = productsWithMember.first
-            } else {
-                if products.count > 0{
-                    product = products[3]
-                } else {
-                    product = KMListingProductsModel()
-                }
-            }
-        } else {
-            if products.count > 0{
-                product = products.first
-            } else {
-                product = KMListingProductsModel()
-            }
-        }
-        
-        let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(product?.code ?? "")
-        embeddedWC.showWindow(nil)
-        embeddedWC.window?.center()
-#else
         model.appstorePurchaseAction(sender.tag) { [weak self] success, msg in
             guard let self = self else { return }
 
         }
-#endif
     }
     
     // MARK: - InAppPurchaseManager Notification