优化高德调用

This commit is contained in:
沈健
2021-07-22 11:48:04 +08:00
parent da64764651
commit 997e10c1d8
@@ -176,7 +176,7 @@ class GaoDeUtils {
*/
static def parserByGaode(def city, def address) {
JSONObject json = GaoDeApiUtils.geo(city, address)
if (json && json.status == "1") {
if (json && json.info && json.info == "OK") {
def ret = json.geocodes
if (ret) {
def str = ret.get(0).location
@@ -184,6 +184,14 @@ class GaoDeUtils {
def arrs = str.split(",")
return ["lng": arrs[0], "lat": arrs[1]]
}
} else if (json && json.infocode && json.infocode == "10044") {
System.exit(1)
} else if (json && json.infocode && json.infocode == "10004") {
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
Thread.sleep(60000)
} else if (json && json.infocode && json.infocode == "10017") {
// 所请求的资源不可用
System.exit(1)
}
}
}