mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-03 08:35:59 +08:00
Merge remote-tracking branch 'origin/errcode' into errcode
This commit is contained in:
@@ -34,6 +34,8 @@ type CommonMsgDatabase interface {
|
||||
BatchInsertChat2DB(ctx context.Context, conversationID string, msgs []*sdkws.MsgData, currentMaxSeq int64) error
|
||||
// 撤回消息
|
||||
RevokeMsg(ctx context.Context, conversationID string, seq int64, revoke *unRelationTb.RevokeModel) error
|
||||
// mark as read
|
||||
MarkSingleChatMsgsAsRead(ctx context.Context, userID string, conversationID string, seqs []int64) error
|
||||
// 刪除redis中消息缓存
|
||||
DeleteMessageFromCache(ctx context.Context, conversationID string, msgs []*sdkws.MsgData) error
|
||||
// incrSeq然后批量插入缓存
|
||||
@@ -297,6 +299,10 @@ func (db *commonMsgDatabase) RevokeMsg(ctx context.Context, conversationID strin
|
||||
return db.BatchInsertBlock(ctx, conversationID, []any{revoke}, updateKeyRevoke, seq)
|
||||
}
|
||||
|
||||
func (db *commonMsgDatabase) MarkSingleChatMsgsAsRead(ctx context.Context, userID string, conversationID string, seqs []int64) error {
|
||||
return db.msgDocDatabase.MarkSingleChatMsgsAsRead(ctx, userID, conversationID, seqs)
|
||||
}
|
||||
|
||||
func (db *commonMsgDatabase) DeleteMessageFromCache(ctx context.Context, conversationID string, msgs []*sdkws.MsgData) error {
|
||||
return db.cache.DeleteMessageFromCache(ctx, conversationID, msgs)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package relation
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/ormutil"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||
@@ -51,7 +52,7 @@ func (b *BlackGorm) FindOwnerBlacks(ctx context.Context, ownerUserID string, pag
|
||||
if err != nil {
|
||||
return nil, 0, utils.Wrap(err, "")
|
||||
}
|
||||
totalUint32, blacks, err := ormutil.GormPage[relation.BlackModel](b.db(ctx), pageNumber, showNumber)
|
||||
totalUint32, blacks, err := ormutil.GormPage[relation.BlackModel](b.db(ctx).Where("owner_user_id = ?", ownerUserID), pageNumber, showNumber)
|
||||
total = int64(totalUint32)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ type MsgDocModelInterface interface {
|
||||
DeleteDocs(ctx context.Context, docIDs []string) error
|
||||
GetMsgDocModelByIndex(ctx context.Context, conversationID string, index, sort int64) (*MsgDocModel, error)
|
||||
DeleteMsgsInOneDocByIndex(ctx context.Context, docID string, indexes []int) error
|
||||
MarkSingleChatMsgsAsRead(ctx context.Context, userID string, conversationID string, seqs []int64) error
|
||||
}
|
||||
|
||||
func (MsgDocModel) TableName() string {
|
||||
|
||||
@@ -5,9 +5,10 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
||||
"strings"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
||||
|
||||
table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
||||
@@ -278,3 +279,12 @@ func (m *MsgMongoDriver) IsExistDocID(ctx context.Context, docID string) (bool,
|
||||
}
|
||||
return count > 0, nil
|
||||
}
|
||||
|
||||
func (m *MsgMongoDriver) MarkSingleChatMsgsAsRead(ctx context.Context, userID string, conversationID string, seqs []int64) error {
|
||||
indexs := make([]int64, 0, len(seqs))
|
||||
for _, seq := range seqs {
|
||||
indexs = append(indexs, m.model.GetMsgIndex(seq))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
+1141
-1047
File diff suppressed because it is too large
Load Diff
@@ -181,11 +181,12 @@ message MsgData {
|
||||
int64 sendTime = 15;
|
||||
int64 createTime = 16;
|
||||
int32 status = 17;
|
||||
map<string, bool> options = 18;
|
||||
OfflinePushInfo offlinePushInfo = 19;
|
||||
repeated string atUserIDList = 20;
|
||||
string attachedInfo = 21;
|
||||
string ex = 22;
|
||||
bool isRead = 18;
|
||||
map<string, bool> options = 19;
|
||||
OfflinePushInfo offlinePushInfo = 20;
|
||||
repeated string atUserIDList = 21;
|
||||
string attachedInfo = 22;
|
||||
string ex = 23;
|
||||
}
|
||||
message PushMessages{
|
||||
map<string, PullMsgs> msgs = 1;
|
||||
@@ -453,6 +454,12 @@ message DeleteMsgsTips {
|
||||
repeated int64 seqs = 3;
|
||||
}
|
||||
|
||||
message MarkAsReadTips {
|
||||
string markAsReadUserID = 1;
|
||||
string conversationID = 2;
|
||||
repeated int64 seqs = 3;
|
||||
}
|
||||
|
||||
///////////////////signal//////////////
|
||||
message SignalReq {
|
||||
oneof payload {
|
||||
|
||||
Reference in New Issue
Block a user