From 6def3252d85cc31852cf82d5c1c0a729fe41d66d Mon Sep 17 00:00:00 2001 From: timerzz Date: Mon, 2 Dec 2024 20:14:25 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E4=BF=AE=E6=94=B9article=E7=9A=84?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/article.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 }