Selaa lähdekoodia

Fix修复IP归属地查询出错

更换查询接口,需要配合Nginx解决跨域问题
YueYunyun 2 vuotta sitten
vanhempi
sitoutus
a2c4e6737d
1 muutettua tiedostoa jossa 9 lisäystä ja 6 poistoa
  1. 9 6
      VbdsmUI_V2.1.1/src/pc/manage/js/setting.util.js

+ 9 - 6
VbdsmUI_V2.1.1/src/pc/manage/js/setting.util.js

@@ -492,11 +492,13 @@ define(
 							if (data.lastLoginIp == null || data.lastLoginIp == "" || data.lastLoginIp == undefined) {
 								data.lastLoginIp = firstMsg
 							}
+							data.lastLoginIp = data.lastLoginIp ? data.lastLoginIp.split(",")[0] : ""
+							data.currLoginIp = data.currLoginIp ? data.currLoginIp.split(",")[0] : ""
 							$(".main").html(template.compile(a)({ G: G, LNG: LNG, data: data }))
-							$.getScript("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=" + data.currLoginIp, function (r, s) {
+							$.get("/queryIp?type=1&ip=" + data.currLoginIp, function (s) {
 								var msg = "载入中..."
-								if (s == "success") {
-									msg = remote_ip_info.province + " " + remote_ip_info.city
+								if (s.code == 0) {
+									msg = s.address
 								} else {
 									msg = "获取失败"
 								}
@@ -505,10 +507,11 @@ define(
 							if (firstMsg == data.lastLoginIp) {
 								$("#lastLoginAddr").text(firstMsg)
 							} else {
-								$.getScript("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=" + data.lastLoginIp, function (r, s) {
+								//https://www.ip.cn/api/index?type=1&ip= Nignx代理到此地址,否则会出现跨域错误
+								$.get("/queryIp?type=1&ip=" + data.lastLoginIp, function (s) {
 									var msg = "载入中..."
-									if (s == "success") {
-										msg = remote_ip_info.province + " " + remote_ip_info.city
+									if (s && s.code == 0) {
+										msg = s.address
 									} else {
 										msg = "获取失败"
 									}