diff --git a/backend/app/api/v1/services/system/auth_service.py b/backend/app/api/v1/services/system/auth_service.py index a6ac6889..aa1c1734 100644 --- a/backend/app/api/v1/services/system/auth_service.py +++ b/backend/app/api/v1/services/system/auth_service.py @@ -94,7 +94,7 @@ class LoginService: name=user.name, user_name=user.username, ipaddr=request.client.host, - login_location=IpLocalUtil.get_ip_location(request.client.host), + login_location=IpLocalUtil.get_ip_location(str(request.client.host)), os=user_agent.os.family, browser = user_agent.browser.family, login_time=user.last_login diff --git a/backend/app/core/router_class.py b/backend/app/core/router_class.py index 18759b4b..19054d98 100644 --- a/backend/app/core/router_class.py +++ b/backend/app/core/router_class.py @@ -68,7 +68,7 @@ class OperationLogRoute(APIRoute): current_user_id = request.scope.get("user_id") if request.url.path == '/api/v1/system/auth/login': # 只有登录的才会获取登录地址 - login_location = IpLocalUtil.get_ip_location(request.client.host) + login_location = IpLocalUtil.get_ip_location(str(request.client.host)) await OperationLogService.create_log_service(data=OperationLogCreateSchema( request_path = request.url.path, diff --git a/backend/app/utils/ip_local_util.py b/backend/app/utils/ip_local_util.py index 898b765d..df97c8b8 100644 --- a/backend/app/utils/ip_local_util.py +++ b/backend/app/utils/ip_local_util.py @@ -34,7 +34,9 @@ class IpLocalUtil: if not cls.is_valid_ip(ip): logger.error(f"IP格式不合法: {ip}") return "未知" - + + logger.info(f"获取IP归属地: {ip}") + # 内网IP直接返回 if ip == '127.0.0.1' or ip == 'localhost': return '内网IP' diff --git a/start.sh b/start.sh new file mode 100644 index 00000000..daebcfbd --- /dev/null +++ b/start.sh @@ -0,0 +1,11 @@ +cd /home +rm -rf fastapi_vue3_admin/ +git clone https://gitee.com/tao__tao/fastapi_vue3_admin.git +cd fastapi_vue3_admin/frontend +npm install +npm run build +cd home/fastapi_vue3_admin +docker compose kill +docker compose build +docker compose up -d --force-recreate +