aa
This commit is contained in:
@@ -69,39 +69,25 @@ func (a *API) GetCoordinateFromAddressByPage(address string, cityCode int) (lng,
|
||||
}
|
||||
|
||||
type GetCoordinateFromAddressByPageAllResult struct {
|
||||
Suggestion struct {
|
||||
Keywords []interface{} `json:"keywords"`
|
||||
Cities []interface{} `json:"cities"`
|
||||
} `json:"suggestion"`
|
||||
Count string `json:"count"`
|
||||
Infocode string `json:"infocode"`
|
||||
Pois []struct {
|
||||
Parent []interface{} `json:"parent"`
|
||||
Address string `json:"address"`
|
||||
Distance []interface{} `json:"distance"`
|
||||
Pname string `json:"pname"`
|
||||
Importance []interface{} `json:"importance"`
|
||||
BizExt struct {
|
||||
Cost []interface{} `json:"cost"`
|
||||
Rating []interface{} `json:"rating"`
|
||||
} `json:"biz_ext"`
|
||||
BizType []interface{} `json:"biz_type"`
|
||||
Cityname string `json:"cityname"`
|
||||
Type string `json:"type"`
|
||||
Photos []interface{} `json:"photos"`
|
||||
Typecode string `json:"typecode"`
|
||||
Shopinfo string `json:"shopinfo"`
|
||||
Poiweight []interface{} `json:"poiweight"`
|
||||
Childtype []interface{} `json:"childtype"`
|
||||
Adname string `json:"adname"`
|
||||
Name string `json:"name"`
|
||||
Location string `json:"location"`
|
||||
Tel string `json:"tel"`
|
||||
Shopid []interface{} `json:"shopid"`
|
||||
ID string `json:"id"`
|
||||
} `json:"pois"`
|
||||
Status string `json:"status"`
|
||||
Info string `json:"info"`
|
||||
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 []interface{} `json:"distance"`
|
||||
Photos []interface{} `json:"photos"`
|
||||
}
|
||||
|
||||
func (a *API) GetCoordinateFromAddressByPageAll(address string, cityCode int) (getCoordinateFromAddressByPageAllResult *GetCoordinateFromAddressByPageAllResult, err error) {
|
||||
@@ -121,7 +107,7 @@ func (a *API) GetCoordinateFromAddressByPageAll(address string, cityCode int) (g
|
||||
"children": "",
|
||||
})
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result, &getCoordinateFromAddressByPageAllResult, false)
|
||||
utils.Map2StructByJson(result["pois"].([]interface{})[0], &getCoordinateFromAddressByPageAllResult, false)
|
||||
}
|
||||
return getCoordinateFromAddressByPageAllResult, err
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ func TestGetCoordinateFromAddressByPage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCoordinateFromAddressByPageAll(t *testing.T) {
|
||||
result, err := autonaviAPI.GetCoordinateFromAddressByPageAll("兴月宏干杂", 510100)
|
||||
result, err := autonaviAPI.GetCoordinateFromAddressByPageAll("重庆市南岸区南坪正街1号", 500100)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user