1
This commit is contained in:
@@ -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:"页码"`
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user