This commit is contained in:
苏尹岚
2020-12-17 17:00:47 +08:00
parent 4f5c1a8f2b
commit 2840dec1b7

View File

@@ -111,17 +111,17 @@ func GetJobs(db *DaoDB, userIDs []string, categoryIDs, statuss, vendorIDs, types
} }
if sortType != 0 { if sortType != 0 {
if sortType == sortTypeDistance { if sortType == sortTypeDistance {
sql += ` ORDER BY job_span_top, top_seq, distance` sql += ` ORDER BY job_span_top DESC, top_seq, distance`
} else if sortType == -sortTypeDistance { } else if sortType == -sortTypeDistance {
sql += ` ORDER BY job_span_top, top_seq, distance DESC` sql += ` ORDER BY job_span_top DESC, top_seq, distance DESC`
} else if sortType == sortTypeAvgPrice { } else if sortType == sortTypeAvgPrice {
sql += ` ORDER BY job_span_top, top_seq, a.avg_price` sql += ` ORDER BY job_span_top DESC, top_seq, a.avg_price`
} else if sortType == -sortTypeAvgPrice { } else if sortType == -sortTypeAvgPrice {
sql += ` ORDER BY job_span_top, top_seq, a.avg_price DESC` sql += ` ORDER BY job_span_top DESC, top_seq, a.avg_price DESC`
} else if sortType == sortTypeTime { } else if sortType == sortTypeTime {
sql += ` ORDER BY job_span_top, top_seq, a.created_at` sql += ` ORDER BY job_span_top DESC, top_seq, a.created_at`
} else if sortType == -sortTypeTime { } else if sortType == -sortTypeTime {
sql += ` ORDER BY job_span_top, top_seq, a.created_at DESC` sql += ` ORDER BY job_span_top DESC, top_seq, a.created_at DESC`
} }
} }
sql += " LIMIT ? OFFSET ?" sql += " LIMIT ? OFFSET ?"