refactor(dto): change seq field type from string to int64
All checks were successful
Build Backend / build (push) Successful in 2m2s
Build Backend / build-docker (push) Successful in 1m48s

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:
2026-05-25 02:31:13 +08:00
parent 6bf87fec46
commit 3fc8b38184
4 changed files with 4 additions and 5 deletions

View File

@@ -745,7 +745,7 @@ type WSEventResponse struct {
Type string `json:"type"` // 事件类型 (message, notification, system等) Type string `json:"type"` // 事件类型 (message, notification, system等)
DetailType string `json:"detail_type"` // 详细类型 (private, group, like, comment等) DetailType string `json:"detail_type"` // 详细类型 (private, group, like, comment等)
ConversationID string `json:"conversation_id"` // 会话ID ConversationID string `json:"conversation_id"` // 会话ID
Seq string `json:"seq"` // 消息序列号 Seq int64 `json:"seq"` // 消息序列号
Segments model.MessageSegments `json:"segments"` // 消息段数组 Segments model.MessageSegments `json:"segments"` // 消息段数组
SenderID string `json:"sender_id"` // 发送者用户ID SenderID string `json:"sender_id"` // 发送者用户ID
} }

View File

@@ -418,7 +418,7 @@ func (h *MessageHandler) HandleSendMessage(c *gin.Context) {
Type: "message", Type: "message",
DetailType: params.DetailType, DetailType: params.DetailType,
ConversationID: conversationID, ConversationID: conversationID,
Seq: strconv.FormatInt(msg.Seq, 10), Seq: msg.Seq,
Segments: params.Segments, Segments: params.Segments,
SenderID: userID, SenderID: userID,
} }

View File

@@ -6,7 +6,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"net/http" "net/http"
"strconv"
"strings" "strings"
"sync/atomic" "sync/atomic"
"time" "time"
@@ -459,7 +458,7 @@ func (h *WSHandler) handleChat(ctx context.Context, client *ws.Client, payload j
Type: "message", Type: "message",
DetailType: detailType, DetailType: detailType,
ConversationID: req.ConversationID, ConversationID: req.ConversationID,
Seq: strconv.FormatInt(message.Seq, 10), Seq: message.Seq,
Segments: req.Segments, Segments: req.Segments,
SenderID: client.UserID, SenderID: client.UserID,
} }

View File

@@ -242,7 +242,7 @@ func (s *pushServiceImpl) pushViaWebSocket(ctx context.Context, userID string, m
Type: "message", Type: "message",
DetailType: detailType, DetailType: detailType,
ConversationID: message.ConversationID, ConversationID: message.ConversationID,
Seq: fmt.Sprintf("%d", message.Seq), Seq: message.Seq,
Segments: segments, Segments: segments,
SenderID: message.SenderID, SenderID: message.SenderID,
} }