Skip to content

Commit

Permalink
feat: 上传的媒体文件自动添加fileuuid
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Nov 14, 2024
1 parent 31e2113 commit 304fa37
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ func (c *QQClient) GetGroupRecordURL(groupUin uint32, node *oidb.IndexNode) (str
}

func (c *QQClient) GetVideoURL(isGroup bool, video *message2.ShortVideoElement) (string, error) {
pkt, err := oidb2.BuildVideoDownloadReq(c.Sig().UID, string(video.UUID), video.Name, isGroup, video.Md5, video.Sha1)
pkt, err := oidb2.BuildVideoDownloadReq(c.Sig().UID, video.UUID, video.Name, isGroup, video.Md5, video.Sha1)
if err != nil {
return "", err
}
Expand Down
6 changes: 6 additions & 0 deletions client/richmedia.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (c *QQClient) ImageUploadPrivate(targetUID string, image *message.ImageElem
}
}
image.MsgInfo = uploadResp.Upload.MsgInfo
image.FileUUID = uploadResp.Upload.MsgInfo.MsgInfoBody[0].Index.FileUuid
compatImage := &message2.NotOnlineImage{}
err = proto.Unmarshal(uploadResp.Upload.CompatQMsg, compatImage)
if err != nil {
Expand Down Expand Up @@ -178,6 +179,7 @@ func (c *QQClient) ImageUploadGroup(groupUin uint32, image *message.ImageElement
}
}
image.MsgInfo = uploadResp.Upload.MsgInfo
image.FileUUID = uploadResp.Upload.MsgInfo.MsgInfoBody[0].Index.FileUuid
_ = proto.Unmarshal(uploadResp.Upload.CompatQMsg, image.CompatFace)
return image, nil
}
Expand Down Expand Up @@ -233,6 +235,7 @@ func (c *QQClient) RecordUploadPrivate(targetUID string, record *message.VoiceEl
}
}
record.MsgInfo = uploadResp.Upload.MsgInfo
record.UUID = uploadResp.Upload.MsgInfo.MsgInfoBody[0].Index.FileUuid
record.Compat = uploadResp.Upload.CompatQMsg
return record, nil
}
Expand Down Expand Up @@ -288,6 +291,7 @@ func (c *QQClient) RecordUploadGroup(groupUin uint32, record *message.VoiceEleme
}
}
record.MsgInfo = uploadResp.Upload.MsgInfo
record.UUID = uploadResp.Upload.MsgInfo.MsgInfoBody[0].Index.FileUuid
record.Compat = uploadResp.Upload.CompatQMsg
return record, nil
}
Expand Down Expand Up @@ -377,6 +381,7 @@ func (c *QQClient) VideoUploadPrivate(targetUID string, video *message.ShortVide
}
}
video.MsgInfo = uploadResp.Upload.MsgInfo
video.UUID = uploadResp.Upload.MsgInfo.MsgInfoBody[0].Index.FileUuid
err = proto.Unmarshal(uploadResp.Upload.CompatQMsg, video.Compat)
if err != nil {
return nil, err
Expand Down Expand Up @@ -469,6 +474,7 @@ func (c *QQClient) VideoUploadGroup(groupUin uint32, video *message.ShortVideoEl
}
}
video.MsgInfo = uploadResp.Upload.MsgInfo
video.UUID = uploadResp.Upload.MsgInfo.MsgInfoBody[0].Index.FileUuid
err = proto.Unmarshal(uploadResp.Upload.CompatQMsg, video.Compat)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion message/elements.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ type (

ShortVideoElement struct {
Name string
UUID []byte
UUID string
Size uint32
URL string
Duration uint32
Expand Down
2 changes: 1 addition & 1 deletion message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func ParseMessageElements(msg []*message.Elem) []IMessageElement {
return []IMessageElement{
&ShortVideoElement{
Name: elem.VideoFile.FileName,
UUID: utils.S2B(elem.VideoFile.FileUuid),
UUID: elem.VideoFile.FileUuid,
Size: uint32(elem.VideoFile.FileSize),
Md5: elem.VideoFile.FileMd5,
Thumb: &VideoThumb{
Expand Down

0 comments on commit 304fa37

Please sign in to comment.