def login(request): '''短信验证登录''' phonenum = request.POST.get('phonenum') vcode = request.POST.get('vcode') if check_vcode(phonenum, vcode): user, created = User.objects.get_or_create(phonenum=phonenum) request.session['uid'] = user.id return render_json(user.to_dict()) else: return render_json(None, error.VCODE_ERROR)
def login(request): '''短信验证登录''' phonenum = request.POST.get('phonenum') vcode = request.POST.get('vcode') if not check_vcode(phonenum, vcode): # 获取用户 user, created = User.objects.get_or_create(phonenum=phonenum) # 记录登录状态 request.session['uid'] = user.id pre_rcmd(user) return render_json(user.to_dict()) else: return render_json(None, error.OK)