1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

feat: GetGroupImageDownloadUrl impl

This commit is contained in:
Mrs4s 2021-10-30 17:11:39 +08:00
parent a5c23d8236
commit 90392f27c5
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7
9 changed files with 3790 additions and 2059 deletions

View File

@ -269,7 +269,7 @@ type (
ResourceId string
UploadKey []byte
UploadIp []string
UploadPort []int32
UploadPort []uint32
FileKey []byte
FileId int64
}

View File

@ -4,21 +4,21 @@ import (
"bytes"
"encoding/hex"
"fmt"
"github.com/Mrs4s/MiraiGo/client/pb/highway"
"github.com/Mrs4s/MiraiGo/client/pb/oidb"
"image"
_ "image/gif"
"io"
"math/rand"
"os"
"strings"
"github.com/Mrs4s/MiraiGo/client/pb/highway"
"github.com/Mrs4s/MiraiGo/client/pb/oidb"
"time"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb"
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x388"
"github.com/Mrs4s/MiraiGo/message"
"github.com/Mrs4s/MiraiGo/protocol/packets"
"github.com/Mrs4s/MiraiGo/utils"
@ -26,6 +26,7 @@ import (
func init() {
decoders["ImgStore.GroupPicUp"] = decodeGroupImageStoreResponse
decoders["ImgStore.GroupPicDown"] = decodeGroupImageDownloadResponse
decoders["OidbSvc.0xe07_0"] = decodeImageOcrResponse
}
@ -124,6 +125,14 @@ func (c *QQClient) UploadPrivateImage(target int64, img io.ReadSeeker) (*message
return c.uploadPrivateImage(target, img, 0)
}
func (c *QQClient) GetGroupImageDownloadUrl(fileId, groupCode int64, fileMd5 []byte) (string, error) {
i, err := c.sendAndWait(c.buildGroupImageDownloadPacket(fileId, groupCode, fileMd5))
if err != nil {
return "", err
}
return i.(string), nil
}
func (c *QQClient) uploadPrivateImage(target int64, img io.ReadSeeker, count int) (*message.FriendImageElement, error) {
_, _ = img.Seek(0, io.SeekStart)
count++
@ -208,22 +217,22 @@ func (c *QQClient) QueryFriendImage(target int64, hash []byte, size int32) (*mes
func (c *QQClient) buildGroupImageStorePacket(groupCode int64, md5 []byte, size int32) (uint16, []byte) {
seq := c.nextSeq()
name := utils.RandomString(16) + ".gif"
req := &pb.D388ReqBody{
NetType: 3,
Subcmd: 1,
MsgTryUpImgReq: []*pb.TryUpImgReq{
req := &cmd0x388.D388ReqBody{
NetType: proto.Uint32(3),
Subcmd: proto.Uint32(1),
TryupImgReq: []*cmd0x388.TryUpImgReq{
{
GroupCode: groupCode,
SrcUin: c.Uin,
GroupCode: proto.Uint64(uint64(groupCode)),
SrcUin: proto.Uint64(uint64(c.Uin)),
FileMd5: md5,
FileSize: int64(size),
FileName: name,
SrcTerm: 5,
PlatformType: 9,
BuType: 1,
PicType: 1000,
BuildVer: "8.2.7.4410",
AppPicType: 1006,
FileSize: proto.Uint64(uint64(size)),
FileName: utils.S2B(name),
SrcTerm: proto.Uint32(5),
PlatformType: proto.Uint32(9),
BuType: proto.Uint32(1),
PicType: proto.Uint32(1000),
BuildVer: utils.S2B("8.2.7.4410"),
AppPicType: proto.Uint32(1006),
FileIndex: EmptyBytes,
TransferUrl: EmptyBytes,
},
@ -235,6 +244,32 @@ func (c *QQClient) buildGroupImageStorePacket(groupCode int64, md5 []byte, size
return seq, packet
}
func (c *QQClient) buildGroupImageDownloadPacket(fileId, groupCode int64, fileMd5 []byte) (uint16, []byte) {
seq := c.nextSeq()
req := &cmd0x388.D388ReqBody{
NetType: proto.Uint32(3),
Subcmd: proto.Uint32(2),
GetimgUrlReq: []*cmd0x388.GetImgUrlReq{
{
FileId: proto.Uint64(0), // index
DstUin: proto.Uint64(uint64(c.Uin)),
GroupCode: proto.Uint64(uint64(groupCode)),
FileMd5: fileMd5,
PicUpTimestamp: proto.Uint32(uint32(time.Now().Unix())),
Fileid: proto.Uint64(uint64(fileId)),
UrlFlag: proto.Uint32(8),
UrlType: proto.Uint32(3),
ReqPlatformType: proto.Uint32(9),
ReqTerm: proto.Uint32(5),
InnerIp: proto.Uint32(0),
},
},
}
payload, _ := proto.Marshal(req)
packet := packets.BuildUniPacket(c.Uin, seq, "ImgStore.GroupPicDown", 1, c.OutGoingPacketSessionId, EmptyBytes, c.sigInfo.d2Key, payload)
return seq, packet
}
func (c *QQClient) uploadOcrImage(img io.Reader, length int64, sum []byte) (string, error) {
r := make([]byte, 16)
rand.Read(r)
@ -277,32 +312,46 @@ func (c *QQClient) buildImageOcrRequestPacket(url, md5 string, size, weight, hei
// ImgStore.GroupPicUp
func decodeGroupImageStoreResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
pkt := pb.D388RespBody{}
pkt := cmd0x388.D388RspBody{}
err := proto.Unmarshal(payload, &pkt)
if err != nil {
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
}
rsp := pkt.MsgTryUpImgRsp[0]
if rsp.Result != 0 {
rsp := pkt.TryupImgRsp[0]
if rsp.GetResult() != 0 {
return &imageUploadResponse{
ResultCode: rsp.Result,
Message: rsp.FailMsg,
ResultCode: int32(rsp.GetResult()),
Message: utils.B2S(rsp.GetFailMsg()),
}, nil
}
if rsp.BoolFileExit {
if rsp.MsgImgInfo != nil {
return &imageUploadResponse{IsExists: true, FileId: rsp.Fid, Width: rsp.MsgImgInfo.FileWidth, Height: rsp.MsgImgInfo.FileHeight}, nil
if rsp.GetFileExit() {
if rsp.GetImgInfo() != nil {
return &imageUploadResponse{IsExists: true, FileId: int64(rsp.GetFileid()), Width: int32(rsp.ImgInfo.GetFileWidth()), Height: int32(rsp.ImgInfo.GetFileHeight())}, nil
}
return &imageUploadResponse{IsExists: true, FileId: rsp.Fid}, nil
return &imageUploadResponse{IsExists: true, FileId: int64(rsp.GetFileid())}, nil
}
return &imageUploadResponse{
FileId: rsp.Fid,
FileId: int64(rsp.GetFileid()),
UploadKey: rsp.UpUkey,
UploadIp: rsp.Uint32UpIp,
UploadPort: rsp.Uint32UpPort,
UploadIp: rsp.GetUpIp(),
UploadPort: rsp.GetUpPort(),
}, nil
}
func decodeGroupImageDownloadResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
pkt := cmd0x388.D388RspBody{}
if err := proto.Unmarshal(payload, &pkt); err != nil {
return nil, errors.Wrap(err, "unmarshal protobuf message error")
}
if len(pkt.GetimgUrlRsp) == 0 {
return nil, errors.New("response not found")
}
if len(pkt.GetimgUrlRsp[0].FailMsg) != 0 {
return nil, errors.New(utils.B2S(pkt.GetimgUrlRsp[0].FailMsg))
}
return "https://" + utils.B2S(pkt.GetimgUrlRsp[0].DownDomain) + utils.B2S(pkt.GetimgUrlRsp[0].BigDownPara), nil
}
// OidbSvc.0xe07_0
func decodeImageOcrResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
pkg := oidb.OIDBSSOPkg{}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,255 @@
syntax = "proto2";
option go_package = "./;cmd0x388";
message DelImgReq {
optional uint64 srcUin = 1;
optional uint64 dstUin = 2;
optional uint32 reqTerm = 3;
optional uint32 reqPlatformType = 4;
optional uint32 buType = 5;
optional bytes buildVer = 6;
optional bytes fileResid = 7;
optional uint32 picWidth = 8;
optional uint32 picHeight = 9;
}
message DelImgRsp {
optional uint32 result = 1;
optional bytes failMsg = 2;
optional bytes fileResid = 3;
}
message ExpRoamExtendInfo {
optional bytes resid = 1;
}
message ExpRoamPicInfo {
optional uint32 shopFlag = 1;
optional uint32 pkgId = 2;
optional bytes picId = 3;
}
message ExtensionCommPicTryUp {
repeated bytes extinfo = 1;
}
message ExtensionExpRoamTryUp {
repeated ExpRoamPicInfo exproamPicInfo = 1;
}
message GetImgUrlReq {
optional uint64 groupCode = 1;
optional uint64 dstUin = 2;
optional uint64 fileid = 3;
optional bytes fileMd5 = 4;
optional uint32 urlFlag = 5;
optional uint32 urlType = 6;
optional uint32 reqTerm = 7;
optional uint32 reqPlatformType = 8;
optional uint32 innerIp = 9;
optional uint32 buType = 10;
optional bytes buildVer = 11;
optional uint64 fileId = 12;
optional uint64 fileSize = 13;
optional uint32 originalPic = 14;
optional uint32 retryReq = 15;
optional uint32 fileHeight = 16;
optional uint32 fileWidth = 17;
optional uint32 picType = 18;
optional uint32 picUpTimestamp = 19;
optional uint32 reqTransferType = 20;
optional uint64 qqmeetGuildId = 21;
optional uint64 qqmeetChannelId = 22;
optional bytes downloadIndex = 23;
}
message GetImgUrlRsp {
optional uint64 fileid = 1;
optional bytes fileMd5 = 2;
optional uint32 result = 3;
optional bytes failMsg = 4;
optional ImgInfo imgInfo = 5;
repeated bytes thumbDownUrl = 6;
repeated bytes originalDownUrl = 7;
repeated bytes bigDownUrl = 8;
repeated uint32 downIp = 9;
repeated uint32 downPort = 10;
optional bytes downDomain = 11;
optional bytes thumbDownPara = 12;
optional bytes originalDownPara = 13;
optional bytes bigDownPara = 14;
optional uint64 fileId = 15;
optional uint32 autoDownType = 16;
repeated uint32 orderDownType = 17;
optional bytes bigThumbDownPara = 19;
optional uint32 httpsUrlFlag = 20;
repeated IPv6Info downIp6 = 26;
optional bytes clientIp6 = 27;
}
message GetPttUrlReq {
optional uint64 groupCode = 1;
optional uint64 dstUin = 2;
optional uint64 fileid = 3;
optional bytes fileMd5 = 4;
optional uint32 reqTerm = 5;
optional uint32 reqPlatformType = 6;
optional uint32 innerIp = 7;
optional uint32 buType = 8;
optional bytes buildVer = 9;
optional uint64 fileId = 10;
optional bytes fileKey = 11;
optional uint32 codec = 12;
optional uint32 buId = 13;
optional uint32 reqTransferType = 14;
optional uint32 isAuto = 15;
}
message GetPttUrlRsp {
optional uint64 fileid = 1;
optional bytes fileMd5 = 2;
optional uint32 result = 3;
optional bytes failMsg = 4;
repeated bytes downUrl = 5;
repeated uint32 downIp = 6;
repeated uint32 downPort = 7;
optional bytes downDomain = 8;
optional bytes downPara = 9;
optional uint64 fileId = 10;
optional uint32 transferType = 11;
optional uint32 allowRetry = 12;
repeated IPv6Info downIp6 = 26;
optional bytes clientIp6 = 27;
optional string domain = 28;
}
message IPv6Info {
optional bytes ip6 = 1;
optional uint32 port = 2;
}
message ImgInfo {
optional bytes fileMd5 = 1;
optional uint32 fileType = 2;
optional uint64 fileSize = 3;
optional uint32 fileWidth = 4;
optional uint32 fileHeight = 5;
}
message PicSize {
optional uint32 original = 1;
optional uint32 thumb = 2;
optional uint32 high = 3;
}
message D388ReqBody {
optional uint32 netType = 1;
optional uint32 subcmd = 2;
repeated TryUpImgReq tryupImgReq = 3;
repeated GetImgUrlReq getimgUrlReq = 4;
repeated TryUpPttReq tryupPttReq = 5;
repeated GetPttUrlReq getpttUrlReq = 6;
optional uint32 commandId = 7;
repeated DelImgReq delImgReq = 8;
optional bytes extension = 1001;
}
message D388RspBody {
optional uint32 clientIp = 1;
optional uint32 subcmd = 2;
repeated D388TryUpImgRsp tryupImgRsp = 3;
repeated GetImgUrlRsp getimgUrlRsp = 4;
repeated TryUpPttRsp tryupPttRsp = 5;
repeated GetPttUrlRsp getpttUrlRsp = 6;
repeated DelImgRsp delImgRsp = 7;
}
message TryUpImgReq {
optional uint64 groupCode = 1;
optional uint64 srcUin = 2;
optional uint64 fileId = 3;
optional bytes fileMd5 = 4;
optional uint64 fileSize = 5;
optional bytes fileName = 6;
optional uint32 srcTerm = 7;
optional uint32 platformType = 8;
optional uint32 buType = 9;
optional uint32 picWidth = 10;
optional uint32 picHeight = 11;
optional uint32 picType = 12;
optional bytes buildVer = 13;
optional uint32 innerIp = 14;
optional uint32 appPicType = 15;
optional uint32 originalPic = 16;
optional bytes fileIndex = 17;
optional uint64 dstUin = 18;
optional uint32 srvUpload = 19;
optional bytes transferUrl = 20;
optional uint64 qqmeetGuildId = 21;
optional uint64 qqmeetChannelId = 22;
}
message D388TryUpImgRsp {
optional uint64 fileId = 1;
optional uint32 result = 2;
optional bytes failMsg = 3;
optional bool fileExit = 4;
optional ImgInfo imgInfo = 5;
repeated uint32 upIp = 6;
repeated uint32 upPort = 7;
optional bytes upUkey = 8;
optional uint64 fileid = 9;
optional uint64 upOffset = 10;
optional uint64 blockSize = 11;
optional bool newBigChan = 12;
repeated IPv6Info upIp6 = 26;
optional bytes clientIp6 = 27;
optional bytes downloadIndex = 28;
optional TryUpInfo4Busi info4Busi = 1001;
}
message TryUpInfo4Busi {
optional bytes downDomain = 1;
optional bytes thumbDownUrl = 2;
optional bytes originalDownUrl = 3;
optional bytes bigDownUrl = 4;
optional bytes fileResid = 5;
}
message TryUpPttReq {
optional uint64 groupCode = 1;
optional uint64 srcUin = 2;
optional uint64 fileId = 3;
optional bytes fileMd5 = 4;
optional uint64 fileSize = 5;
optional bytes fileName = 6;
optional uint32 srcTerm = 7;
optional uint32 platformType = 8;
optional uint32 buType = 9;
optional bytes buildVer = 10;
optional uint32 innerIp = 11;
optional uint32 voiceLength = 12;
optional bool newUpChan = 13;
optional uint32 codec = 14;
optional uint32 voiceType = 15;
optional uint32 buId = 16;
}
message TryUpPttRsp {
optional uint64 fileId = 1;
optional uint32 result = 2;
optional bytes failMsg = 3;
optional bool fileExit = 4;
repeated uint32 upIp = 5;
repeated uint32 upPort = 6;
optional bytes upUkey = 7;
optional uint64 fileid = 8;
optional uint64 upOffset = 9;
optional uint64 blockSize = 10;
optional bytes fileKey = 11;
optional uint32 channelType = 12;
repeated IPv6Info upIp6 = 26;
optional bytes clientIp6 = 27;
}

File diff suppressed because it is too large Load Diff

View File

@ -38,60 +38,6 @@ message D50ReqBody {
int32 reqMutualmarkLbsshare = 181001;
}
message D388ReqBody {
int32 netType = 1;
int32 subcmd = 2;
repeated TryUpImgReq msgTryUpImgReq = 3;
repeated TryUpPttReq msgTryUpPttReq = 5;
repeated GetPttUrlReq msgGetPttReq = 6;
int32 commandId = 7;
bytes extension = 1001;
}
message D388RespBody {
int32 clientIp = 1;
int32 subCmd = 2;
repeated TryUpImgResp msgTryUpImgRsp = 3;
repeated TryUpPttResp msgTryUpPttRsp = 5;
repeated GetPttUrlRsp msgGetPttUrlRsp = 6;
}
message GetPttUrlReq {
int64 groupCode = 1;
int64 dstUin = 2;
int64 fileId = 3;
bytes fileMd5 = 4;
int32 reqTerm = 5;
int32 reqPlatformType = 6;
int32 innerIp = 7;
int32 buType = 8;
bytes buildVer = 9;
//int64 fileId = 10;
bytes fileKey = 11;
int32 codec = 12;
int32 buId = 13;
int32 reqTransferType = 14;
int32 isAuto = 15;
}
message GetPttUrlRsp {
int64 fileId = 1;
bytes fileMd5 = 2;
int32 result = 3;
bytes failMsg = 4;
bytes bytesDownUrl = 5;
repeated int32 uint32DownIp = 6;
repeated int32 uint32DownPort = 7;
bytes downDomain = 8;
bytes downPara = 9;
//int64 fileId = 10;
int32 transferType = 11;
int32 allowRetry = 12;
//repeated IPv6Info msgDownIp6 = 26;
bytes clientIp6 = 27;
string strDomain = 28;
}
message ReqDataHighwayHead {
DataHighwayHead msgBasehead = 1;
SegHead msgSeghead = 2;
@ -141,87 +87,6 @@ message SegHead {
int32 updateCacheip = 12;
}
message TryUpImgReq {
int64 groupCode = 1;
int64 srcUin = 2;
int64 fileId = 3;
bytes fileMd5 = 4;
int64 fileSize = 5;
string fileName = 6;
int32 srcTerm = 7;
int32 platformType = 8;
int32 buType = 9;
int32 picWidth = 10;
int32 picHeight = 11;
int32 picType = 12;
string buildVer = 13;
int32 innerIp = 14;
int32 appPicType = 15;
int32 originalPic = 16;
bytes fileIndex = 17;
int64 dstUin = 18;
int32 srvUpload = 19;
bytes transferUrl = 20;
}
message TryUpImgResp {
int64 fileId = 1;
int32 result = 2;
string failMsg = 3;
bool boolFileExit = 4;
ImgInfo msgImgInfo = 5;
repeated uint32 uint32UpIp = 6;
repeated uint32 uint32UpPort = 7;
bytes upUkey = 8;
int64 fid = 9;
}
message TryUpPttReq {
int64 groupCode = 1;
int64 srcUin = 2;
int64 fileId = 3;
bytes fileMd5 = 4;
int64 fileSize = 5;
bytes fileName = 6;
int32 srcTerm = 7;
int32 platformType = 8;
int32 buType = 9;
string buildVer = 10;
int32 innerIp = 11;
int32 voiceLength = 12;
bool boolNewUpChan = 13;
int32 codec = 14;
int32 voiceType = 15;
int32 buId = 16;
}
message TryUpPttResp {
int64 fileId = 1;
int32 result = 2;
string failMsg = 3;
bool boolFileExit = 4;
repeated int32 uint32UpIp = 5;
repeated int32 uint32UpPort = 6;
bytes upUkey = 7;
int64 fileId2 = 8;
int64 upOffset = 9;
int64 blockSize = 10;
bytes fileKey = 11;
int32 channelType = 12;
// List<IPv6Info>? msgUpIp6 = 26;
// bytes clientIp6 = 27;
}
message ImgInfo {
bytes fileMd5 = 1;
int32 fileType = 2;
int64 fileSize = 3;
int32 fileWidth = 4;
int32 fileHeight = 5;
}
message DeleteMessageRequest {
repeated MessageItem items = 1;
}

View File

@ -3,6 +3,7 @@ package client
import (
"crypto/md5"
"encoding/hex"
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x388"
"io"
"os"
@ -10,7 +11,6 @@ import (
"google.golang.org/protobuf/proto"
"github.com/Mrs4s/MiraiGo/binary"
"github.com/Mrs4s/MiraiGo/client/pb"
"github.com/Mrs4s/MiraiGo/client/pb/cmd0x346"
"github.com/Mrs4s/MiraiGo/client/pb/msg"
"github.com/Mrs4s/MiraiGo/client/pb/pttcenter"
@ -45,11 +45,11 @@ func (c *QQClient) UploadGroupPtt(groupCode int64, voice io.ReadSeeker) (*messag
if len(rsp) == 0 {
return nil, errors.New("miss rsp")
}
pkt := pb.D388RespBody{}
pkt := cmd0x388.D388RspBody{}
if err = proto.Unmarshal(rsp, &pkt); err != nil {
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
}
if len(pkt.MsgTryUpPttRsp) == 0 {
if len(pkt.TryupPttRsp) == 0 {
return nil, errors.New("miss try up rsp")
}
return &message.GroupVoiceElement{
@ -59,7 +59,7 @@ func (c *QQClient) UploadGroupPtt(groupCode int64, voice io.ReadSeeker) (*messag
FileMd5: fh[:],
FileName: proto.String(hex.EncodeToString(fh[:]) + ".amr"),
FileSize: proto.Int32(int32(length)),
GroupFileKey: pkt.MsgTryUpPttRsp[0].FileKey,
GroupFileKey: pkt.TryupPttRsp[0].FileKey,
BoolValid: proto.Bool(true),
PbReserve: []byte{8, 0, 40, 0, 56, 0},
},
@ -194,25 +194,25 @@ func (c *QQClient) buildGroupPttStorePacket(groupCode int64, md5 []byte, size, c
}
func (c *QQClient) buildGroupPttStoreBDHExt(groupCode int64, md5 []byte, size, codec, voiceLength int32) []byte {
req := &pb.D388ReqBody{
NetType: 3,
Subcmd: 3,
MsgTryUpPttReq: []*pb.TryUpPttReq{
req := &cmd0x388.D388ReqBody{
NetType: proto.Uint32(3),
Subcmd: proto.Uint32(3),
TryupPttReq: []*cmd0x388.TryUpPttReq{
{
GroupCode: groupCode,
SrcUin: c.Uin,
FileMd5: md5,
FileSize: int64(size),
FileName: md5,
SrcTerm: 5,
PlatformType: 9,
BuType: 4,
InnerIp: 0,
BuildVer: "6.5.5.663",
VoiceLength: voiceLength,
Codec: codec,
VoiceType: 1,
BoolNewUpChan: true,
GroupCode: proto.Uint64(uint64(groupCode)),
SrcUin: proto.Uint64(uint64(c.Uin)),
FileMd5: md5,
FileSize: proto.Uint64(uint64(size)),
FileName: md5,
SrcTerm: proto.Uint32(5),
PlatformType: proto.Uint32(9),
BuType: proto.Uint32(4),
InnerIp: proto.Uint32(0),
BuildVer: utils.S2B("6.5.5.663"),
VoiceLength: proto.Uint32(uint32(voiceLength)),
Codec: proto.Uint32(uint32(codec)),
VoiceType: proto.Uint32(1),
NewUpChan: proto.Bool(true),
},
},
}
@ -288,31 +288,31 @@ func (c *QQClient) buildPttGroupShortVideoUploadReqPacket(videoHash, thumbHash [
// PttStore.GroupPttUp
func decodeGroupPttStoreResponse(_ *QQClient, _ *incomingPacketInfo, payload []byte) (interface{}, error) {
pkt := pb.D388RespBody{}
pkt := cmd0x388.D388RspBody{}
err := proto.Unmarshal(payload, &pkt)
if err != nil {
return nil, errors.Wrap(err, "failed to unmarshal protobuf message")
}
rsp := pkt.MsgTryUpPttRsp[0]
if rsp.Result != 0 {
rsp := pkt.TryupPttRsp[0]
if rsp.GetResult() != 0 {
return pttUploadResponse{
ResultCode: rsp.Result,
Message: rsp.FailMsg,
ResultCode: int32(rsp.GetResult()),
Message: utils.B2S(rsp.GetFailMsg()),
}, nil
}
if rsp.BoolFileExit {
if rsp.GetFileExit() {
return pttUploadResponse{IsExists: true}, nil
}
ip := make([]string, 0, len(rsp.Uint32UpIp))
for _, i := range rsp.Uint32UpIp {
ip = append(ip, binary.UInt32ToIPV4Address(uint32(i)))
ip := make([]string, 0, len(rsp.GetUpIp()))
for _, i := range rsp.GetUpIp() {
ip = append(ip, binary.UInt32ToIPV4Address(i))
}
return pttUploadResponse{
UploadKey: rsp.UpUkey,
UploadIp: ip,
UploadPort: rsp.Uint32UpPort,
UploadPort: rsp.GetUpPort(),
FileKey: rsp.FileKey,
FileId: rsp.FileId2,
FileId: int64(rsp.GetFileid()),
}, nil
}

2
go.sum
View File

@ -18,10 +18,12 @@ github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8=
github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

View File

@ -444,6 +444,7 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
continue
}
res = append(res, &GroupImageElement{
FileId: int64(elem.CustomFace.GetFileId()),
ImageId: elem.CustomFace.GetFilePath(),
Size: elem.CustomFace.GetSize(),
Width: elem.CustomFace.GetWidth(),
@ -536,6 +537,7 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
_ = proto.Unmarshal(elem.CommonElem.PbElem, flash)
if flash.FlashTroopPic != nil {
res = append(res, &GroupImageElement{
FileId: int64(flash.FlashTroopPic.GetFileId()),
ImageId: flash.FlashTroopPic.GetFilePath(),
Size: flash.FlashTroopPic.GetSize(),
Width: flash.FlashTroopPic.GetWidth(),