mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 09:36:00 +08:00
EX MSG
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"context"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
const cExtendMsgSet = "extend_msg_set"
|
||||
|
||||
type ExtendMsgSet struct {
|
||||
ID string `bson:"id" json:"ID"`
|
||||
ExtendMsg []*ExtendMsg `bson:"extend_msg" json:"extendMsg"`
|
||||
ExtendMsgs []*ExtendMsg `bson:"extend_msg" json:"extendMsg"`
|
||||
LatestUpdateTime int32 `bson:"latest_update_time" json:"latestUpdateTime"`
|
||||
AttachedInfo string `bson:"attached_info" json:"attachedInfo"`
|
||||
Ex string `bson:"ex" json:"ex"`
|
||||
@@ -10,40 +19,82 @@ type ExtendMsgSet struct {
|
||||
CreateTime int32 `bson:"create_time" json:"createTime"`
|
||||
}
|
||||
|
||||
type ReactionExtendMsgSet struct {
|
||||
TypeKey string `bson:"type_key" json:"typeKey"`
|
||||
Value string `bson:"value" json:"value"`
|
||||
}
|
||||
|
||||
type ExtendMsg struct {
|
||||
SendID string `bson:"send_id" json:"sendID"`
|
||||
ServerMsgID string `bson:"server_msg_id" json:"serverMsgID"`
|
||||
Ex string `bson:"ex" json:"ex"`
|
||||
AttachedInfo string `bson:"attached_info" json:"attachedInfo"`
|
||||
LikeUserIDList []string `bson:"like_user_id_list" json:"likeUserIDList"`
|
||||
Content string `bson:"content" json:"content"`
|
||||
ExtendMsgComments []*ExtendMsgComment `bson:"extend_msg_comments" json:"extendMsgComment"`
|
||||
Vote *Vote `bson:"vote" json:"vote"`
|
||||
Urls []string `bson:"urls" json:"urls"`
|
||||
CreateTime int32 `bson:"create_time" json:"createTime"`
|
||||
Content []*ReactionExtendMsgSet `bson:"content" json:"content"`
|
||||
ClientMsgID string `bson:"client_msg_id" json:"clientMsgID"`
|
||||
CreateTime int32 `bson:"create_time" json:"createTime"`
|
||||
}
|
||||
|
||||
type Vote struct {
|
||||
Content string `bson:"content" json:"content"`
|
||||
AttachedInfo string `bson:"attached_info" json:"attachedInfo"`
|
||||
Ex string `bson:"ex" json:"ex"`
|
||||
Options []*Options `bson:"options" json:"options"`
|
||||
//type Vote struct {
|
||||
// Content string `bson:"content" json:"content"`
|
||||
// AttachedInfo string `bson:"attached_info" json:"attachedInfo"`
|
||||
// Ex string `bson:"ex" json:"ex"`
|
||||
// Options []*Options `bson:"options" json:"options"`
|
||||
//}
|
||||
//
|
||||
//type Options struct {
|
||||
// Content string `bson:"content" json:"content"`
|
||||
// AttachedInfo string `bson:"attached_info" json:"attachedInfo"`
|
||||
// Ex string `bson:"ex" json:"ex"`
|
||||
// VoteUserIDList []string `bson:"vote_user_id_list" json:"voteUserIDList"`
|
||||
//}
|
||||
//
|
||||
//type ExtendMsgComment struct {
|
||||
// UserID string `bson:"user_id" json:"userID"`
|
||||
// ReplyUserID string `bson:"reply_user_id" json:"replyUserID"`
|
||||
// ReplyContentID string `bson:"reply_content_id" json:"replyContentID"`
|
||||
// ContentID string `bson:"content_id" json:"contentID"`
|
||||
// Content string `bson:"content" json:"content"`
|
||||
// CreateTime int32 `bson:"create_time" json:"createTime"`
|
||||
// AttachedInfo string `bson:"attached_info" json:"attachedInfo"`
|
||||
// Ex string `bson:"ex" json:"ex"`
|
||||
//}
|
||||
|
||||
func GetExtendMsgSetID(ID string, index int32) string {
|
||||
return ID + ":" + strconv.Itoa(int(index))
|
||||
}
|
||||
|
||||
type Options struct {
|
||||
Content string `bson:"content" json:"content"`
|
||||
AttachedInfo string `bson:"attached_info" json:"attachedInfo"`
|
||||
Ex string `bson:"ex" json:"ex"`
|
||||
VoteUserIDList []string `bson:"vote_user_id_list" json:"voteUserIDList"`
|
||||
func (d *DataBases) CreateExtendMsgSet(set *ExtendMsgSet) error {
|
||||
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cExtendMsgSet)
|
||||
_, err := c.InsertOne(ctx, set)
|
||||
return err
|
||||
}
|
||||
|
||||
type ExtendMsgComment struct {
|
||||
UserID string `bson:"user_id" json:"userID"`
|
||||
ReplyUserID string `bson:"reply_user_id" json:"replyUserID"`
|
||||
ReplyContentID string `bson:"reply_content_id" json:"replyContentID"`
|
||||
ContentID string `bson:"content_id" json:"contentID"`
|
||||
Content string `bson:"content" json:"content"`
|
||||
CreateTime int32 `bson:"create_time" json:"createTime"`
|
||||
AttachedInfo string `bson:"attached_info" json:"attachedInfo"`
|
||||
Ex string `bson:"ex" json:"ex"`
|
||||
func (d *DataBases) GetAllExtendMsgSet(ID string) ([]*ExtendMsgSet, error) {
|
||||
//ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||
//c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cExtendMsgSet)
|
||||
|
||||
}
|
||||
|
||||
type GetExtendMsgSetOpts struct {
|
||||
IncludeExtendMsgs bool
|
||||
}
|
||||
|
||||
func (d *DataBases) GetExtendMsgSet(ID string, index int32, opts *GetExtendMsgSetOpts) (*ExtendMsgSet, error) {
|
||||
//ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||
//c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cExtendMsgSet)
|
||||
}
|
||||
|
||||
func (d *DataBases) InsertExtendMsg(ID string, msg *ExtendMsg) error {
|
||||
//ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||
//c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cExtendMsgSet)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *DataBases) UpdateOneExtendMsgSet(ID string, index, MsgIndex int32, msg *ExtendMsg, msgSet *ExtendMsgSet) error {
|
||||
//ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||
//c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cExtendMsgSet)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *DataBases) GetExtendMsgList(ID string, index, msgStartIndex, msgEndIndex int32) ([]*ExtendMsgSet, error) {
|
||||
//ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||
//c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cExtendMsgSet)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user