up
This commit is contained in:
@@ -88,21 +88,28 @@ func (c *NetSpiderController) QueryPageStores() {
|
|||||||
lng1, lat1, lng2, lat2)
|
lng1, lat1, lng2, lat2)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if params.Radius > 0 && (params.Offset != 0 || params.PageSize != model.UnlimitedPageSize) {
|
if params.Radius > 0 && (params.Offset != 0 || params.PageSize != model.UnlimitedPageSize) {
|
||||||
shopList, _ := pagedInfo.Data.([]*dao.PageShopWithPlaceName)
|
shopList2, _ := pagedInfo.Data.([]*dao.PageShopWithPlaceName)
|
||||||
pagedInfo.TotalCount = len(shopList)
|
var shopList []*dao.PageShopWithPlaceName
|
||||||
if len(shopList) > 0 {
|
pagedInfo.TotalCount = 0
|
||||||
|
if len(shopList2) > 0 {
|
||||||
for _, v := range shopList {
|
for _, v := range shopList {
|
||||||
v.Distance = int(jxutils.EarthDistance(v.Lng, v.Lat, lng, lat) * 1000)
|
v.Distance = int(jxutils.EarthDistance(v.Lng, v.Lat, lng, lat) * 1000)
|
||||||
}
|
if v.Distance <= params.Radius {
|
||||||
sort.Sort(PageShopList(shopList))
|
shopList = append(shopList, v)
|
||||||
if params.Offset < len(shopList) {
|
}
|
||||||
index := params.Offset + params.PageSize
|
}
|
||||||
if index > len(shopList) {
|
pagedInfo.TotalCount = len(shopList)
|
||||||
index = len(shopList)
|
if pagedInfo.TotalCount > 0 {
|
||||||
|
sort.Sort(PageShopList(shopList))
|
||||||
|
if params.Offset < len(shopList) {
|
||||||
|
index := params.Offset + params.PageSize
|
||||||
|
if index > len(shopList) {
|
||||||
|
index = len(shopList)
|
||||||
|
}
|
||||||
|
shopList = shopList[params.Offset:index]
|
||||||
|
} else {
|
||||||
|
shopList = nil
|
||||||
}
|
}
|
||||||
shopList = shopList[params.Offset:index]
|
|
||||||
} else {
|
|
||||||
shopList = nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pagedInfo.Data = shopList
|
pagedInfo.Data = shopList
|
||||||
|
|||||||
Reference in New Issue
Block a user