|
@@ -120,7 +120,7 @@ def login_user_v3(request):
|
|
|
if openid:
|
|
if openid:
|
|
|
user = cm.UserInfo.objects.filter(openid=openid).order_by("-id").first()
|
|
user = cm.UserInfo.objects.filter(openid=openid).order_by("-id").first()
|
|
|
else:
|
|
else:
|
|
|
- if unionid or openid:
|
|
|
|
|
|
|
+ if unionid or phone:
|
|
|
user = cm.UserInfo.objects.filter(Q(phone=phone)|Q(unionid=unionid)).order_by("-id").first()
|
|
user = cm.UserInfo.objects.filter(Q(phone=phone)|Q(unionid=unionid)).order_by("-id").first()
|
|
|
|
|
|
|
|
if not user:
|
|
if not user:
|
|
@@ -150,9 +150,16 @@ def login_user_v3(request):
|
|
|
user.unionid = unionid
|
|
user.unionid = unionid
|
|
|
user.save()
|
|
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()
|
|
|
|
|
+ if player:
|
|
|
|
|
+ role = player.role
|
|
|
|
|
+ else:
|
|
|
|
|
+ role = user.role
|
|
|
|
|
+
|
|
|
tstr = "{}_{}{}".format(user.id,time.time(),random.randint(100000,999999))
|
|
tstr = "{}_{}{}".format(user.id,time.time(),random.randint(100000,999999))
|
|
|
token = aescbc.encrypt(tstr)
|
|
token = aescbc.encrypt(tstr)
|
|
|
- return {"id":user.id,"token":token,"status":1,"role":user.role}
|
|
|
|
|
|
|
+ return {"id":user.id,"token":token,"status":1,"role":role}
|
|
|
|
|
|
|
|
def bind_user_phone(request):
|
|
def bind_user_phone(request):
|
|
|
"""
|
|
"""
|
|
@@ -180,13 +187,14 @@ def get_wxauth_info_v3(request):
|
|
|
user = None
|
|
user = None
|
|
|
if openid:
|
|
if openid:
|
|
|
user = cm.UserInfo.objects.filter(openid=openid).values().first()
|
|
user = cm.UserInfo.objects.filter(openid=openid).values().first()
|
|
|
- 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 unionid:
|
|
|
|
|
- user = cm.UserInfo.objects.filter(unionid=unionid).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 unionid:
|
|
|
|
|
+ user = cm.UserInfo.objects.filter(unionid=unionid).values().first()
|
|
|
if not user:
|
|
if not user:
|
|
|
return {}
|
|
return {}
|
|
|
cur_match_id = ccc.get_signup_match().id
|
|
cur_match_id = ccc.get_signup_match().id
|