:art: Support get wxcfg by appid

huangqimin 5 年之前
父节点
当前提交
865b2701e9
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      miniapp/views.py

+ 6 - 3
miniapp/views.py

@@ -25,11 +25,12 @@ WECHAT = settings.WECHAT
25 25
 @transaction.atomic
26 26
 def get_userinfo_api(request):
27 27
     brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
28
+    appid = request.POST.get('appid', 'MINIAPP')
28 29
 
29 30
     if brand_id != settings.KODO_DEFAULT_BRAND_ID:
30 31
         return response(ProductBrandStatusCode.BRAND_NOT_MATCH)
31 32
 
32
-    wxcfg = WECHAT.get('MINIAPP', {})
33
+    wxcfg = WECHAT.get(appid, {})
33 34
 
34 35
     appid = wxcfg.get('appID')
35 36
     secret = wxcfg.get('appsecret')
@@ -96,11 +97,12 @@ def get_userinfo_api(request):
96 97
 @transaction.atomic
97 98
 def mini_login_api(request):
98 99
     brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
100
+    appid = request.POST.get('appid', 'MINIAPP')
99 101
 
100 102
     if brand_id != settings.KODO_DEFAULT_BRAND_ID:
101 103
         return response(ProductBrandStatusCode.BRAND_NOT_MATCH)
102 104
 
103
-    wxcfg = WECHAT.get('MINIAPP', {})
105
+    wxcfg = WECHAT.get(appid, {})
104 106
 
105 107
     appid = wxcfg.get('appID')
106 108
     secret = wxcfg.get('appsecret')
@@ -168,11 +170,12 @@ def mini_login_api(request):
168 170
 def get_userinfo_api2(request):
169 171
     brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
170 172
     user_id = request.POST.get('user_id', '')
173
+    appid = request.POST.get('appid', 'MINIAPP')
171 174
 
172 175
     if brand_id != settings.KODO_DEFAULT_BRAND_ID:
173 176
         return response(ProductBrandStatusCode.BRAND_NOT_MATCH)
174 177
 
175
-    wxcfg = WECHAT.get('MINIAPP', {})
178
+    wxcfg = WECHAT.get(appid, {})
176 179
 
177 180
     appid = wxcfg.get('appID')
178 181
     secret = wxcfg.get('appsecret')