chenjunkai 6 anni fa
parent
commit
92b88e99a7
2 ha cambiato i file con 17 aggiunte e 22 eliminazioni
  1. 7 14
      Controller/CloudVod.py
  2. 10 8
      Object/AliPayObject.py

+ 7 - 14
Controller/CloudVod.py

@@ -126,15 +126,15 @@ class CloudVodView(View):
 
     def do_ali_pay_callback(self, request):
         response = ResponseObject()
-        data = request.POST.dict()
-        signature = data["sign"]
-        data.pop('sign')
-        orderID = data['out_trade_no']
-
+        # data = request.POST.dict()
+        # signature = data["sign"]
+        # data.pop('sign')
+        # orderID = data['out_trade_no']
+        orderID = '20190425014713940619'
         order_qs = Order_Model.objects.filter(orderID=orderID, status=0)
         if not order_qs.exists():
             return response.json(404)
-
+        return response.json(10,'ss')
         print(json.dumps(data))
         print(signature)
         # verify
@@ -212,8 +212,6 @@ class CloudVodView(View):
         if ubqs.exists():
             if ubqs[0]['bucket__region'] != smqs[0]['bucket__region']:
                 return response.json(712)  # 区域不一致
-            # elif ubqs[0]['bucket__storeDay'] > smqs[0]['bucket__storeDay']:
-            #     return response.json(711)  # 不可降级
             elif ubqs[0]['bucket__storeDay'] != smqs[0]['bucket__storeDay']:
                 return response.json(713)  # 不可更改套餐
             # 续费流程
@@ -230,17 +228,12 @@ class CloudVodView(View):
                 # subject="实用性充气式玩具",
                 return_url="https://test.dvema.com/cloudVod/payOK",
                 notify_url="https://test.dvema.com/cloudVod/aliPayCallback"
-                # return_url="http://192.168.136.40/cloudVod/payOK",
-                # notify_url="http://192.168.136.40/cloudVod/aliPayCallback"
             )
         except Exception as e:
             print(repr(e))
             return response.json(10, repr(e))
         if order_string:
-            # redirectUrl = "https://openapi.alipaydev.com/gateway.do?" + order_string
-            redirectUrl = "https://openapi.alipay.com/gateway.do?" + order_string
-            # from django.http import HttpResponseRedirect
-            # return HttpResponseRedirect("https://openapi.alipaydev.com/gateway.do?" + order_string)
+            redirectUrl = aliPayObj.alipay_prefix + order_string
             Order_Model.objects.create(orderID=orderID, UID=uid, channel=channel, userID_id=userID, desc=content,
                                        price=price, currency=currency, addTime=nowTime, updTime=nowTime,
                                        endTime=nowTime + int(day) * 3600 * 24, rank_id=rank, paypal='', payType=1)

+ 10 - 8
Object/AliPayObject.py

@@ -19,19 +19,21 @@ class AliPayObject:
 
     def __init__(self):
         # janka测试环境
-        # self.app_pri_key = open(BASE_DIR + '/Ansjer/file/alipay/alipay_private_2048.pem').read()
-        # self.ali_pub_key = open(BASE_DIR + '/Ansjer/file/alipay/alipay_public_2048.pem').read()
-        # self.app_id="2016092200569234",
+        self.app_pri_key = open(BASE_DIR + '/Ansjer/file/alipay/alipay_private_2048.pem').read()
+        self.ali_pub_key = open(BASE_DIR + '/Ansjer/file/alipay/alipay_public_2048.pem').read()
+        self.app_id = '2016092200569234'
+        self.alipay_prefix = "https://openapi.alipaydev.com/gateway.do?"
 
         # 应用私钥
-        self.app_pri_key = open(BASE_DIR + '/Ansjer/file/alipay/zosi_alipay_private_2048.pem').read()
-        # 支付宝公钥
-        self.ali_pub_key = open(BASE_DIR + '/Ansjer/file/alipay/zosi_alipay_public_2048.pem').read()
-        self.app_id = '2019041663958142'
+        # self.app_pri_key = open(BASE_DIR + '/Ansjer/file/alipay/zosi_alipay_private_2048.pem').read()
+        # # 支付宝公钥
+        # self.ali_pub_key = open(BASE_DIR + '/Ansjer/file/alipay/zosi_alipay_public_2048.pem').read()
+        # self.app_id = '2019041663958142'
+        # self.alipay_prefix = "https://openapi.alipay.com/gateway.do?"
 
     def conf(self):
         alipay = AliPay(
-            appid="2019041663958142",
+            appid=self.app_id,
             app_notify_url=None,  # the default notify path
             app_private_key_string=self.app_pri_key,
             alipay_public_key_string=self.ali_pub_key,