diff --git a/amap/model/dto/poi_dto.go b/amap/model/dto/poi_dto.go index d0a117f..438807b 100644 --- a/amap/model/dto/poi_dto.go +++ b/amap/model/dto/poi_dto.go @@ -9,7 +9,6 @@ type SearchPoiReq struct { Longitude float64 `json:"longitude" dc:"中心点经度(周边搜索时使用)"` Latitude float64 `json:"latitude" dc:"中心点纬度(周边搜索时使用)"` Radius int `d:"3000" json:"radius" dc:"搜索半径(米,默认3000,最大50000)"` - Offset int `d:"20" json:"offset" dc:"每页记录数"` Page int `d:"1" json:"page" dc:"页码"` } diff --git a/amap/service/poi_service.go b/amap/service/poi_service.go index f1dc7aa..8017cb0 100644 --- a/amap/service/poi_service.go +++ b/amap/service/poi_service.go @@ -69,12 +69,8 @@ func (s *poiService) Search(ctx context.Context, req *dto.SearchPoiReq) (res *dt } apiKey := apiKeyVar.String() - offset := req.Offset - if offset < 1 { - offset = 1 - } else if offset > maxOffset { - offset = maxOffset - } + // 每页条数固定使用高德API最大值(25条/页),不从客户端传入 + offset := maxOffset page := req.Page if page < 1 { page = 1 diff --git a/web/src/App.vue b/web/src/App.vue index 0306fc5..be0a886 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -102,7 +102,6 @@ const loading = ref(false) const searched = ref(false) const error = ref('') const page = ref(1) -const offset = ref(20) const maxPage = ref(1) const activePoi = ref(null) @@ -299,7 +298,6 @@ async function doSearch() { kw, city.value, page.value, - offset.value, centerLng.value, centerLat.value, radius.value, @@ -308,7 +306,6 @@ async function doSearch() { total.value = data.total || 0 maxPage.value = data.maxPage || 1 page.value = data.page || 1 - offset.value = data.offset || 20 // 在地图上标注 if (mapRef.value && results.value.length > 0) { diff --git a/web/src/api/poi.js b/web/src/api/poi.js index 8f7b08c..3d43ebe 100644 --- a/web/src/api/poi.js +++ b/web/src/api/poi.js @@ -5,8 +5,8 @@ const api = axios.create({ timeout: 30000, }) -export async function searchPoi(keywords, city = '', page = 1, offset = 20, longitude = 0, latitude = 0, radius = 3000) { - const params = { keywords, page, offset } +export async function searchPoi(keywords, city = '', page = 1, longitude = 0, latitude = 0, radius = 3000) { + const params = { keywords, page } if (city) params.city = city if (longitude) params.longitude = longitude if (latitude) params.latitude = latitude