This commit is contained in:
wangchuxiao
2022-03-28 18:51:48 +08:00
parent d92ac8f588
commit e95400988e
4 changed files with 82 additions and 122 deletions
+7 -21
View File
@@ -3,7 +3,6 @@ package db
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log"
pbMsg "Open_IM/pkg/proto/chat"
officePb "Open_IM/pkg/proto/office"
@@ -527,14 +526,13 @@ type TagUser struct {
}
type TagSendLog struct {
TagID string `bson:"tagID"`
TagName string `bson:"tagName"`
SendID string `bson:"sendID"`
SenderPlatformID int32 `bson:"senderPlatformID"`
Content string `bson:"content"`
ContentType int32 `bson:"contentType"`
SendTime int64 `bson:"sendTime"`
TagUserList []TagUser `bson:"userList"`
TagID string `bson:"tagID"`
TagName string `bson:"tagName"`
SendID string `bson:"sendID"`
SenderPlatformID int32 `bson:"senderPlatformID"`
Content string `bson:"content"`
ContentType int32 `bson:"contentType"`
SendTime int64 `bson:"sendTime"`
}
func (d *DataBases) SaveTagSendLog(sendReq *officePb.SendMsg2TagReq) error {
@@ -552,18 +550,6 @@ func (d *DataBases) SaveTagSendLog(sendReq *officePb.SendMsg2TagReq) error {
ContentType: sendReq.ContentType,
SendTime: time.Now().Unix(),
}
for _, userID := range tag.UserList {
userName, err := im_mysql_model.GetUserNameByUserID(userID)
if err != nil {
log.NewError("", utils.GetSelfFuncName(), "GetUserNameByUserID failed", err.Error())
continue
}
tagUser := TagUser{
UserID: userID,
UserName: userName,
}
tagSendLog.TagUserList = append(tagSendLog.TagUserList, tagUser)
}
_, err := c.InsertOne(ctx, tagSendLog)
return err
}