Skip to content

Commit

Permalink
当客户端未登录时,前端所属用户显示[未登录]
Browse files Browse the repository at this point in the history
  • Loading branch information
kingmo888 committed Sep 9, 2024
1 parent 175e116 commit d04154a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/views_front.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ def get_all_info():
if device:
devices[peer.rid]['rust_user'] = user.username

for rid in devices.keys():
if not devices[rid].get('rust_user', ''):
devices[rid]['rust_user'] = _('未登录')
for k, v in devices.items():
devices[k]['status'] = _('在线') if (now - datetime.datetime.strptime(v['update_time'], '%Y-%m-%d %H:%M')).seconds <= 120 else _('离线')
return [v for k, v in devices.items()]
Expand Down

0 comments on commit d04154a

Please sign in to comment.