feat: 代码片段功能与 Markdown 内嵌片段渲染、文档截图等
This commit is contained in:
@@ -767,6 +767,18 @@ func (s *ChatService) Kick(operatorID, roomID, targetID uint, oversee bool) erro
|
||||
return s.removeMember(roomID, targetID)
|
||||
}
|
||||
|
||||
// DisplayName 取用户群聊展示名(昵称优先,退回用户名);用户不存在/封禁时返回空串
|
||||
func (s *ChatService) DisplayName(userID uint) string {
|
||||
var u model.User
|
||||
if err := s.db.Select("id", "nickname", "username").First(&u, userID).Error; err != nil {
|
||||
return ""
|
||||
}
|
||||
if u.Nickname != "" {
|
||||
return u.Nickname
|
||||
}
|
||||
return u.Username
|
||||
}
|
||||
|
||||
// SendSystemMessage 向房间落库一条系统提示消息(sender_id=0,is_system=true)。
|
||||
// 只推进房间 updated_at,不推进 last_message_id:系统提示不作为会话预览,
|
||||
// 也不参与排序顶置,避免禁言/解禁等管理动作在会话列表伪装成「新消息」。
|
||||
|
||||
Reference in New Issue
Block a user