userid错误
This commit is contained in:
parent
63b6290e0e
commit
5cda05b4c4
|
@ -4,18 +4,19 @@ $.ajaxSetup({
|
||||||
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
||||||
},
|
},
|
||||||
complete:function(xhr, status){
|
complete:function(xhr, status){
|
||||||
if(xhr.status==405){
|
// if(xhr.status==405){
|
||||||
$.messager.alert('错误','超时请重新登陆!','error',function(){
|
// $.messager.alert('错误','超时请重新登陆!','error',function(){
|
||||||
top.location = "http://" + window.location.host;
|
// top.location = "http://" + window.location.host;
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
try{
|
try{
|
||||||
var jsonData = JSON.parse(xhr.responseText);
|
var jsonData = JSON.parse(xhr.responseText);
|
||||||
if(jsonData.code == -1){
|
if(jsonData.code == -1){
|
||||||
//如果超时就处理 ,指定要跳转的页面(比如登陆页)
|
//如果超时就处理 ,指定要跳转的页面(比如登陆页)
|
||||||
$.messager.alert('错误','请重新登陆!','error',function(){
|
|
||||||
location.reload()
|
location.reload()
|
||||||
});
|
// $.messager.alert('错误','请重新登陆!','error',function(){
|
||||||
|
|
||||||
|
// });
|
||||||
}else if(jsonData.code == 0){
|
}else if(jsonData.code == 0){
|
||||||
//其他的异常情况,给个提示。
|
//其他的异常情况,给个提示。
|
||||||
// $.messager.alert('错误','操作失败!','error');
|
// $.messager.alert('错误','操作失败!','error');
|
||||||
|
|
|
@ -137,7 +137,7 @@ def check_session(req):
|
||||||
if req.session.get('userid', None):
|
if req.session.get('userid', None):
|
||||||
return JsonResponse({"code": 1})
|
return JsonResponse({"code": 1})
|
||||||
else:
|
else:
|
||||||
return JsonResponse({"code": 0})
|
return JsonResponse({"code": -1})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -4056,7 +4056,11 @@ def apisocert(req):
|
||||||
return HttpResponse(transjson(total, a), content_type="application/json")
|
return HttpResponse(transjson(total, a), content_type="application/json")
|
||||||
elif a == 'listself':
|
elif a == 'listself':
|
||||||
userid = req.session['userid']
|
userid = req.session['userid']
|
||||||
cardnum = Userprofile.objects.get(user__userid=userid).cardnum
|
userprofile = Userprofile.objects.filter(user__userid=userid)
|
||||||
|
if userprofile.exists():
|
||||||
|
cardnum = userprofile[0].cardnum
|
||||||
|
else:
|
||||||
|
return JsonResponse({'code':0,'msg':'信息不全'})
|
||||||
a = Socertificate.objects.filter(
|
a = Socertificate.objects.filter(
|
||||||
cardnum=cardnum).order_by('id') # 无deletemark
|
cardnum=cardnum).order_by('id') # 无deletemark
|
||||||
total = a.count()
|
total = a.count()
|
||||||
|
@ -6818,7 +6822,7 @@ def apiarea(req):
|
||||||
Area.objects.filter(id=data['id']).update(name=name, order=order)
|
Area.objects.filter(id=data['id']).update(name=name, order=order)
|
||||||
return JsonResponse({"code": 1})
|
return JsonResponse({"code": 1})
|
||||||
|
|
||||||
|
@apicheck_login
|
||||||
def apimapshow(req):
|
def apimapshow(req):
|
||||||
a = req.GET.get('a')
|
a = req.GET.get('a')
|
||||||
userid = req.session['userid']
|
userid = req.session['userid']
|
||||||
|
|
Loading…
Reference in New Issue