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