瀏覽代碼

update

master
DengBiao 1 年之前
父節點
當前提交
df24e89bb2
共有 3 個檔案被更改,包括 18 行新增0 行删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

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

Loading…
取消
儲存