SYNC_INBOX 补 conversation_type、peer_id、group_id 和 last_read_msg_id。历史消息在 sender 为 0 时用 peer_id 定位对方。已读清未读时保留会话 ZSET 分数,避免被毫秒时间戳冲到游标后面。 Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
957 B
Go
29 lines
957 B
Go
package entity
|
|
|
|
type Preview struct {
|
|
ConversationID int64
|
|
MsgID int64
|
|
Snippet []byte
|
|
}
|
|
|
|
// DialogHit is a ZSET member updated after dialog_score.
|
|
type DialogHit struct {
|
|
ConversationID int64
|
|
Score int64
|
|
}
|
|
|
|
// Dialog is one conversation row for SYNC_INBOX.
|
|
// PeerID is the other user in a P2P chat (conversation_type=1), relative to the viewer.
|
|
// GroupID is groups.id (群号) when conversation_type=2. It is not conversation_id.
|
|
// LastReadMsgID is that viewer's member cursor; 0 means nothing read.
|
|
type Dialog struct {
|
|
ConversationID int64 `json:"conversation_id"`
|
|
ConversationType int `json:"conversation_type,omitempty"`
|
|
PeerID int64 `json:"peer_id,omitempty"`
|
|
GroupID int64 `json:"group_id,omitempty"`
|
|
LastReadMsgID int64 `json:"last_read_msg_id,omitempty"`
|
|
Score int64 `json:"score"`
|
|
Unread int64 `json:"unread"`
|
|
Preview []byte `json:"preview"`
|
|
}
|