修复获取访问ip逻辑

This commit is contained in:
hanhh
2021-08-22 14:07:00 +08:00
parent 85093b2856
commit bbc9ee120d
3 changed files with 8 additions and 5 deletions
+3 -1
View File
@@ -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);