Explorar el Código

【会员系统】AI月订阅购买入口,当存在订阅时,购买入口不能显示

wanjun hace 4 días
padre
commit
420631aa24
Se han modificado 1 ficheros con 25 adiciones y 9 borrados
  1. 25 9
      PDF Office/PDF Master/MemberCenter/Model/KMMemberInfo.swift

+ 25 - 9
PDF Office/PDF Master/MemberCenter/Model/KMMemberInfo.swift

@@ -851,16 +851,32 @@ import Cocoa
     
     // 是否允许使用AI
     var isPermitAI: Bool {
-        if KMMemberInfo.shared.isLogin {
-            if KMMemberInfo.shared.aiPoint > 0 {
-                return true
-            }
-            if AIInfoManager.default().aiInfo.totalToken - AIInfoManager.default().aiInfo.usedTimes > 0 {
-                return true
-            }
+        var isSubscribed = false
+#if VERSION_FREE
+#if VERSION_DMG
+    // DMG
+#else
+    // AppStore 免费版本
+        isSubscribed = IAPProductsManager.default().aiAllAccessPack1month_lite.isSubscribed
+#endif
+#else
+    // AppStore 付费版
+        isSubscribed = IAPProductsManager.default().aiAllAccessPack1month_pro.isSubscribed
+#endif
+        if isSubscribed {
+            return true
         } else {
-            if AIInfoManager.default().aiInfo.totalToken - AIInfoManager.default().aiInfo.usedTimes > 0 {
-                return true
+            if KMMemberInfo.shared.isLogin {
+                if KMMemberInfo.shared.aiPoint > 0 {
+                    return true
+                }
+                if AIInfoManager.default().aiInfo.totalToken - AIInfoManager.default().aiInfo.usedTimes > 0 {
+                    return true
+                }
+            } else {
+                if AIInfoManager.default().aiInfo.totalToken - AIInfoManager.default().aiInfo.usedTimes > 0 {
+                    return true
+                }
             }
         }
         return false