fix 修复排序bug
This commit is contained in:
parent
5adbffc9a1
commit
de9650b26b
@ -111,8 +111,10 @@ func (f *FindArticleQuery) Scope(db *gorm.DB) *gorm.DB {
|
||||
if f.Available != nil {
|
||||
db = db.Where("available=?", *f.Available)
|
||||
}
|
||||
if f.RateSort != "" {
|
||||
db = db.Order("rate " + f.RateSort)
|
||||
if f.RateSort == "descend" {
|
||||
db = db.Order("rate desc")
|
||||
} else if f.RateSort == "ascend" {
|
||||
db = db.Order("rate asc")
|
||||
}
|
||||
return db
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user