feat: 实时消息与管理端运营能力
新增群聊/私信与公共 WebSocket 总线,站长用户内容档案,并将通知与待审角标改为推送驱动;同步精简管理仪表盘并修复主题换肤 DOM 冲突。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,6 +20,15 @@ func (h *Handlers) Posts(c *gin.Context) {
|
||||
keyword := c.Query("keyword")
|
||||
recommended := c.Query("recommended") == "true"
|
||||
|
||||
var viewerID uint
|
||||
var actor *service.Actor
|
||||
if claims := middleware.CurrentUser(c); claims != nil {
|
||||
viewerID = claims.ID
|
||||
if a, err := h.Auth.LoadActor(claims.ID); err == nil {
|
||||
actor = a
|
||||
}
|
||||
}
|
||||
|
||||
items, total, err := h.Post.List(service.PostListQuery{
|
||||
BoardID: uint(boardID),
|
||||
Page: page,
|
||||
@@ -27,6 +36,8 @@ func (h *Handlers) Posts(c *gin.Context) {
|
||||
Sort: sort,
|
||||
Keyword: keyword,
|
||||
Recommended: recommended,
|
||||
ViewerID: viewerID,
|
||||
Actor: actor,
|
||||
})
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
@@ -109,6 +120,11 @@ func (h *Handlers) CreatePost(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
if post.Status == model.ContentStatusPublished {
|
||||
h.broadcastFeedChanged("post", post.ID, post.BoardID, claims.ID)
|
||||
} else if post.Status == model.ContentStatusPending {
|
||||
h.notifyPendingReview(post.BoardID, claims.ID, post.ID, 0, "有新帖待审核:"+post.Title)
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"post": post})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user