Ver código fonte

支付 回调通知逻辑3

chenshibin 4 anos atrás
pai
commit
4b0cc89610
1 arquivos alterados com 2 adições e 19 exclusões
  1. 2 19
      Controller/CloudStorage.py

+ 2 - 19
Controller/CloudStorage.py

@@ -831,15 +831,7 @@ class CloudStorageView(View):
             orderID = data['out_trade_no']
 
             order_qs = Order_Model.objects.filter(orderID=orderID, status=0)
-            print(order_qs)
-            self.callback_dostatus(orderID)
 
-            if not order_qs.exists():
-                return response.json(404)
-
-
-            print(json.dumps(data))
-            print(signature)
             # verify
             aliPayObj = AliPayObject()
             alipay = aliPayObj.conf()
@@ -902,7 +894,6 @@ class CloudStorageView(View):
         orderID = request_dict.get('orderID', None)
 
         try:
-            self.callback_dostatus(orderID)
             if not paymentId or not PayerID or not orderID:
                 red_url = "{SERVER_DOMAIN}cloudstorage/payError".format(SERVER_DOMAIN=SERVER_DOMAIN)
                 return HttpResponseRedirect(red_url)
@@ -915,7 +906,7 @@ class CloudStorageView(View):
                 red_url = "{SERVER_DOMAIN}cloudstorage/payError".format(SERVER_DOMAIN=SERVER_DOMAIN)
                 return HttpResponseRedirect(red_url)
             print("Payment execute successfully")
-            order_qs = Order_Model.objects.filter(orderID=orderID)
+            order_qs = Order_Model.objects.filter(orderID=orderID, status=0)
             nowTime = int(time.time())
             order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts", "userID__userID",
                                          "userID__username")
@@ -979,7 +970,6 @@ class CloudStorageView(View):
             trade_status = data['result_code']  # 业务结果  SUCCESS/FAIL
             out_trade_no = data['out_trade_no']  # 商户订单号
             order_qs = None
-            self.callback_dostatus(out_trade_no)
             if trade_status == "SUCCESS":
                 logger.info('微信回调返回值 进来了。')
                 check_sign = pay.get_notifypay(data)
@@ -990,7 +980,7 @@ class CloudStorageView(View):
                 print("进来了,微信支付成功回调")
 
 
-                order_qs = Order_Model.objects.filter(orderID=orderID)
+                order_qs = Order_Model.objects.filter(orderID=orderID, status=0)
                 nowTime = int(time.time())
                 order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts",
                                              "userID__userID", "userID__username")
@@ -1170,7 +1160,6 @@ class CloudStorageView(View):
                                          orderID, '进来了,微信支付创建订单'+notify_url))
             asy.start()
             price = float(price)*100
-            self.callback_dostatus(orderID)
             parameter_dict = pay.get_parameter(orderID, content, price, ip, notify_url)
             print('parameter_dict', parameter_dict)
             # parameter_dict 参数中获取MWEB_URL 调转页面在路径后面添加redirect_url
@@ -1371,12 +1360,6 @@ class CloudStorageView(View):
         return response.json(444)
 
 
-    def callback_dostatus(self, orderid):
-        oq = Order_Model.objects.filter(orderID=orderid)
-        if oq.exists():
-            oq.update(status=9)
-        else:
-            raise Exception("找不到订单")
 
 #删除过期云存播放列表
 def deleteVodHls(request):