chenjunkai 6 年 前
コミット
978eda2dbe
1 ファイル変更5 行追加4 行削除
  1. 5 4
      Controller/Test.py

+ 5 - 4
Controller/Test.py

@@ -25,10 +25,12 @@ class Test(View):
     def get(self, request, *args, **kwargs):
         response = ResponseObject()
         from alipay import AliPay, ISVAliPay
+        import time
         app_private_key_string = open(BASE_DIR + '/Controller/alipay_private_2048.pem').read()
         alipay_public_key_string = open(BASE_DIR + '/Controller/alipay_public_2048.pem').read()
+        orderID = int(time.time())+int(time.time())
         alipay = AliPay(
-            appid="2016092200569234",
+            appid=str(orderID),
             app_notify_url=None,  # the default notify path
             app_private_key_string=app_private_key_string,
             # alipay public key, do not use your own public key!
@@ -40,15 +42,14 @@ class Test(View):
             out_trade_no="20161112",
             total_amount=0.01,
             subject="实用性充气版玩具",
-            return_url="http://example.com",
-            notify_url="https://example.com/notify"  # this is optional
+            return_url="https://test.dvema.com",
+            # notify_url="https://example.com/notify"  # this is optional
         )
         print(order_string)
         from django.http import HttpResponseRedirect
         # return response.json(0,"https://openapi.alipay.com/gateway.do? + {order_string}".format(order_string=order_string))
         print(order_string)
         return HttpResponseRedirect("https://openapi.alipaydev.com/gateway.do?"+order_string)
-        return response.json(0,)
         # 增加
 
     def post(self, request, *args, **kwargs):