去年默认配置。

This commit is contained in:
2026-07-22 18:02:05 +08:00
parent aab3aeb5b2
commit 8d0b75e484
7 changed files with 43 additions and 76 deletions
+5
View File
@@ -77,6 +77,11 @@ func GetPosts(c *gin.Context) {
db = db.Where("category_id = ?", query.CategoryID)
}
userId, exists := c.Get("userID")
if exists {
db = db.Where("author_id = ?", userId)
}
if query.TagID > 0 {
db = db.Joins("JOIN post_tags ON post_tags.post_id = posts.id").
Where("post_tags.tag_id = ?", query.TagID)