测试账户登陆
This commit is contained in:
parent
c49eca8dc6
commit
167268be50
|
|
@ -3736,12 +3736,15 @@ def bindmp(req):
|
|||
username = data['username']
|
||||
password = data['password']
|
||||
mpopenid = data['mpopenid']
|
||||
userinfo = data['userInfo']
|
||||
userinfo = data.get('userinfo', None)
|
||||
# print(username,password,mpopenid)
|
||||
user = User.objects.filter(username=username, deletemark=1)
|
||||
if user.exists():
|
||||
if check_password(password, user[0].epassword):
|
||||
user.update(mpopenid=mpopenid,headimgurl=userinfo['avatarUrl'],nickname=userinfo['nickName'])
|
||||
if userinfo:
|
||||
user.update(mpopenid=mpopenid,headimgurl=userinfo['avatarUrl'],nickname=userinfo['nickName'])
|
||||
else:
|
||||
user.update(mpopenid=mpopenid)
|
||||
return JsonResponse({"code": 1})
|
||||
else:
|
||||
return JsonResponse({"code": 0})
|
||||
|
|
@ -6324,17 +6327,11 @@ def apiexamtest(req):
|
|||
objs = ExamTestDetail.objects.filter(examtest__id=id).order_by('-score','-took').values(
|
||||
'id', 'user__name', 'user__ubelongpart__partname', 'took', 'score', 'remainnum', 'passcode','starttime', 'testnum')
|
||||
a['cjrydetail'] = list(objs)
|
||||
a['remainnum'] = 0
|
||||
a['testnum'] = 0
|
||||
queryset = ExamTestDetail.objects.filter(examtest__id=id,user__userid=userid)
|
||||
if queryset.exists():
|
||||
a['remainnum'] = queryset[0].remainnum
|
||||
a['testnum'] = queryset[0].testnum
|
||||
return HttpResponse(json.dumps(a, cls=MyEncoder), content_type="application/json")
|
||||
elif a == 'detail':
|
||||
id = req.GET.get('id')
|
||||
a = ExamTest.objects.filter(id=id).values('id', 'num', 'name', 'starttime', 'endtime', 'duration', 'totalscore',
|
||||
'passscore', 'exampaper__total', 'createtime', 'state', 'exampaper__name', 'createuser__name', 'type', 'qrcode', 'testnum')[0]
|
||||
'passscore', 'exampaper__total', 'createtime', 'state', 'exampaper__name', 'createuser__name', 'type', 'qrcode', 'testnum', 'ispublic')[0]
|
||||
a['notinTime'] = 0
|
||||
if a['starttime'] > datetime.now():
|
||||
a['notinTime'] = 1
|
||||
|
|
@ -6342,8 +6339,12 @@ def apiexamtest(req):
|
|||
a['notinTime'] = 1
|
||||
a['remainnum'] = 0
|
||||
a['testnum'] = 0
|
||||
a['canks'] = 0 # 本人是否可参加
|
||||
if a['ispublic'] == 1:
|
||||
a['canks'] = 1
|
||||
queryset = ExamTestDetail.objects.filter(examtest__id=id,user__userid=userid)
|
||||
if queryset.exists():
|
||||
a['canks'] = 1
|
||||
a['remainnum'] = queryset[0].remainnum
|
||||
a['testnum'] = queryset[0].testnum
|
||||
return HttpResponse(json.dumps(a, cls=MyEncoder), content_type="application/json")
|
||||
|
|
|
|||
Loading…
Reference in New Issue