Эх сурвалжийг харах

周期付款 - 修复订阅过期后订阅充值失败的问题

linhaohong 1 жил өмнө
parent
commit
914edfd7b4

+ 3 - 4
Controller/InAppPurchaseController.py

@@ -162,10 +162,6 @@ class InAppPurchaseView(View):
             if not store_qs.exists():
                 return response.json(173, "套餐不存在")
 
-            in_app_purchase_package_qs = InAppPurchasePackage.objects.filter(product_id=product_id)
-            if not in_app_purchase_package_qs.exists():
-                return response.json(173, "内购套餐不存在")
-
             bucket_id = store_qs[0]['bucket_id']
             is_ai = store_qs[0]['is_ai']
             expire = store_qs[0]['expire']
@@ -209,6 +205,9 @@ class InAppPurchaseView(View):
 
             # 修改订阅状态
             if payload.rawType == "Auto-Renewable Subscription":
+                in_app_purchase_package_qs = InAppPurchasePackage.objects.filter(product_id=product_id)
+                if not in_app_purchase_package_qs.exists():
+                    return response.json(173, "内购套餐不存在")
                 in_app_purchase_package = in_app_purchase_package_qs.values('id').first()
                 package_id = in_app_purchase_package['id']
                 DeviceApplePackage.objects.filter(userID=user_id, uid=uid, package_id=package_id).update(