Bladeren bron

update

master
DengBiao 1 jaar geleden
bovenliggende
commit
df24e89bb2
3 gewijzigde bestanden met toevoegingen van 18 en 0 verwijderingen
  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 Bestand weergeven

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


+ 11
- 0
internal/logic/domain/message/repo/message_repo.go Bestand weergeven

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

+ 1
- 0
pkg/urlwhitelist/urlwhitelist.go Bestand weergeven

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

Laden…
Annuleren
Opslaan