GetStoreListByLocation将营业门店排在前面,缺省至少返回一个门店(为了腾讯审核用)
This commit is contained in:
@@ -110,6 +110,9 @@ func (x Store4UserList) Len() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x Store4UserList) Less(i, j int) bool {
|
func (x Store4UserList) Less(i, j int) bool {
|
||||||
|
if x[i].Status != x[j].Status {
|
||||||
|
return x[i].Status > x[j].Status
|
||||||
|
}
|
||||||
if x[i].WalkDistance != x[j].WalkDistance {
|
if x[i].WalkDistance != x[j].WalkDistance {
|
||||||
return x[i].WalkDistance < x[j].WalkDistance
|
return x[i].WalkDistance < x[j].WalkDistance
|
||||||
}
|
}
|
||||||
@@ -2324,6 +2327,7 @@ func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDi
|
|||||||
FROM store t1
|
FROM store t1
|
||||||
JOIN place city ON city.code = t1.city_code
|
JOIN place city ON city.code = t1.city_code
|
||||||
WHERE t1.deleted_at = ? AND t1.status <> ? AND t1.lng > ? AND t1.lng < ? AND t1.lat > ? AND t1.lat < ?
|
WHERE t1.deleted_at = ? AND t1.status <> ? AND t1.lng > ? AND t1.lng < ? AND t1.lat > ? AND t1.lat < ?
|
||||||
|
ORDER BY t1.id
|
||||||
`
|
`
|
||||||
sqlParams := []interface{}{
|
sqlParams := []interface{}{
|
||||||
utils.DefaultTimeValue,
|
utils.DefaultTimeValue,
|
||||||
@@ -2344,6 +2348,22 @@ func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 为了审核用
|
||||||
|
if len(storeList2) == 0 {
|
||||||
|
sqlParams = []interface{}{
|
||||||
|
utils.DefaultTimeValue,
|
||||||
|
model.StoreStatusDisabled,
|
||||||
|
jxutils.StandardCoordinate2Int(0),
|
||||||
|
jxutils.StandardCoordinate2Int(10000),
|
||||||
|
jxutils.StandardCoordinate2Int(0),
|
||||||
|
jxutils.StandardCoordinate2Int(10000),
|
||||||
|
}
|
||||||
|
dao.GetRows(dao.GetDB(), &storeList2, sql, sqlParams...)
|
||||||
|
if len(storeList2) > 1 {
|
||||||
|
storeList2 = storeList2[:1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 如果要求以步行距离来算
|
// 如果要求以步行距离来算
|
||||||
if needWalkDistance {
|
if needWalkDistance {
|
||||||
var coordList []*autonavi.Coordinate
|
var coordList []*autonavi.Coordinate
|
||||||
|
|||||||
Reference in New Issue
Block a user