diff --git a/structs/storage/article.go b/structs/storage/article.go index 028b747..962f6bd 100644 --- a/structs/storage/article.go +++ b/structs/storage/article.go @@ -119,7 +119,12 @@ func (f *FindArticleQuery) Scope(db *gorm.DB) *gorm.DB { db = db.Where("available=?", *f.Available) } if f.Ban != nil { - db = db.Where("ban=?", *f.Ban) + if *f.Ban { + db = db.Where("ban=?", *f.Ban) + } else { + db = db.Where("(ban=? or ban is null)", false) + } + } return db }