mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复获取访问ip逻辑
This commit is contained in:
parent
85093b2856
commit
bbc9ee120d
|
@ -132,7 +132,8 @@ export async function getNetIp(req: any) {
|
|||
]),
|
||||
];
|
||||
let ip = ipArray[0];
|
||||
console.log(ipArray);
|
||||
console.log(`访问的ip ${ipArray.toString()}`);
|
||||
|
||||
if (ipArray.length > 1) {
|
||||
for (let i = 0; i < ipArray.length; i++) {
|
||||
const ipNumArray = ipArray[i].split('.');
|
||||
|
@ -148,6 +149,7 @@ export async function getNetIp(req: any) {
|
|||
continue;
|
||||
}
|
||||
ip = ipArray[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
ip = ip.substr(ip.lastIndexOf(':') + 1, ip.length);
|
||||
|
|
|
@ -10,7 +10,7 @@ server {
|
|||
location /api {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://api;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,13 +37,14 @@ const Login = () => {
|
|||
notification.success({
|
||||
message: '登录成功!',
|
||||
description: (
|
||||
<div>
|
||||
<>
|
||||
<div>
|
||||
最后登录时间:{new Date(lastlogon).toLocaleString() || '-'}
|
||||
最后登录时间:
|
||||
{lastlogon ? new Date(lastlogon).toLocaleString() : '-'}
|
||||
</div>
|
||||
<div>最后登录地点:{lastaddr || '-'}</div>
|
||||
<div>最后登录IP:{lastip || '-'}</div>
|
||||
</div>
|
||||
</>
|
||||
),
|
||||
duration: 5,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user