mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
[fix] 生成IP,返回可能不是字符串
This commit is contained in:
@@ -21,7 +21,15 @@ func GetRealAddressByIP(ip string) string {
|
|||||||
}
|
}
|
||||||
dst, _ := ToUTF8("GBK", string(res.Body))
|
dst, _ := ToUTF8("GBK", string(res.Body))
|
||||||
toMap := Json2Map(dst)
|
toMap := Json2Map(dst)
|
||||||
return fmt.Sprintf("%s %s", toMap["pro"].(string), toMap["city"].(string))
|
pro := ""
|
||||||
|
city := ""
|
||||||
|
if tPro, ok := toMap["pro"].(string); ok {
|
||||||
|
pro = tPro
|
||||||
|
}
|
||||||
|
if tCity, ok := toMap["city"].(string); ok {
|
||||||
|
city = tCity
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s %s", pro, city)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取局域网ip地址
|
// 获取局域网ip地址
|
||||||
|
|||||||
Reference in New Issue
Block a user