Browse Source

update

master
DengBiao 1 year ago
parent
commit
df24e89bb2
3 changed files with 18 additions and 0 deletions
  1. +6
    -0
      internal/logic/domain/group/model/group.go
  2. +11
    -0
      internal/logic/domain/message/repo/message_repo.go
  3. +1
    -0
      pkg/urlwhitelist/urlwhitelist.go

+ 6
- 0
internal/logic/domain/group/model/group.go View File

@@ -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 { if sender.SenderType == pb.SenderType_ST_USER && user.UserId == sender.SenderId {
continue 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) _, err := proxy.MessageProxy.RecallMessageSendToUser(grpclib.NewAndCopyRequestId(ctx), sender, user.UserId, req, message.SendTime)
if err != nil { if err != nil {
return return


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

@@ -59,6 +59,16 @@ func (d *messageRepo) GetMessage(senderId, seq int64) (*model.Message, error) {
return &message, nil 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 更新消息状态 // UpdateStatus 更新消息状态
func (d *messageRepo) UpdateStatus(senderId int64, sendTime time.Time, status int) (int64, error) { 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). 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 { if db.Error != nil {
return 0, gerrors.WrapError(db.Error) return 0, gerrors.WrapError(db.Error)
} }

return db.RowsAffected, nil return db.RowsAffected, nil
} }

+ 1
- 0
pkg/urlwhitelist/urlwhitelist.go View File

@@ -17,4 +17,5 @@ var Logic = map[string]int{
"/pb.LogicExt/AddGroupMembers": 6, "/pb.LogicExt/AddGroupMembers": 6,
"/pb.LogicExt/DeleteGroupMember": 7, "/pb.LogicExt/DeleteGroupMember": 7,
"/pb.LogicExt/UpdateGroup": 8, "/pb.LogicExt/UpdateGroup": 8,
"/pb.LogicExt/CreateGroup": 9,
} }

Loading…
Cancel
Save