fix: 待审通知实时回填审核态并重构消息页体验

This commit is contained in:
2026-09-02 01:39:27 +08:00
parent 2e9c42a34c
commit 1c0f7ede55
18 changed files with 1458 additions and 463 deletions

View File

@@ -421,13 +421,18 @@ func (h *Handlers) APIAdminRejectComment(c *gin.Context) {
title = "未知帖子"
}
pid := comment.PostID
_, _ = h.Message.SendSystem(
cid := comment.ID
floor := comment.Floor
_, _ = h.Message.SendSystemWithRefs(
comment.UserID,
"评论未通过审核",
service.FormatCommentRejectContent(title, comment.PostID, comment.Floor, reason),
model.MessageKindReject,
&pid,
nil,
service.SystemNotifyRefs{
PostID: &pid,
CommentID: &cid,
Floor: &floor,
},
)
}
c.JSON(http.StatusOK, gin.H{"message": "已拒绝该评论并通知作者", "status": model.ContentStatusRejected})

View File

@@ -136,6 +136,20 @@ func (h *Handlers) APIMarkNotificationsRead(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "通知已全部标为已读"})
}
// APIMarkMessageRead 单条消息已读
func (h *Handlers) APIMarkMessageRead(c *gin.Context) {
id, err := strconv.ParseUint(c.Param("id"), 10, 64)
if err != nil || id == 0 {
c.JSON(http.StatusBadRequest, gin.H{"error": "无效的消息"})
return
}
if err := h.Message.MarkMessageRead(h.currentUserID(c), uint(id)); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
c.JSON(http.StatusOK, gin.H{"message": "已标为已读"})
}
// APISendMessage 发送私信
func (h *Handlers) APISendMessage(c *gin.Context) {
var req struct {