Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fangyeqing
/
xkl-interface
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
zhaoyue
7 years ago
Commit
708af4dab7a92592f967f2e899ad48f6bc75a213
1 parent
5877511e
Mod get real ip
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
src/main/java/com/xkl/authorization/resolvers/CurrentAdminMethodArgumentResolver.java
src/main/java/com/xkl/authorization/resolvers/CurrentAdminMethodArgumentResolver.java
View file @
708af4d
...
...
@@ -49,7 +49,12 @@ public class CurrentAdminMethodArgumentResolver implements HandlerMethodArgument
//从数据库中查询并返回
XklAdminEntity
admin
=
adminRepository
.
findByIdAndStatus
(
Long
.
parseLong
(
currentAdminId
),
Constants
.
STATUS_OK
);
HttpServletRequest
request
=
((
ServletWebRequest
)
webRequest
).
getRequest
();
String
ip
=
request
.
getRemoteAddr
();
String
ip
=
null
;
if
(
request
.
getHeader
(
"x-forwarded-for"
)
==
null
)
{
ip
=
request
.
getRemoteAddr
();
}
else
{
ip
=
request
.
getHeader
(
"x-forwarded-for"
);
}
admin
.
setIp
(
ip
);
return
admin
;
}
...
...
Please
register
or
login
to post a comment