DengBiao vor 1 Jahr
Ursprung
Commit
6a0d2fbf32
3 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen
  1. +1
    -1
      internal/logic/domain/group/model/group.go
  2. +4
    -4
      internal/logic/domain/message/repo/message_repo.go
  3. +1
    -1
      internal/logic/domain/message/service/message_service.go

+ 1
- 1
internal/logic/domain/group/model/group.go Datei anzeigen

@@ -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


+ 4
- 4
internal/logic/domain/message/repo/message_repo.go Datei anzeigen

@@ -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)


+ 1
- 1
internal/logic/domain/message/service/message_service.go Datei anzeigen

@@ -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
}


Laden…
Abbrechen
Speichern