소스 검색

【会员系统】DMG 所有可购买商品获取

zenghong 1 주 전
부모
커밋
db0c779482

+ 3 - 0
PDF Office/PDF Master/AppDelegate.swift

@@ -187,6 +187,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
 #if VERSION_DMG
         VerificationManager.default()
         KMDMGProductsManager.shareInstance.getProductDatas()
+        
+        let model = KMProductModel()
+        model.getDMGProductDatas()
 #else
         self.initiVersionData()
         IAPProductsManager.default().initIAP()

+ 1 - 2
PDF Office/PDF Master/MemberCenter/Model/KMMemberCenterManager.swift

@@ -825,11 +825,10 @@ class KMMemberCenterManager: NSObject {
     
 #if VERSION_DMG
     // DMG
-        platformId = "2"
+        platformId = "1"
 #else
     // AppStore 免费版本
 #endif
-        platformId = "3"
 #else
     // AppStore 付费版
         platformId = "5"

+ 25 - 0
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -61,6 +61,31 @@ class KMProductModel: ObservableObject {
      */
     @Published var isPurchaseSwitch: Bool = true
     
+    // MARK: DMG Public Property
+    /**
+     DMG 版本所有已经上架产品记录(暂时无教育优惠)
+     */
+    var dmgProductDatas: KMMemberProductResult?
+    
+    // MARK: DMG Public Method
+    func getDMGProductDatas() -> Void {
+        if KMMemberCenterManager.manager.isConnectionAvailable() == false {
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.messageText = NSLocalizedString("Error Information", comment: "")
+            alert.informativeText = NSLocalizedString("Please make sure your internet connection is available.", comment: "")
+            alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+            alert.runModal()
+            return
+        }
+
+        KMMemberCenterManager.manager.getListingProducts(isEducation: 0) { [weak self] success, result in
+            guard let productsArrays : KMMemberProductResult = result else { return }
+            self?.dmgProductDatas = productsArrays
+        }
+        
+    }
+    
     // MARK: Public Method
     
     /**