xjconline 2 tahun lalu
induk
melakukan
9bf4ca8634
3 mengubah file dengan 5 tambahan dan 3 penghapusan
  1. 0 1
      src/weixin/control_auth.py
  2. 4 1
      src/weixin/views.py
  3. 1 1
      templates/index.html

+ 0 - 1
src/weixin/control_auth.py

@@ -121,7 +121,6 @@ def login_user_v3(request):
         user = cm.UserInfo.objects.filter(Q(phone=phone)).order_by("-id").first()
     else:
         user = cm.UserInfo.objects.filter(Q(openid=openid)).order_by("-id").first()
-    print(user.id)
     if not user:
         #新用户
         usercode = gen_code()

+ 4 - 1
src/weixin/views.py

@@ -35,12 +35,14 @@ class OpenidView(cv.BaseView):
             print res
             if res.has_key('openid'):                                                 
                 open_id = res['openid']                                               
+                unionid = res['unionid']                                               
                 cache.set(code,open_id,24*3600)
             else:                                                                      
                 open_id = ''                                                           
+                unionid = ''
             if open_id:
                 ccc.cache.set(open_id,1)
-                return cv.to_suc({"openid":open_id})
+                return cv.to_suc({"openid":open_id,"unionid":unionid})
             else:
                 return cv.to_fail(u"获取用户信息出错!")
 
@@ -798,6 +800,7 @@ class V3LoginView(cv.BaseView):
             rst = ca.login_user_v3(request)
             return cv.to_suc(rst)
         except Exception as e: 
+            cv.tracefail()
             return cv.to_fail(e)
 
 

File diff ditekan karena terlalu besar
+ 1 - 1
templates/index.html