This commit is contained in:
苏尹岚
2020-12-03 11:33:52 +08:00
parent 088934adbd
commit d12e4edd08

View File

@@ -436,7 +436,7 @@ func GetStationInfoList(db *DaoDB, stationName string, cityCode int, lat, lng fl
SELECT SQL_CALC_FOUND_ROWS * SELECT SQL_CALC_FOUND_ROWS *
` `
if distanceFlag { if distanceFlag {
sql += `, ROUND(POWER((POWER(longitude-?,2))+(POWER(latitude-?,2)),1/2)) distance` sql += `, ROUND(POWER((POWER(longitude-?,2))+(POWER(latitude-?,2)),1/2)) distance2`
sqlParams = append(sqlParams, lng, lat) sqlParams = append(sqlParams, lng, lat)
} }
sql += ` sql += `
@@ -457,9 +457,9 @@ func GetStationInfoList(db *DaoDB, stationName string, cityCode int, lat, lng fl
} }
if sortType != 0 { if sortType != 0 {
if sortType == 1 { if sortType == 1 {
sql += " ORDER BY distance" sql += " ORDER BY distance2"
} else if sortType == -1 { } else if sortType == -1 {
sql += " ORDER BY distance DESC" sql += " ORDER BY distance2 DESC"
} else if sortType == 2 { } else if sortType == 2 {
sql += " ORDER BY star_num" sql += " ORDER BY star_num"
} else if sortType == -2 { } else if sortType == -2 {