From 7c007e54a3fd79823945db11e9d2af3a6eb2d2c0 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Mon, 25 Apr 2022 19:56:46 +0800 Subject: [PATCH] conversation update --- internal/rpc/conversation/conversaion.go | 2 +- .../db/mysql_model/im_mysql_model/conversation_model.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index aec03fd26..7012e0924 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -47,7 +47,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo if err := utils.CopyStructFields(&conversation, req.Conversation); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", *req.Conversation, err.Error()) } - haveUserID, _ := imdb.GetExistConversationUserIDList(req.Conversation.ConversationID) + haveUserID, _ := imdb.GetExistConversationUserIDList(req.UserIDList, req.Conversation.ConversationID) switch req.FieldType { case constant.FieldRecvMsgOpt: for _, v := range req.UserIDList { diff --git a/pkg/common/db/mysql_model/im_mysql_model/conversation_model.go b/pkg/common/db/mysql_model/im_mysql_model/conversation_model.go index 6dc010784..0af86c57d 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/conversation_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/conversation_model.go @@ -93,13 +93,13 @@ func GetMultipleUserConversationByConversationID(ownerUserIDList []string, conve err = dbConn.Model(&db.Conversation{}).Where("owner_user_id IN ? and conversation_id=?", ownerUserIDList, conversationID).Find(&conversations).Error return conversations, err } -func GetExistConversationUserIDList(conversationID string) ([]string, error) { +func GetExistConversationUserIDList(ownerUserIDList []string, conversationID string) ([]string, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } var resultArr []string - err = dbConn.Table("conversations").Where(" conversation_id=?", conversationID).Pluck("owner_user_id", &resultArr).Error + err = dbConn.Table("conversations").Where(" owner_user_id IN (?) and conversation_id=?", ownerUserIDList, conversationID).Pluck("owner_user_id", &resultArr).Error if err != nil { return nil, err }