Browse Source

update

master
DengBiao 1 year ago
parent
commit
6a0d2fbf32
3 changed files with 6 additions and 6 deletions
  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 View File

@@ -237,7 +237,7 @@ func (g *Group) RecallSendMessage(ctx context.Context, sender *pb.Sender, req *p
continue 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) req.MessageContent, err = proto.Marshal(msg)
if err != nil { if err != nil {
return return


+ 4
- 4
internal/logic/domain/message/repo/message_repo.go View File

@@ -60,9 +60,9 @@ func (d *messageRepo) GetMessage(senderId, seq int64) (*model.Message, error) {
} }


// GetMessageSeqForSendTime 获取消息状态 // 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 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 { First(&message).Error; err != nil {
return 0, gerrors.WrapError(err) return 0, gerrors.WrapError(err)
} }
@@ -70,8 +70,8 @@ func (d *messageRepo) GetMessageSeqForSendTime(senderId int64, sendTime time.Tim
} }


// UpdateStatus 更新消息状态 // 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) Update("status", status)
if db.Error != nil { if db.Error != nil {
return 0, gerrors.WrapError(db.Error) return 0, gerrors.WrapError(db.Error)


+ 1
- 1
internal/logic/domain/message/service/message_service.go View File

@@ -269,7 +269,7 @@ func (*messageService) RecallMessageSendToUser(ctx context.Context, sender *pb.S
) )


//1、改变消息状态 //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 { if err != nil {
return 0, err return 0, err
} }


Loading…
Cancel
Save