conversation add fields

This commit is contained in:
Gordon
2022-04-20 18:47:21 +08:00
committed by Xinwei Xiong(cubxxw-openim)
parent 20000ac670
commit a525db7088
7 changed files with 51 additions and 4 deletions
+2
View File
@@ -43,6 +43,8 @@ type Conversation struct {
DraftTextTime int64 `json:"draftTextTime"`
IsPinned bool `json:"isPinned" binding:"omitempty"`
IsPrivateChat bool `json:"isPrivateChat"`
GroupAtType int32 `json:"groupAtType"`
IsNotInGroup bool `json:"isNotInGroup"`
AttachedInfo string `json:"attachedInfo"`
Ex string `json:"ex"`
}
+2
View File
@@ -215,6 +215,8 @@ type Conversation struct {
DraftTextTime int64 `gorm:"column:draft_text_time" json:"draftTextTime"`
IsPinned bool `gorm:"column:is_pinned" json:"isPinned"`
IsPrivateChat bool `gorm:"column:is_private_chat" json:"isPrivateChat"`
GroupAtType int32 `gorm:"column:group_at_type" json:"groupAtType"`
IsNotInGroup bool `gorm:"column:is_not_in_group" json:"isNotInGroup"`
AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"`
Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"`
}
@@ -321,7 +321,8 @@ func SetConversation(conversation db.Conversation) error {
log.NewDebug("", utils.GetSelfFuncName(), "conversation", conversation, "exist in db, update")
//force update
return dbConn.Model(conversation).Where("owner_user_id = ? and conversation_id = ?", conversation.OwnerUserID, conversation.ConversationID).
Update(map[string]interface{}{"recv_msg_opt": conversation.RecvMsgOpt, "is_pinned": conversation.IsPinned, "is_private_chat": conversation.IsPrivateChat}).Error
Update(map[string]interface{}{"recv_msg_opt": conversation.RecvMsgOpt, "is_pinned": conversation.IsPinned, "is_private_chat": conversation.IsPrivateChat,
"group_at_type": conversation.GroupAtType, "is_not_in_group": conversation.IsNotInGroup}).Error
}
}
+2
View File
@@ -85,6 +85,8 @@ func GetConversationIDBySessionType(sourceID string, sessionType int) string {
return "single_" + sourceID
case constant.GroupChatType:
return "group_" + sourceID
case constant.NotificationChatType:
return "notification_" + sourceID
}
return ""
}