feat: 添加通知处理程序,实现通知的获取、标记已读、删除、创建和广播功能。

This commit is contained in:
2026-01-29 14:44:18 +08:00
parent d68577db79
commit 1e0ef5c5db

View File

@@ -73,23 +73,17 @@ func (h *NotificationHandler) GetNotifications(c *gin.Context) {
return
}
// Calculate total pages
totalPages := 0
if result.Limit > 0 {
totalPages = int((result.Total + int64(result.Limit) - 1) / int64(result.Limit))
}
// Calculate current page (1-indexed)
currentPage := 1
if result.Limit > 0 {
currentPage = (result.Offset / result.Limit) + 1
}
api.SuccessWithMeta(c, result.Notifications, &api.Meta{
Page: currentPage,
PageSize: result.Limit,
TotalCount: result.Total,
TotalPages: totalPages,
api.Success(c, gin.H{
"notifications": result.Notifications,
"total": result.Total,
"page": currentPage,
"limit": result.Limit,
})
}