-wxpay = WeChatPay(WECHAT['appID'], WECHAT['apiKey'], WECHAT['mchID'])
21
+WECHAT = settings.WECHAT
21 22
 
22 23
 
24
+@logit
23 25
 @transaction.atomic
24 26
 def wx_order_create_api(request):
25 27
     """
@@ -37,6 +39,11 @@ def wx_order_create_api(request):
37 39
     # JSAPI--公众号支付、NATIVE--原生扫码支付、APP--app支付,统一下单接口trade_type的传参可参考这里
38 40
     trade_type = request.POST.get('trade_type', '')
39 41
 
42
+    # 根据 trade_type 获取 wechat 配置
43
+    wechat = WECHAT.get(trade_type, {})
44
+    # WeChatPay 初始化
45
+    wxpay = WeChatPay(wechat.get('appID'), wechat.get('apiKey'), wechat.get('mchID'))
46
+
40 47
     # 生成订单
41 48
     order = OrderInfo.objects.create(from_uid=from_uid, to_lid=to_lid, to_uid=to_uid, total_fee=total_fee)
42 49
 
@@ -74,6 +81,7 @@ def order_paid_success(order):
74 81
     order.save()
75 82
 
76 83
 
84
+@logit
77 85
 @transaction.atomic
78 86
 def wx_notify_url_api(request):
79 87
     """

+ 1 - 0
requirements.txt

@@ -4,6 +4,7 @@ MySQL-python==1.2.5
4 4
 TimeConvert==1.1.6
5 5
 cryptography==1.2.1
6 6
 django-curtail-uuid==1.0.0
7
+django-logit==1.0.0
7 8
 django-multidomain==1.1.4
8 9
 django-shortuuidfield==0.1.3
9 10
 djangorestframework==3.3.1

kodo - Gogs: Go Git Service

Нет описания

Kimi.Huang: dfca004d3e Opt лет %!s(int64=7): %!d(string=назад)
..
migrations a7cbbf15a7 Update max_length for CharField лет %!s(int64=8): %!d(string=назад)
templates 428a189ebb Bootcdn Crash, Change CDN Domain & TODO: Support Fallback лет %!s(int64=7): %!d(string=назад)
__init__.py 4defb80fdc gogs first init лет %!s(int64=10): %!d(string=назад)
admin.py 627187a7d7 Update Kodo лет %!s(int64=8): %!d(string=назад)
models.py dfca004d3e Opt лет %!s(int64=7): %!d(string=назад)
serializers.py f72ccb1875 isort import лет %!s(int64=10): %!d(string=назад)
tests.py fabef63211 set line_length=200 for isort лет %!s(int64=10): %!d(string=назад)
urls.py 4defb80fdc gogs first init лет %!s(int64=10): %!d(string=назад)
views.py 018d52f61d Update package django_xxx лет %!s(int64=8): %!d(string=назад)