Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7e75d5f5eb |
@@ -88,7 +88,7 @@ func (n *AnNaQiGpsClient) GetGpsInfo(longitude, latitude float64) (res *AddressC
|
||||
return nil, errors.New(fmt.Sprintf("获取gps:%s信息失败,%+v", location, apiResult))
|
||||
}
|
||||
|
||||
func (n *AnNaQiGpsClient) GetLocation(city, region, address string) (res *[]Geocode, err error) {
|
||||
func (n *AnNaQiGpsClient) GetLocation(city, region, address string) (res []*Geocode, err error) {
|
||||
values := url.Values{}
|
||||
values.Set("city", city)
|
||||
values.Set("address", region+address)
|
||||
@@ -136,8 +136,8 @@ func (n *AnNaQiGpsClient) GetLocation(city, region, address string) (res *[]Geoc
|
||||
}
|
||||
// 检查API返回状态
|
||||
if locationInfo.Code == 200 {
|
||||
if len(locationInfo.Data.Geocodes) > 0 {
|
||||
return &locationInfo.Data.Geocodes, nil
|
||||
if locationInfo.Data.Count > 0 {
|
||||
return locationInfo.Data.Geocodes, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -65,7 +65,7 @@ type LocationInfo struct {
|
||||
|
||||
type LocationDatum struct {
|
||||
Count int `json:"count"`
|
||||
Geocodes []Geocode `json:"geocodes"`
|
||||
Geocodes []*Geocode `json:"geocodes"`
|
||||
}
|
||||
|
||||
type Geocode struct {
|
||||
|
Reference in New Issue
Block a user