This commit is contained in:
苏尹岚
2020-12-17 16:48:19 +08:00
parent 3e41f86386
commit 4f5c1a8f2b
2 changed files with 14 additions and 8 deletions

View File

@@ -1129,11 +1129,17 @@ func RefreshJobSpan(ctx *jxcontext.Context) (err error) {
job.ID = jobSpan.JobID
if err = dao.GetEntity(db, job); err == nil {
if jobSpan.SpanType == model.JobSpanTop {
job.TopSeq = 0
job.JobSpanTop = 0
dao.UpdateEntity(db, job, "TopSeq", "JobSpanTop")
} else {
job.RecmdSeq = 0
job.JobSpanRecmd = 0
dao.UpdateEntity(db, job, "RecmdSeq", "JobSpanRecmd")
}
}
jobSpan.DeletedAt = time.Now()
dao.UpdateEntity(db, jobSpan, "DeletedAt")
}
return retVal, err
}, jobSpans)

View File

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