diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 71b2f7e7c..8be4eedba 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -110,6 +110,9 @@ func (x Store4UserList) Len() int { } 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 { return x[i].WalkDistance < x[j].WalkDistance } @@ -2324,6 +2327,7 @@ func GetStoreListByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDi FROM store t1 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 < ? + ORDER BY t1.id ` sqlParams := []interface{}{ 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 { var coordList []*autonavi.Coordinate