This commit is contained in:
苏尹岚
2020-11-03 15:08:01 +08:00
parent e1852e32c4
commit 9e7de82c9c

View File

@@ -85,8 +85,14 @@ func GetJobs(db *DaoDB, userIDs []string, categoryIDs, statuss, vendorIDs, types
sqlParams = append(sqlParams, toTime)
}
if sortType != 0 {
if sortType == sortTypeDistance || sortType == -sortTypeDistance {
if sortType == sortTypeDistance {
sql += ` ORDER distance`
} else if sortType == -sortTypeDistance {
sql += ` ORDER distance DESC`
} else if sortType == sortTypeAvgPrice {
sql += ` ORDER a.avg_price`
} else if sortType == -sortTypeAvgPrice {
sql += ` ORDER a.avg_price DESC`
}
}
sql += " LIMIT ? OFFSET ?"