ソースを参照

订阅过套餐不可购买

linhaohong 1 年間 前
コミット
b4a29cb7c5
1 ファイル変更8 行追加0 行削除
  1. 8 0
      Controller/InAppPurchaseController.py

+ 8 - 0
Controller/InAppPurchaseController.py

@@ -135,6 +135,14 @@ class InAppPurchaseView(View):
                 pay_result_url = CommonService.get_payment_status_url(lang, 'fail')
                 return response.json(0, {'url': pay_result_url})
 
+            if product_id == "30_days_1_month_subscription" or product_id == "30_days_1_month_ai_subscription":
+                # 之前订阅过任意套餐返回不可购买
+                transaction_subscription = client.get_all_subscription_statuses(transaction_id)
+                if transaction_subscription.data:
+                    for subscription in transaction_subscription.data[0].lastTransactions:
+                        if int(subscription.status) != 2 or int(subscription.status) != 5:
+                            return response.json(10048)
+
             pay_type = PAY_TYPE_IN_APP_PURCHASE
             now_time = int(time.time())