修改通话请求的状态字段

This commit is contained in:
2025-07-16 10:33:59 +08:00
parent 8fa8ba4a2b
commit b2c02c1db3
7 changed files with 181 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
package models
import "time"
// 统一消息结构(发送方使用)
type SendMessagePayload struct {
RequestType string `json:"request_type"` // 消息类型
@@ -15,6 +17,7 @@ type SendMessagePayload struct {
// 通过用户ID发送消息的结构
type SendToUserPayload struct {
RoomId string `json:"room_id"` // 发送者用户ID
SenderUserID string `json:"sender_user_id"` // 发送者用户ID
ReceiverUserID string `json:"receiver_user_id"` // 接收者用户ID
MessageType int `json:"message_type"` // 消息类型(0-8)
@@ -24,6 +27,19 @@ type SendToUserPayload struct {
CallStatus string `json:"call_status,omitempty"` // 通话状态:invite/accepted/rejected/ended/candidate/offer/answer
}
// 聊天消息记录模型
type XkChatMessage struct {
ID uint `gorm:"primaryKey" json:"id"`
RoomId string `gorm:"type:varchar(100);index" json:"room_id"` // 房间ID
SenderUserID string `gorm:"type:varchar(100);index" json:"sender_user_id"` // 发送者用户ID
ReceiverUserID string `gorm:"type:varchar(100);index" json:"receiver_user_id"` // 接收者用户ID
MessageType int `gorm:"type:int" json:"message_type"` // 消息类型(0-8)
MessageContent string `gorm:"type:text" json:"message_content"` // 消息内容
CallID string `gorm:"type:varchar(100);index" json:"call_id"` // 通话唯一ID
CallStatus string `gorm:"type:varchar(50)" json:"call_status"` // 通话状态
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` // 创建时间
}
// 客户端接收消息结构(最终格式)
type ClientReceivedMessage struct {
SenderID string `json:"sender_id"` // 发送者连接ID