diff --git a/binary/jce/reader.go b/binary/jce/reader.go index 2c7cd45a..54691a89 100644 --- a/binary/jce/reader.go +++ b/binary/jce/reader.go @@ -417,6 +417,32 @@ func (r *JceReader) ReadMapStrByte(tag int) map[string][]byte { } } +func (r *JceReader) ReadMapIntVipInfo(tag int) map[int]*VipInfo { + if !r.skipToTag(tag) { + return nil + } + r.skipHead() + hd, _ := r.readHead() + switch hd.Type { + case 8: + s := r.ReadInt32(0) + m := make(map[int]*VipInfo, s) + for i := 0; i < int(s); i++ { + k := r.ReadInt64(0) + v := new(VipInfo) + r.readHead() + v.ReadFrom(r) + r.skipToStructEnd() + m[int(k)] = v + } + r.skipToStructEnd() + return m + default: + r.skipToStructEnd() + return nil + } +} + func (r *JceReader) ReadMapStrMapStrByte(tag int) map[string]map[string][]byte { if !r.skipToTag(tag) { return nil diff --git a/binary/jce/structs.go b/binary/jce/structs.go index 60296879..80039fff 100644 --- a/binary/jce/structs.go +++ b/binary/jce/structs.go @@ -527,6 +527,12 @@ type ( DelType byte `jceId:"2"` Version int32 `jceId:"3"` } + + VipInfo struct { + Open byte `jceId:"0"` // 1 为开通 + Type int32 `jceId:"1"` // 1 为年费 + Level int32 `jceId:"2"` + } ) func (pkt *RequestPacket) ReadFrom(r *JceReader) { @@ -736,3 +742,9 @@ func (pkt *InstanceInfo) ReadFrom(r *JceReader) { pkt.ProductType = r.ReadInt64(3) pkt.ClientType = r.ReadInt64(4) } + +func (pkt *VipInfo) ReadFrom(r *JceReader) { + pkt.Open = r.ReadByte(0) + pkt.Type = r.ReadInt32(1) + pkt.Level = r.ReadInt32(2) +} diff --git a/binary/jce/structs_tobytes.go b/binary/jce/structs_tobytes.go index 19a3b2b2..0067c2ff 100644 --- a/binary/jce/structs_tobytes.go +++ b/binary/jce/structs_tobytes.go @@ -750,3 +750,11 @@ func (pkt *DelFriendReq) ToBytes() []byte { w.WriteInt32(pkt.Version, 3) return w.Bytes() } + +func (pkt *VipInfo) ToBytes() []byte { + w := NewJceWriter() + w.WriteByte(pkt.Open, 0) + w.WriteInt32(pkt.Type, 1) + w.WriteInt32(pkt.Level, 2) + return w.Bytes() +} diff --git a/client/decoders.go b/client/decoders.go index 51a63ccc..55684b46 100644 --- a/client/decoders.go +++ b/client/decoders.go @@ -2,6 +2,7 @@ package client import ( "crypto/md5" + "fmt" "net/netip" "strconv" "strings" @@ -428,16 +429,25 @@ func decodeSummaryCardResponse(_ *QQClient, _ *network.IncomingPacketInfo, paylo return jce.NewJceReader(data.Map["RespSummaryCard"]["SummaryCard_Old.RespSummaryCard"][1:]) }() info := &SummaryCardInfo{ - Sex: rsp.ReadByte(1), - Age: rsp.ReadByte(2), - Nickname: rsp.ReadString(3), - Level: rsp.ReadInt32(5), - City: rsp.ReadString(7), - Sign: rsp.ReadString(8), - Mobile: rsp.ReadString(11), - Uin: rsp.ReadInt64(23), - LoginDays: rsp.ReadInt64(36), + Sex: rsp.ReadByte(1), + Age: rsp.ReadByte(2), + Nickname: rsp.ReadString(3), + Level: rsp.ReadInt32(5), + City: rsp.ReadString(7), + Sign: rsp.ReadString(8), + Mobile: rsp.ReadString(11), + Uin: rsp.ReadInt64(23), } + vipInfo := rsp.ReadMapIntVipInfo(29) // 1 -> vip, 3 -> svip + if v1, v3 := vipInfo[1], vipInfo[3]; v1 != nil || v3 != nil { + if v1.Open != 0 { + info.VipLevel = fmt.Sprintf("vip%d", v1.Level) + } + if v3.Open != 0 { + info.VipLevel = fmt.Sprintf("svip%d", v3.Level) + } + } + info.LoginDays = rsp.ReadInt64(36) services := rsp.ReadByteArrArr(46) readService := func(buf []byte) (*profilecard.BusiComm, []byte) { r := binary.NewReader(buf) diff --git a/client/entities.go b/client/entities.go index 6f12069b..55346071 100644 --- a/client/entities.go +++ b/client/entities.go @@ -77,6 +77,7 @@ type ( Mobile string LoginDays int64 Qid string + VipLevel string } OtherClientInfo struct {