Browse Source

优化paypal对账

peng 1 year ago
parent
commit
bf72950ed2
1 changed files with 6 additions and 2 deletions
  1. 6 2
      Controller/Cron/CronTaskController.py

+ 6 - 2
Controller/Cron/CronTaskController.py

@@ -1563,12 +1563,16 @@ class CronComparedDataView(View):
                 response = requests.get('https://www.zositeche.com/testApi/checkOrderExist', params=params)
                 response = requests.get('https://www.zositeche.com/testApi/checkOrderExist', params=params)
                 if response.status_code != 200:
                 if response.status_code != 200:
                     # 如果响应失败,记录在数据库
                     # 如果响应失败,记录在数据库
-                    AbnormalOrder.objects.create(**order_dict)
+                    abnormal_qs = AbnormalOrder.objects.filter(trade_no=trade_no)
+                    if not abnormal_qs.exists():
+                        AbnormalOrder.objects.create(**order_dict)
                     continue
                     continue
                 result = response.json()
                 result = response.json()
                 if result['result_code'] != 0 or not result['result']['is_exist']:
                 if result['result_code'] != 0 or not result['result']['is_exist']:
                     # 如果响应结果为空,记录在数据库
                     # 如果响应结果为空,记录在数据库
-                    AbnormalOrder.objects.create(**order_dict)
+                    abnormal_qs = AbnormalOrder.objects.filter(trade_no=trade_no)
+                    if not abnormal_qs.exists():
+                        AbnormalOrder.objects.create(**order_dict)
                     more_order_list.append(trade_no)
                     more_order_list.append(trade_no)
             else:
             else:
                 if not refund_order:
                 if not refund_order: