优化了消息数量,筛选和顶部部分

This commit is contained in:
yml2213
2026-06-13 19:03:29 +08:00
parent 3b4cd76e42
commit 9d7184ecde
12 changed files with 223 additions and 12 deletions
@@ -15,6 +15,20 @@ func (h *Handler) List(c *gin.Context) {
h.list(c, Principal{Type: "user", ID: userID})
}
func (h *Handler) UnreadCount(c *gin.Context) {
userID, ok := currentUserID(c)
if !ok {
response.Unauthorized(c, "缺少用户上下文")
return
}
result, err := h.service.CountUnreadMessages(c.Request.Context(), Principal{Type: "user", ID: userID})
if err != nil {
writeChatError(c, err)
return
}
response.OK(c, result)
}
func (h *Handler) Detail(c *gin.Context) {
userID, ok := currentUserID(c)
if !ok {