File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
dash-fastapi-backend/module_admin/annotation Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change 1212from module_admin .service .login_service import get_current_user
1313from module_admin .service .log_service import OperationLogService , LoginLogService
1414from module_admin .entity .vo .log_vo import OperLogModel , LogininforModel
15+ from config .env import AppConfig
1516
1617
1718def log_decorator (title : str , business_type : int , log_type : Optional [str ] = 'operation' ):
@@ -48,7 +49,7 @@ async def wrapper(*args, **kwargs):
4849 # 获取请求的url
4950 oper_url = request .url .path
5051 # 获取请求的ip及ip归属区域
51- oper_ip = request .headers .get ('remote_addr' )
52+ oper_ip = request .headers .get ('X-Forwarded-For' ) if AppConfig . app_env == 'prod' else request . headers . get ( ' remote_addr' )
5253 oper_location = '内网IP'
5354 try :
5455 if oper_ip != '127.0.0.1' and oper_ip != 'localhost' :
You can’t perform that action at this time.
0 commit comments