diff --git a/business/model/dao/dao_job.go b/business/model/dao/dao_job.go index 43363894e..87decbf5f 100644 --- a/business/model/dao/dao_job.go +++ b/business/model/dao/dao_job.go @@ -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 ?"