This commit is contained in:
苏尹岚
2020-12-24 10:12:26 +08:00
parent f4adaaaaa9
commit 65c062b039

View File

@@ -513,10 +513,15 @@ func (a *API) GetCoordinateCityInfo(lng, lat float64) (cityName, cityCode string
if cn, ok := addressComponent["city"].(string); ok {
cityName = cn
} else {
cityName = utils.Interface2String(addressComponent["province"].([]interface{})[0])
if s, ok := addressComponent["province"].(string); ok {
cityName = s
}
}
}
cityCode = utils.Interface2String(addressComponent["citycode"].([]interface{})[0])
if s, ok := addressComponent["citycode"].(string); ok {
cityCode = s
}
// cityCode = utils.Interface2String(addressComponent["citycode"])
}
return cityName, cityCode
}