mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
try to fix group image again.
This commit is contained in:
parent
1ff595e6ee
commit
4dc018de2b
@ -495,7 +495,7 @@ func (c *QQClient) UploadGroupImage(groupCode int64, img []byte) (*message.Group
|
|||||||
}
|
}
|
||||||
return nil, errors.New("upload failed")
|
return nil, errors.New("upload failed")
|
||||||
ok:
|
ok:
|
||||||
return message.NewGroupImage(binary.CalculateImageResourceId(h[:]), h[:]), nil
|
return message.NewGroupImage(binary.CalculateImageResourceId(h[:]), h[:], rsp.FileId), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *QQClient) UploadPrivateImage(target int64, img []byte) (*message.FriendImageElement, error) {
|
func (c *QQClient) UploadPrivateImage(target int64, img []byte) (*message.FriendImageElement, error) {
|
||||||
@ -572,7 +572,7 @@ func (c *QQClient) QueryGroupImage(groupCode int64, hash []byte, size int32) (*m
|
|||||||
return nil, errors.New(rsp.Message)
|
return nil, errors.New(rsp.Message)
|
||||||
}
|
}
|
||||||
if rsp.IsExists {
|
if rsp.IsExists {
|
||||||
return message.NewGroupImage(binary.CalculateImageResourceId(hash), hash), nil
|
return message.NewGroupImage(binary.CalculateImageResourceId(hash), hash, rsp.FileId), nil
|
||||||
}
|
}
|
||||||
return nil, errors.New("image not exists")
|
return nil, errors.New("image not exists")
|
||||||
}
|
}
|
||||||
|
@ -403,9 +403,10 @@ func decodeGroupImageStoreResponse(_ *QQClient, _ uint16, payload []byte) (inter
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
if rsp.BoolFileExit {
|
if rsp.BoolFileExit {
|
||||||
return imageUploadResponse{IsExists: true}, nil
|
return imageUploadResponse{IsExists: true, FileId: rsp.Fid}, nil
|
||||||
}
|
}
|
||||||
return imageUploadResponse{
|
return imageUploadResponse{
|
||||||
|
FileId: rsp.Fid,
|
||||||
UploadKey: rsp.UpUkey,
|
UploadKey: rsp.UpUkey,
|
||||||
UploadIp: rsp.Uint32UpIp,
|
UploadIp: rsp.Uint32UpIp,
|
||||||
UploadPort: rsp.Uint32UpPort,
|
UploadPort: rsp.Uint32UpPort,
|
||||||
|
@ -163,6 +163,7 @@ type (
|
|||||||
Message string
|
Message string
|
||||||
|
|
||||||
IsExists bool
|
IsExists bool
|
||||||
|
FileId int64
|
||||||
|
|
||||||
ResourceId string
|
ResourceId string
|
||||||
UploadKey []byte
|
UploadKey []byte
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -219,7 +219,13 @@ message Elem {
|
|||||||
//GroupPostElem? groupPostElem = 50;
|
//GroupPostElem? groupPostElem = 50;
|
||||||
LightAppElem lightApp = 51;
|
LightAppElem lightApp = 51;
|
||||||
//EIMInfo? eimInfo = 52;
|
//EIMInfo? eimInfo = 52;
|
||||||
//CommonElem? commonElem = 53;
|
CommonElem commonElem = 53;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CommonElem {
|
||||||
|
int32 serviceType = 1;
|
||||||
|
bytes pbElem = 2;
|
||||||
|
int32 businessType = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message RichMsg {
|
message RichMsg {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.25.0
|
// protoc-gen-go v1.25.0
|
||||||
// protoc v3.12.3
|
// protoc v3.11.4
|
||||||
// source: objmsg.proto
|
// source: objmsg.proto
|
||||||
|
|
||||||
package msg
|
package msg
|
||||||
|
@ -21,6 +21,7 @@ type ImageElement struct {
|
|||||||
|
|
||||||
type GroupImageElement struct {
|
type GroupImageElement struct {
|
||||||
ImageId string
|
ImageId string
|
||||||
|
FileId int64
|
||||||
Md5 []byte
|
Md5 []byte
|
||||||
Url string
|
Url string
|
||||||
}
|
}
|
||||||
@ -101,9 +102,10 @@ func NewImage(data []byte) *ImageElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGroupImage(id string, md5 []byte) *GroupImageElement {
|
func NewGroupImage(id string, md5 []byte, fid int64) *GroupImageElement {
|
||||||
return &GroupImageElement{
|
return &GroupImageElement{
|
||||||
ImageId: id,
|
ImageId: id,
|
||||||
|
FileId: fid,
|
||||||
Md5: md5,
|
Md5: md5,
|
||||||
Url: "http://gchat.qpic.cn/gchatpic_new/1/0-0-" + strings.ReplaceAll(id[1:36], "-", "") + "/0?term=2",
|
Url: "http://gchat.qpic.cn/gchatpic_new/1/0-0-" + strings.ReplaceAll(id[1:36], "-", "") + "/0?term=2",
|
||||||
}
|
}
|
||||||
|
@ -281,10 +281,14 @@ func ToProtoElems(elems []IMessageElement, generalFlags bool) (r []*msg.Elem) {
|
|||||||
case *GroupImageElement:
|
case *GroupImageElement:
|
||||||
r = append(r, &msg.Elem{
|
r = append(r, &msg.Elem{
|
||||||
CustomFace: &msg.CustomFace{
|
CustomFace: &msg.CustomFace{
|
||||||
|
FileType: 66,
|
||||||
|
Useful: 1,
|
||||||
|
Origin: 1,
|
||||||
|
FileId: int32(e.FileId),
|
||||||
FilePath: e.ImageId,
|
FilePath: e.ImageId,
|
||||||
Md5: e.Md5[:],
|
Md5: e.Md5[:],
|
||||||
Flag: make([]byte, 4),
|
Flag: make([]byte, 4),
|
||||||
OldData: imgOld,
|
//OldData: imgOld,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
case *FriendImageElement:
|
case *FriendImageElement:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user