修复了聊天数据异常丢失的bug

This commit is contained in:
2024-10-18 18:15:44 +08:00
parent b27d2b80f7
commit 8a8a6e0bfa
6 changed files with 40 additions and 24 deletions
+13 -11
View File
@@ -5,11 +5,12 @@ import (
)
type ChatMessage struct {
UserID string
UserName string
CreateTx time.Time
Type string
Text string
UserID string // 发言对象
UserName string // 发言对象名字
TarUserID string // 接收对象
CreateTx time.Time
Type string
Text string
}
const (
@@ -17,13 +18,14 @@ const (
ChatTypeCard = "CARD" // 工具卡片分享
)
func NewTextChatMsg(user *Users, text string) *ChatMessage {
func NewTextChatMsg(user *Users, tarUid string, text string) *ChatMessage {
return &ChatMessage{
UserID: user.ID,
UserName: user.Name,
CreateTx: time.Now(),
Type: ChatTypeText,
Text: text,
UserID: user.ID,
UserName: user.Name,
TarUserID: tarUid,
CreateTx: time.Now(),
Type: ChatTypeText,
Text: text,
}
}