From df24e89bb23bc8f50f851adfeed10a1b0812774b Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 11 Apr 2023 12:19:24 +0800 Subject: [PATCH] update --- internal/logic/domain/group/model/group.go | 6 ++++++ internal/logic/domain/message/repo/message_repo.go | 11 +++++++++++ pkg/urlwhitelist/urlwhitelist.go | 1 + 3 files changed, 18 insertions(+) diff --git a/internal/logic/domain/group/model/group.go b/internal/logic/domain/group/model/group.go index 2076abd..9e0c212 100644 --- a/internal/logic/domain/group/model/group.go +++ b/internal/logic/domain/group/model/group.go @@ -236,6 +236,12 @@ func (g *Group) RecallSendMessage(ctx context.Context, sender *pb.Sender, req *p if sender.SenderType == pb.SenderType_ST_USER && user.UserId == sender.SenderId { continue } + + msg.RecallSeq, err = repo.MessageRepo.GetMessageSeqForSendTime(sender.SenderId, message.SendTime) + req.MessageContent, err = proto.Marshal(msg) + if err != nil { + return + } _, err := proxy.MessageProxy.RecallMessageSendToUser(grpclib.NewAndCopyRequestId(ctx), sender, user.UserId, req, message.SendTime) 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 8d17a2a..a6043ff 100644 --- a/internal/logic/domain/message/repo/message_repo.go +++ b/internal/logic/domain/message/repo/message_repo.go @@ -59,6 +59,16 @@ func (d *messageRepo) GetMessage(senderId, seq int64) (*model.Message, error) { return &message, nil } +// GetMessageSeqForSendTime 获取消息状态 +func (d *messageRepo) GetMessageSeqForSendTime(senderId int64, sendTime time.Time) (int64, error) { + var message model.Message + if err := db.DB.Where("sender_id = ? and send_time = ?", senderId, sendTime). + First(&message).Error; err != nil { + return 0, gerrors.WrapError(err) + } + return message.Seq, nil +} + // 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). @@ -66,5 +76,6 @@ func (d *messageRepo) UpdateStatus(senderId int64, sendTime time.Time, status in if db.Error != nil { return 0, gerrors.WrapError(db.Error) } + return db.RowsAffected, nil } diff --git a/pkg/urlwhitelist/urlwhitelist.go b/pkg/urlwhitelist/urlwhitelist.go index 0d4e0e8..99cc387 100644 --- a/pkg/urlwhitelist/urlwhitelist.go +++ b/pkg/urlwhitelist/urlwhitelist.go @@ -17,4 +17,5 @@ var Logic = map[string]int{ "/pb.LogicExt/AddGroupMembers": 6, "/pb.LogicExt/DeleteGroupMember": 7, "/pb.LogicExt/UpdateGroup": 8, + "/pb.LogicExt/CreateGroup": 9, }