aa
This commit is contained in:
@@ -69,28 +69,14 @@ func (a *API) GetCoordinateFromAddressByPage(address string, cityCode int) (lng,
|
||||
}
|
||||
|
||||
type GetCoordinateFromAddressByPageAllResult struct {
|
||||
ID string `json:"id"`
|
||||
Parent []interface{} `json:"parent"`
|
||||
Childtype []interface{} `json:"childtype"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Typecode string `json:"typecode"`
|
||||
BizType []interface{} `json:"biz_type"`
|
||||
Address string `json:"address"`
|
||||
Location string `json:"location"`
|
||||
Tel []interface{} `json:"tel"`
|
||||
Pname string `json:"pname"`
|
||||
Cityname string `json:"cityname"`
|
||||
Adname string `json:"adname"`
|
||||
Importance []interface{} `json:"importance"`
|
||||
Shopid []interface{} `json:"shopid"`
|
||||
Shopinfo string `json:"shopinfo"`
|
||||
Poiweight []interface{} `json:"poiweight"`
|
||||
Distance string `json:"distance"`
|
||||
Photos []interface{} `json:"photos"`
|
||||
Lng float64 `json:"lng"`
|
||||
Lat float64 `json:"lat"`
|
||||
AdName string `json:"adName"`
|
||||
CityName string `json:"cityName"`
|
||||
}
|
||||
|
||||
func (a *API) GetCoordinateFromAddressByPageAll(address string, cityCode int) (getCoordinateFromAddressByPageAllResult *GetCoordinateFromAddressByPageAllResult, err error) {
|
||||
getCoordinateFromAddressByPageAllResult = &GetCoordinateFromAddressByPageAllResult{}
|
||||
result, err := a.AccessStorePage("https://restapi.amap.com/v3/place/text", map[string]interface{}{
|
||||
"s": "rsv3",
|
||||
"key": "e07ffdf58c8e8672037bef0d6cae7d4a",
|
||||
@@ -107,7 +93,17 @@ func (a *API) GetCoordinateFromAddressByPageAll(address string, cityCode int) (g
|
||||
"children": "",
|
||||
})
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["pois"].([]interface{})[0], &getCoordinateFromAddressByPageAllResult, false)
|
||||
if len(result["pois"].([]interface{})) > 0 {
|
||||
str := result["pois"].([]interface{})[0].(map[string]interface{})["location"].(string)
|
||||
strs := strings.Split(str, ",")
|
||||
if len(strs) > 0 {
|
||||
getCoordinateFromAddressByPageAllResult.Lng = utils.Str2Float64(strs[0])
|
||||
getCoordinateFromAddressByPageAllResult.Lat = utils.Str2Float64(strs[1])
|
||||
}
|
||||
getCoordinateFromAddressByPageAllResult.CityName = result["pois"].([]interface{})[0].(map[string]interface{})["cityname"].(string)
|
||||
getCoordinateFromAddressByPageAllResult.AdName = result["pois"].([]interface{})[0].(map[string]interface{})["adname"].(string)
|
||||
}
|
||||
|
||||
}
|
||||
return getCoordinateFromAddressByPageAllResult, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user