mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-04 03:12:19 +08:00
fix: the original message referenced by the pull message processing is withdrawn
This commit is contained in:
parent
248b2b7cf8
commit
42009fd9a5
@ -420,30 +420,31 @@ func (db *commonMsgDatabase) handlerDBMsg(ctx context.Context, userID, conversat
|
|||||||
if msg.Msg.Content == "" {
|
if msg.Msg.Content == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//var quoteMsgItem map[string]json.RawMessage
|
||||||
var quoteMsg struct {
|
var quoteMsg struct {
|
||||||
Text string `json:"text,omitempty"`
|
Text string `json:"text,omitempty"`
|
||||||
QuoteMsg *sdkws.MsgData `json:"quote_msg,omitempty"`
|
QuoteMessage *sdkws.MsgData `json:"quoteMessage,omitempty"`
|
||||||
MessageEntityList json.RawMessage `json:"messageEntityList,omitempty"`
|
MessageEntityList json.RawMessage `json:"messageEntityList,omitempty"`
|
||||||
}
|
}
|
||||||
if err := json.Unmarshal([]byte(msg.Msg.Content), "eMsg); err != nil {
|
if err := json.Unmarshal([]byte(msg.Msg.Content), "eMsg); err != nil {
|
||||||
log.ZError(ctx, "json.Unmarshal", err)
|
log.ZError(ctx, "json.Unmarshal", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if quoteMsg.QuoteMsg == nil || quoteMsg.QuoteMsg.ContentType == constant.MsgRevokeNotification {
|
if quoteMsg.QuoteMessage == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
msgs, err := db.msgDocDatabase.GetMsgBySeqIndexIn1Doc(ctx, userID, db.msg.GetDocID(conversationID, quoteMsg.QuoteMsg.Seq), []int64{quoteMsg.QuoteMsg.Seq})
|
msgs, err := db.msgDocDatabase.GetMsgBySeqIndexIn1Doc(ctx, userID, db.msg.GetDocID(conversationID, quoteMsg.QuoteMessage.Seq), []int64{quoteMsg.QuoteMessage.Seq})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ZError(ctx, "GetMsgBySeqIndexIn1Doc", err, "conversationID", conversationID, "seq", quoteMsg.QuoteMsg.Seq)
|
log.ZError(ctx, "GetMsgBySeqIndexIn1Doc", err, "conversationID", conversationID, "seq", quoteMsg.QuoteMessage.Seq)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(msgs) == 0 {
|
if len(msgs) == 0 {
|
||||||
return
|
quoteMsg.QuoteMessage = nil
|
||||||
}
|
} else {
|
||||||
if msgs[0].Msg.ContentType == constant.MsgRevokeNotification {
|
if msgs[0].Msg.ContentType == constant.MsgRevokeNotification {
|
||||||
quoteMsg.QuoteMsg.ContentType = constant.MsgRevokeNotification
|
quoteMsg.QuoteMessage.ContentType = constant.MsgRevokeNotification
|
||||||
quoteMsg.QuoteMsg.Content = []byte(msgs[0].Msg.Content)
|
quoteMsg.QuoteMessage.Content = []byte(msgs[0].Msg.Content)
|
||||||
return
|
}
|
||||||
}
|
}
|
||||||
data, err := json.Marshal("eMsg)
|
data, err := json.Marshal("eMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -144,9 +144,9 @@ func Test_BatchInsertChat2DB(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetDB() *commonMsgDatabase {
|
func GetDB() *commonMsgDatabase {
|
||||||
config.Config.Mongo.Address = []string{"192.168.44.128:37017"}
|
config.Config.Mongo.Address = []string{"203.56.175.233:37017"}
|
||||||
// config.Config.Mongo.Timeout = 60
|
// config.Config.Mongo.Timeout = 60
|
||||||
config.Config.Mongo.Database = "openIM"
|
config.Config.Mongo.Database = "openIM_v3"
|
||||||
// config.Config.Mongo.Source = "admin"
|
// config.Config.Mongo.Source = "admin"
|
||||||
config.Config.Mongo.Username = "root"
|
config.Config.Mongo.Username = "root"
|
||||||
config.Config.Mongo.Password = "openIM123"
|
config.Config.Mongo.Password = "openIM123"
|
||||||
@ -232,37 +232,17 @@ func Test_FindBySeq(t *testing.T) {
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//func Test_Delete1(t *testing.T) {
|
func TestName(t *testing.T) {
|
||||||
// config.Config.Mongo.DBAddress = []string{"192.168.44.128:37017"}
|
db := GetDB()
|
||||||
// config.Config.Mongo.DBTimeout = 60
|
var seqs []int64
|
||||||
// config.Config.Mongo.DBDatabase = "openIM"
|
for i := int64(1); i <= 4; i++ {
|
||||||
// config.Config.Mongo.DBSource = "admin"
|
seqs = append(seqs, i)
|
||||||
// config.Config.Mongo.DBUserName = "root"
|
}
|
||||||
// config.Config.Mongo.DBPassword = "openIM123"
|
msgs, err := db.getMsgBySeqsRange(context.Background(), "4931176757", "si_3866692501_4931176757", seqs, seqs[0], seqs[len(seqs)-1])
|
||||||
// config.Config.Mongo.DBMaxPoolSize = 100
|
if err != nil {
|
||||||
// config.Config.Mongo.DBRetainChatRecords = 3650
|
t.Fatal(err)
|
||||||
// config.Config.Mongo.ChatRecordsClearTime = "0 2 * * 3"
|
}
|
||||||
//
|
|
||||||
// mongo, err := unrelation.NewMongo()
|
t.Log(msgs)
|
||||||
// if err != nil {
|
|
||||||
// panic(err)
|
}
|
||||||
// }
|
|
||||||
// err = mongo.GetDatabase().Client().Ping(context.Background(), nil)
|
|
||||||
// if err != nil {
|
|
||||||
// panic(err)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// c := mongo.GetClient().Database("openIM").Collection("msg")
|
|
||||||
//
|
|
||||||
// var o unrelationtb.MsgDocModel
|
|
||||||
//
|
|
||||||
// err = c.FindOne(context.Background(), bson.M{"doc_id": "test:0"}).Decode(&o)
|
|
||||||
// if err != nil {
|
|
||||||
// panic(err)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for i, model := range o.Msg {
|
|
||||||
// fmt.Println(i, model == nil)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user