优化查询IP地址
This commit is contained in:
Binary file not shown.
@@ -46,6 +46,10 @@ func main() {
|
||||
log.Fatalf("解析 JSON 时出错: %v", err)
|
||||
}
|
||||
|
||||
// 提取并打印 continent 和 country 字段
|
||||
fmt.Printf("%s%s\n", ipInfo.Data.Continent, ipInfo.Data.Country)
|
||||
if ipInfo.Msg == "查询成功" {
|
||||
// 提取并打印 continent 和 country 字段
|
||||
fmt.Printf("%s%s\n", ipInfo.Data.Continent, ipInfo.Data.Country)
|
||||
} else {
|
||||
fmt.Printf("查询失败\n")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user