chore: 同步本地 v9 整改与运营能力

This commit is contained in:
weijuesen
2026-08-17 21:43:26 +08:00
parent 9a426039b7
commit d205d4845b
58 changed files with 4042 additions and 115 deletions
+9 -1
View File
@@ -22,7 +22,15 @@ func RegisterNotificationRoutes(rg *gin.RouterGroup, db *gorm.DB) {
func listNotifications(db *gorm.DB) gin.HandlerFunc {
return func(c *gin.Context) {
var list []model.Notification
db.Order("created_at DESC").Limit(200).Find(&list)
q := db.Order("created_at DESC").Limit(200)
if !hasGlobalAccess(c) {
if userID := currentUserID(c); userID != nil {
q = q.Where("user_id = ?", *userID)
} else {
q = q.Where("1 = 0")
}
}
q.Find(&list)
c.JSON(http.StatusOK, list)
}
}