diff --git a/internal/logic/domain/group/model/group.go b/internal/logic/domain/group/model/group.go index 9e0c212..4a7adeb 100644 --- a/internal/logic/domain/group/model/group.go +++ b/internal/logic/domain/group/model/group.go @@ -237,7 +237,7 @@ func (g *Group) RecallSendMessage(ctx context.Context, sender *pb.Sender, req *p continue } - msg.RecallSeq, err = repo.MessageRepo.GetMessageSeqForSendTime(sender.SenderId, message.SendTime) + msg.RecallSeq, err = repo.MessageRepo.GetMessageSeqForSendTime(user.UserId, message.SendTime) req.MessageContent, err = proto.Marshal(msg) if err != nil { return diff --git a/internal/logic/domain/message/repo/message_repo.go b/internal/logic/domain/message/repo/message_repo.go index a6043ff..2fe00eb 100644 --- a/internal/logic/domain/message/repo/message_repo.go +++ b/internal/logic/domain/message/repo/message_repo.go @@ -60,9 +60,9 @@ func (d *messageRepo) GetMessage(senderId, seq int64) (*model.Message, error) { } // GetMessageSeqForSendTime 获取消息状态 -func (d *messageRepo) GetMessageSeqForSendTime(senderId int64, sendTime time.Time) (int64, error) { +func (d *messageRepo) GetMessageSeqForSendTime(userId int64, sendTime time.Time) (int64, error) { var message model.Message - if err := db.DB.Where("sender_id = ? and send_time = ?", senderId, sendTime). + if err := db.DB.Where("user_id = ? and send_time = ?", userId, sendTime). First(&message).Error; err != nil { return 0, gerrors.WrapError(err) } @@ -70,8 +70,8 @@ func (d *messageRepo) GetMessageSeqForSendTime(senderId int64, sendTime time.Tim } // UpdateStatus 更新消息状态 -func (d *messageRepo) UpdateStatus(senderId int64, sendTime time.Time, status int) (int64, error) { - db := db.DB.Model(&model.Message{}).Where("sender_id = ? and send_time = ?", senderId, sendTime). +func (d *messageRepo) UpdateStatus(userId int64, sendTime time.Time, status int) (int64, error) { + db := db.DB.Model(&model.Message{}).Where("user_id = ? and send_time = ?", userId, sendTime). Update("status", status) if db.Error != nil { return 0, gerrors.WrapError(db.Error) diff --git a/internal/logic/domain/message/service/message_service.go b/internal/logic/domain/message/service/message_service.go index be7e4c6..bfa6486 100644 --- a/internal/logic/domain/message/service/message_service.go +++ b/internal/logic/domain/message/service/message_service.go @@ -269,7 +269,7 @@ func (*messageService) RecallMessageSendToUser(ctx context.Context, sender *pb.S ) //1、改变消息状态 - _, err = repo.MessageRepo.UpdateStatus(sender.SenderId, sendTime, int(pb.MessageStatus_MS_RECALL)) + _, err = repo.MessageRepo.UpdateStatus(toUserId, sendTime, int(pb.MessageStatus_MS_RECALL)) if err != nil { return 0, err }