|
|
@@ -48,7 +48,8 @@ def get_wxauth_info(request):
|
|
|
cur_match_id = ccc.get_signup_match().id
|
|
|
#player = cm.Player.objects.filter(user_id=uid,match_id=cur_match_id).order_by("-id").first()
|
|
|
gt_time = datetime.timedelta(days=-365)+datetime.datetime.now()
|
|
|
- player = cm.Player.objects.filter(user_id=uid,match_status=1,ctime__gte=gt_time).order_by("-id").first()
|
|
|
+ #player = cm.Player.objects.filter(user_id=uid,match_status=1,ctime__gte=gt_time).order_by("-id").first()
|
|
|
+ player = cm.Player.objects.filter(user_id=uid).order_by("-id").first()
|
|
|
#print(uid,cur_match_id)
|
|
|
if player:
|
|
|
user["role"] = player.role
|
|
|
@@ -117,11 +118,21 @@ def login_user_v3(request):
|
|
|
# raise ce.TipException(u"非法openid!")
|
|
|
|
|
|
user = None
|
|
|
- if unionid:
|
|
|
- user = cm.UserInfo.objects.filter(unionid=unionid).order_by("-id").first()
|
|
|
+
|
|
|
+ if openid:
|
|
|
+ user = cm.UserInfo.objects.filter(openid=openid).order_by("-id").first()
|
|
|
else:
|
|
|
- if openid or phone:
|
|
|
- user = cm.UserInfo.objects.filter(Q(phone=phone)|Q(openid=openid)).order_by("-id").first()
|
|
|
+ if unionid or phone:
|
|
|
+ user = cm.UserInfo.objects.filter(Q(phone=phone)|Q(unionid=unionid)).order_by("-id").first()
|
|
|
+
|
|
|
+ #if unionid:
|
|
|
+ # user = cm.UserInfo.objects.filter(unionid=unionid).order_by("-id").first()
|
|
|
+
|
|
|
+ #if not user and openid:
|
|
|
+ # user = cm.UserInfo.objects.filter(openid=openid).order_by("-id").first()
|
|
|
+
|
|
|
+ #if not user and phone:
|
|
|
+ # user = cm.UserInfo.objects.filter(phone=phone).order_by("-id").first()
|
|
|
|
|
|
if not user:
|
|
|
#新用户
|
|
|
@@ -150,8 +161,7 @@ def login_user_v3(request):
|
|
|
user.unionid = unionid
|
|
|
user.save()
|
|
|
|
|
|
- gt_time = datetime.timedelta(days=-365)+datetime.datetime.now()
|
|
|
- player = cm.Player.objects.filter(user_id=user.id,match_status=1,ctime__gte=gt_time).order_by("-id").first()
|
|
|
+ player = cm.Player.objects.filter(user_id=user.id).order_by("-id").first()
|
|
|
if player:
|
|
|
role = player.role
|
|
|
else:
|
|
|
@@ -185,16 +195,32 @@ def get_wxauth_info_v3(request):
|
|
|
phcode = qdata.get("phcode")
|
|
|
|
|
|
user = None
|
|
|
- if unionid:
|
|
|
- user = cm.UserInfo.objects.filter(unionid=unionid).values().first()
|
|
|
+
|
|
|
+ if openid:
|
|
|
+ user = cm.UserInfo.objects.filter(openid=openid).values().first()
|
|
|
else:
|
|
|
if phone:
|
|
|
#orgcode = ccc.cache.get(phone)
|
|
|
#if not phcode == orgcode and not phone=="13883187629":
|
|
|
# raise ce.TipException(u"验证码不正确!")
|
|
|
user = cm.UserInfo.objects.filter(phone=phone).values().first()
|
|
|
- if openid:
|
|
|
- user = cm.UserInfo.objects.filter(openid=openid).values().first()
|
|
|
+ if unionid:
|
|
|
+ user = cm.UserInfo.objects.filter(unionid=unionid).values().first()
|
|
|
+
|
|
|
+ #if phone:
|
|
|
+ # orgcode = ccc.cache.get(phone)
|
|
|
+ # if not phcode == orgcode and not phone=="13883187629":
|
|
|
+ # raise ce.TipException(u"验证码不正确!")
|
|
|
+
|
|
|
+ #if unionid:
|
|
|
+ # user = cm.UserInfo.objects.filter(unionid=unionid).values().first()
|
|
|
+
|
|
|
+ #if not user and openid:
|
|
|
+ # user = cm.UserInfo.objects.filter(openid=openid).values().first()
|
|
|
+
|
|
|
+ #if not user and phone:
|
|
|
+ # user = cm.UserInfo.objects.filter(phone=phone).values().first()
|
|
|
+
|
|
|
if not user:
|
|
|
return {}
|
|
|
cur_match_id = ccc.get_signup_match().id
|