From 9e7de82c9c9ba9344870a74e57d6ada8df333266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 3 Nov 2020 15:08:01 +0800 Subject: [PATCH] getjobs --- business/model/dao/dao_job.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 ?"