Merge branch 'master' of github.com:veops/cmdb

This commit is contained in:
pycook 2023-12-23 12:31:52 +08:00
commit 51c42f90be
1 changed files with 21 additions and 0 deletions

View File

@ -692,6 +692,27 @@ class EmployeeCRUD(object):
else:
abort(400, ErrFormat.column_name_not_support)
@staticmethod
def update_last_login_by_uid(uid, last_login=None):
employee = Employee.get_by(acl_uid=uid, first=True, to_dict=False)
if not employee:
return
if last_login:
try:
last_login = datetime.strptime(last_login, '%Y-%m-%d %H:%M:%S')
except Exception as e:
last_login = datetime.now()
else:
last_login = datetime.now()
try:
employee.update(
last_login=last_login
)
return last_login
except Exception as e:
return
def get_user_map(key='uid', acl=None):
"""