fix: reinstall app sync data split.

This commit is contained in:
Gordon
2024-06-28 11:41:27 +08:00
parent b162725bd6
commit f0bd767d81
15 changed files with 292 additions and 70 deletions

View File

@@ -44,22 +44,12 @@ func TriggerCmdNewMsgCome(ctx context.Context, msg sdk_struct.CmdNewMsgComeToCon
return sendCmd(conversationCh, c2v, 100)
}
func TriggerCmdSuperGroupMsgCome(msg sdk_struct.CmdNewMsgComeToConversation, conversationCh chan Cmd2Value) error {
if conversationCh == nil {
return utils.Wrap(errors.New("ch == nil"), "")
}
c2v := Cmd2Value{Cmd: constant.CmdSuperGroupMsgCome, Value: msg}
return sendCmd(conversationCh, c2v, 100)
}
func TriggerCmdNotification(ctx context.Context, msg sdk_struct.CmdNewMsgComeToConversation, conversationCh chan Cmd2Value) error {
if conversationCh == nil {
return utils.Wrap(errors.New("ch == nil"), "")
}
func TriggerCmdNotification(ctx context.Context, msg sdk_struct.CmdNewMsgComeToConversation, conversationCh chan Cmd2Value) {
c2v := Cmd2Value{Cmd: constant.CmdNotification, Value: msg, Ctx: ctx}
return sendCmd(conversationCh, c2v, 100)
err := sendCmd(conversationCh, c2v, 100)
if err != nil {
log.ZWarn(ctx, "TriggerCmdNotification error", err, "msg", msg)
}
}
func TriggerCmdWakeUp(ch chan Cmd2Value) error {

View File

@@ -403,6 +403,8 @@ const (
MsgSyncProcessing = 1002 //
MsgSyncEnd = 1003 //
MsgSyncFailed = 1004
AppDataSyncStart = 1005
AppDataSyncFinish = 1006
)
const (

View File

@@ -173,6 +173,7 @@ type MessageModel interface {
DeleteConversationMsgs(ctx context.Context, conversationID string, msgIDs []string) error
// DeleteConversationMsgsBySeqs(ctx context.Context, conversationID string, seqs []int64) error
SetNotificationSeq(ctx context.Context, conversationID string, seq int64) error
BatchInsertNotificationSeq(ctx context.Context, notificationSeqs []*model_struct.NotificationSeqs) error
GetNotificationAllSeqs(ctx context.Context) ([]*model_struct.NotificationSeqs, error)
}

View File

@@ -21,6 +21,7 @@ import (
"context"
"github.com/openimsdk/openim-sdk-core/v3/pkg/db/model_struct"
"github.com/openimsdk/openim-sdk-core/v3/pkg/utils"
"github.com/openimsdk/tools/errs"
)
func (d *DataBase) SetNotificationSeq(ctx context.Context, conversationID string, seq int64) error {
@@ -36,6 +37,12 @@ func (d *DataBase) SetNotificationSeq(ctx context.Context, conversationID string
return nil
}
func (d *DataBase) BatchInsertNotificationSeq(ctx context.Context, notificationSeqs []*model_struct.NotificationSeqs) error {
d.mRWMutex.Lock()
defer d.mRWMutex.Unlock()
return errs.WrapMsg(d.conn.WithContext(ctx).Create(notificationSeqs).Error, "BatchInsertNotificationSeq failed")
}
func (d *DataBase) GetNotificationAllSeqs(ctx context.Context) ([]*model_struct.NotificationSeqs, error) {
d.mRWMutex.Lock()
defer d.mRWMutex.Unlock()