Commit 369f9aee authored by Davve's avatar Davve

修改用户上下线

parent 3e43517f
......@@ -102,6 +102,7 @@ class LoginView(APIView):
'name': '',
'session_key': data['session'],
'success': 0,
'message': data['message']
}
except Exception as e:
raise e
......
......@@ -49,16 +49,31 @@ class CelebrityUpdateOrCreate(APIView):
def post(self, request):
id = request.POST.get('id', '')
group_ids = list(set(map(lambda x: x.split(":")[0], json.loads(request.POST.get('groups', '[]')))))
gender = request.POST.get('gender')
updates = {
'group_ids': '',
'gender': ''
}
if not id:
group_ids = list(set(map(lambda x: x.split(":")[0], json.loads(request.POST.get('groups', '[]')))))
updates['group_ids'] = group_ids
updates['gender'] = int(gender)
else:
updates['group_ids'] = list(set(json.loads(request.POST.get('groups', '[]'))))
if gender == '男':
updates['gender'] = 0
elif gender == '女':
updates['gender'] = 1
data = {
'name': request.POST.get('name'),
'gender': int(request.POST.get('gender')),
'gender': updates['gender'],
'city_id': request.POST.get('city').split(":")[0],
'is_online': int(request.POST.get('is_online')),
'desc': request.POST.get('description'),
'portrait': request.POST.get('avatar')[:-2],
'group_ids': group_ids,
'group_ids': updates['group_ids'],
}
try:
self.rpc['venus/sun/celebrity/edit'](id=id, data=data).unwrap()
......
......@@ -65,7 +65,8 @@ const user = {
setSession(data.session_key)
resolve()
}else{
Message.error('用户名或者密码错误啦')
console.log(data, '-----------')
Message.error(data['message'])
resolve('/login')
}
}).catch(error => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment