Przeglądaj źródła

解决退款通知提交时间不准bug

linhaohong 9 miesięcy temu
rodzic
commit
f0cc84ca7a
1 zmienionych plików z 7 dodań i 6 usunięć
  1. 7 6
      Controller/InAppPurchaseController.py

+ 7 - 6
Controller/InAppPurchaseController.py

@@ -379,16 +379,17 @@ class InAppPurchaseView(View):
             if orders_qs.exists():
                 orderID = orders_qs[0].orderID
                 uid = orders_qs[0].UID
+                app_type = orders_qs[0].app_type
                 now_time = int(time.time())
                 put_time = int(now_time + 11.5 * 60 * 60)
                 in_app_refund_qs = InAppRefund.objects.filter(transaction_id=transaction_id)
                 if in_app_refund_qs.exists():
-                    in_app_refund_qs.update(refund_progress=0, updated_time=now_time,
-                                            put_time=put_time, app_account_token=app_account_token)
-                InAppRefund.objects.create(transaction_id=transaction_id, orderID=orderID,
-                                           uid=uid, app_type=1, created_time=now_time,
-                                           updated_time=now_time, put_time=put_time,
-                                           app_account_token=app_account_token)
+                    in_app_refund_qs.update(refund_progress=0, updated_time=now_time, app_account_token=app_account_token)
+                else:
+                    InAppRefund.objects.create(transaction_id=transaction_id, orderID=orderID,
+                                               uid=uid, app_type=app_type, created_time=now_time,
+                                               updated_time=now_time, put_time=put_time,
+                                               app_account_token=app_account_token)
             elif CONFIG_INFO == CONFIG_US:
                 url = "https://api.zositeche.com/inAppPurchase/AppStoreServerNotifications"
                 eur_response = requests.post(url=url, json=json.loads(request.body))