高德page修改

This commit is contained in:
苏尹岚
2020-09-21 13:42:58 +08:00
parent a37663d8ab
commit b703b3fcd8
3 changed files with 8 additions and 6 deletions

View File

@@ -54,10 +54,12 @@ func (a *API) GetCoordinateFromAddressByPage(address string) (lng, lat float64,
"keywords": address,
})
if err == nil {
str := result["pois"].([]interface{})[0].(map[string]interface{})["location"].(string)
strs := strings.Split(str, ",")
if len(strs) > 0 {
return utils.Str2Float64(strs[0]), utils.Str2Float64(strs[1]), err
if len(result["pois"].([]interface{})) > 0 {
str := result["pois"].([]interface{})[0].(map[string]interface{})["location"].(string)
strs := strings.Split(str, ",")
if len(strs) > 0 {
return utils.Str2Float64(strs[0]), utils.Str2Float64(strs[1]), err
}
}
}
return lng, lat, err