From f73a00e73c023b325acc85d76e6b4128205ff6e6 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Mon, 1 Apr 2024 09:56:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E6=88=96=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=97=B6=E7=99=BB=E5=BD=95=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20#I9CYNM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module_admin/annotation/log_annotation.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py b/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py index 13131f8..f443a96 100644 --- a/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py +++ b/ruoyi-fastapi-backend/module_admin/annotation/log_annotation.py @@ -91,8 +91,12 @@ def log_decorator(title: str, business_type: int, log_type: Optional[str] = 'ope login_log = {} if log_type == 'login': user_agent_info = parse(user_agent) - browser = f'{user_agent_info.browser.family} {user_agent_info.browser.version[0]}' - system_os = f'{user_agent_info.os.family} {user_agent_info.os.version[0]}' + browser = f'{user_agent_info.browser.family}' + system_os = f'{user_agent_info.os.family}' + if user_agent_info.browser.version != (): + browser += f' {user_agent_info.browser.version[0]}' + if user_agent_info.os.version != (): + system_os += f' {user_agent_info.os.version[0]}' login_log = dict( ipaddr=oper_ip, loginLocation=oper_location,