mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-01 07:35:58 +08:00
tag
This commit is contained in:
+11
-14
@@ -526,28 +526,25 @@ type TagUser struct {
|
||||
}
|
||||
|
||||
type TagSendLog struct {
|
||||
TagID string `bson:"tag_id"`
|
||||
TagName string `bson:"tag_name"`
|
||||
SendID string `bson:"send_id"`
|
||||
SenderPlatformID int32 `bson:"sender_platform_id"`
|
||||
Content string `bson:"content"`
|
||||
ContentType int32 `bson:"content_type"`
|
||||
SendTime int64 `bson:"send_time"`
|
||||
TagList []string `bson:"tag_list"`
|
||||
GroupList []string `bson:"group_list"`
|
||||
UserList []string `bson:"user_list"`
|
||||
SendID string `bson:"send_id"`
|
||||
SenderPlatformID int32 `bson:"sender_platform_id"`
|
||||
Content string `bson:"content"`
|
||||
SendTime int64 `bson:"send_time"`
|
||||
}
|
||||
|
||||
func (d *DataBases) SaveTagSendLog(sendReq *officePb.SendMsg2TagReq) error {
|
||||
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag)
|
||||
var tag Tag
|
||||
_ = c.FindOne(ctx, bson.M{"user_id": sendReq.SendID, "tag_id": sendReq.TagID}).Decode(&tag)
|
||||
c = d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog)
|
||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog)
|
||||
tagSendLog := TagSendLog{
|
||||
TagID: sendReq.TagID,
|
||||
TagName: tag.TagName,
|
||||
TagList: sendReq.TagList,
|
||||
GroupList: sendReq.GroupList,
|
||||
UserList: sendReq.UserList,
|
||||
SendID: sendReq.SendID,
|
||||
SenderPlatformID: sendReq.SenderPlatformID,
|
||||
Content: sendReq.Content,
|
||||
ContentType: sendReq.ContentType,
|
||||
SendTime: time.Now().Unix(),
|
||||
}
|
||||
_, err := c.InsertOne(ctx, tagSendLog)
|
||||
|
||||
@@ -65,6 +65,20 @@ func GetGroupMemberListByGroupID(groupID string) ([]db.GroupMember, error) {
|
||||
return groupMemberList, nil
|
||||
}
|
||||
|
||||
func GetGroupMemberIDListByGroupID(groupID string) ([]string, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var groupMemberIDList []string
|
||||
err = dbConn.Table("group_members").Select("user_id").Where("group_id=?", groupID).Find(&groupMemberIDList).Error
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return groupMemberIDList, nil
|
||||
}
|
||||
|
||||
func GetGroupMemberListByGroupIDAndRoleLevel(groupID string, roleLevel int32) ([]db.GroupMember, error) {
|
||||
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
if err != nil {
|
||||
|
||||
@@ -377,3 +377,12 @@ func GetConversations(OwnerUserID string, conversationIDs []string) ([]db.Conver
|
||||
err = dbConn.Model(&db.Conversation{}).Where("conversation_id IN (?) and owner_user_id=?", conversationIDs, OwnerUserID).Find(&conversations).Error
|
||||
return conversations, err
|
||||
}
|
||||
|
||||
func CreateConversationIfNotExist(conversation db.Conversation) error {
|
||||
//dbConn, err := db.DB.MysqlDB.DefaultGormDB()
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//err = dbConn.Model(&db.Conversation{}).Where().Find().Error
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user