refactor(dto): change seq field type from string to int64
Update the `Seq` field in `WSEventResponse` and its usages across message and websocket handlers to use `int64` instead of `string`. This aligns the data transfer object with the underlying message sequence type and removes unnecessary string conversions.
This commit is contained in:
@@ -745,7 +745,7 @@ type WSEventResponse struct {
|
||||
Type string `json:"type"` // 事件类型 (message, notification, system等)
|
||||
DetailType string `json:"detail_type"` // 详细类型 (private, group, like, comment等)
|
||||
ConversationID string `json:"conversation_id"` // 会话ID
|
||||
Seq string `json:"seq"` // 消息序列号
|
||||
Seq int64 `json:"seq"` // 消息序列号
|
||||
Segments model.MessageSegments `json:"segments"` // 消息段数组
|
||||
SenderID string `json:"sender_id"` // 发送者用户ID
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ func (h *MessageHandler) HandleSendMessage(c *gin.Context) {
|
||||
Type: "message",
|
||||
DetailType: params.DetailType,
|
||||
ConversationID: conversationID,
|
||||
Seq: strconv.FormatInt(msg.Seq, 10),
|
||||
Seq: msg.Seq,
|
||||
Segments: params.Segments,
|
||||
SenderID: userID,
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@@ -459,7 +458,7 @@ func (h *WSHandler) handleChat(ctx context.Context, client *ws.Client, payload j
|
||||
Type: "message",
|
||||
DetailType: detailType,
|
||||
ConversationID: req.ConversationID,
|
||||
Seq: strconv.FormatInt(message.Seq, 10),
|
||||
Seq: message.Seq,
|
||||
Segments: req.Segments,
|
||||
SenderID: client.UserID,
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ func (s *pushServiceImpl) pushViaWebSocket(ctx context.Context, userID string, m
|
||||
Type: "message",
|
||||
DetailType: detailType,
|
||||
ConversationID: message.ConversationID,
|
||||
Seq: fmt.Sprintf("%d", message.Seq),
|
||||
Seq: message.Seq,
|
||||
Segments: segments,
|
||||
SenderID: message.SenderID,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user