feat: msg doc len changed

pull/819/head
wangchuxiao 2 years ago
parent 9b242e5121
commit b3c3dadadb

@ -14,6 +14,9 @@ func (c *MsgTool) ConvertTools() {
log.ZError(ctx, "get all conversation ids failed", err) log.ZError(ctx, "get all conversation ids failed", err)
return return
} }
for _, conversationID := range conversationIDs {
conversationIDs = append(conversationIDs, msgprocessor.GetNotificationConversationIDByConversationID(conversationID))
}
userIDs, err := c.userDatabase.GetAllUserID(ctx, 0, 0) userIDs, err := c.userDatabase.GetAllUserID(ctx, 0, 0)
if err != nil { if err != nil {
log.ZError(ctx, "get all user ids failed", err) log.ZError(ctx, "get all user ids failed", err)

@ -49,6 +49,7 @@ func (m *MsgMongoDriver) ConvertMsgsDocLen(ctx context.Context, conversationIDs
} else { } else {
msgDocModel.Msg = msgDoc.Msg[index:end] msgDocModel.Msg = msgDoc.Msg[index:end]
} }
newMsgDocs = append(newMsgDocs, msgDocModel)
index = end index = end
} else { } else {
break break

@ -100,6 +100,16 @@ func GetConversationIDBySessionType(sessionType int, ids ...string) string {
return "" return ""
} }
func GetNotificationConversationIDByConversationID(conversationID string) string {
l := strings.Split(conversationID, "_")
if len(l) > 1 {
l[0] = "n"
return strings.Join(l, "_")
} else {
return ""
}
}
func GetNotificationConversationID(sessionType int, ids ...string) string { func GetNotificationConversationID(sessionType int, ids ...string) string {
sort.Strings(ids) sort.Strings(ids)
if len(ids) > 2 || len(ids) < 1 { if len(ids) > 2 || len(ids) < 1 {

Loading…
Cancel
Save