Browse Source

消息发送时间

luoyangwei 1 year ago
parent
commit
79b22b5ab7
3 changed files with 3 additions and 0 deletions
  1. 1 0
      models/session.go
  2. 1 0
      server/client.go
  3. 1 0
      server/message.go

+ 1 - 0
models/session.go

@@ -46,6 +46,7 @@ type SessionMessage struct {
 	Content     json.RawMessage `gorm:"type:json"`
 	IsRead      BitBool
 	Received    BitBool
+	SentAt      time.Time
 }
 
 func (*Session) TableName() string {

+ 1 - 0
server/client.go

@@ -221,6 +221,7 @@ func (c *Client) saveMessage(messageId string, messageType int8, content *Chatin
 		ContentType: content.PayloadType,
 		Content:     payload,
 		IsRead:      false,
+		SentAt:      time.UnixMilli(content.SendTime),
 	})
 }
 

+ 1 - 0
server/message.go

@@ -49,6 +49,7 @@ type (
 		Receiver    string             `json:"receiver"`
 		PayloadType ChatingContentType `json:"payloadType"`
 		Payload     any                `json:"payload"`
+		SendTime    int64              `json:"sendTime"`
 	}
 
 	// NotificationContent to client notice message