From 49156b446a4c819d1691db5411208670f6b92426 Mon Sep 17 00:00:00 2001
From: wdvxdr
Date: Sat, 5 Sep 2020 23:06:53 +0800
Subject: [PATCH] feature: GetVipInfo
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
添加 获取会员信息的接口
---
client/client.go | 35 +++++++++++++++++++++++++++++++++++
client/vip.go | 13 +++++++++++++
2 files changed, 48 insertions(+)
create mode 100644 client/vip.go
diff --git a/client/client.go b/client/client.go
index 9a7bba36..054fff25 100644
--- a/client/client.go
+++ b/client/client.go
@@ -12,9 +12,11 @@ import (
"math"
"math/rand"
"net"
+ "strconv"
"sync"
"sync/atomic"
"time"
+ "strings"
"github.com/golang/protobuf/proto"
@@ -177,6 +179,39 @@ func (c *QQClient) Login() (*LoginResponse, error) {
return &l, nil
}
+func (c *QQClient) GetVipInfo(target int64) (*VipInfo, error) {
+ b, err := utils.HttpGetBytes(fmt.Sprintf("https://h5.vip.qq.com/p/mc/cardv2/other?platform=1&qq=%d&adtag=geren&aid=mvip.pingtai.mobileqq.androidziliaoka.fromqita",target),c.getCookiesWithDomain("h5.vip.qq.com"))
+ if err != nil {
+ return nil, err
+ }
+ ret := VipInfo{Uin: target};
+ b = b[bytes.Index(b, []byte(``))+24:]
+ t := b[:bytes.Index(b,[]byte(``))]
+ ret.Name = string(t)
+ b = b[bytes.Index(b, []byte(`LV`))+17:]
+ t = b[:bytes.Index(b, []byte(`
`))]
+ ret.Level, _ = strconv.Atoi(string(t))
+ b = b[bytes.Index(b, []byte(``))+35:]
+ b = b[bytes.Index(b, []byte(`
`))+3:]
+ t = b[:bytes.Index(b, []byte(`倍`))]
+ ret.LevelSpeed, _ = strconv.ParseFloat(string(t),64)
+ b = b[bytes.Index(b, []byte(``))+35:]
+ b = b[bytes.Index(b, []byte(`
`))+3:]
+ st := string(b[:bytes.Index(b, []byte(`
`))])
+ st = strings.Replace(st, "
", "", 1)
+ st = strings.Replace(st, "", "", 1)
+ ret.VipLevel = st
+ b = b[bytes.Index(b, []byte(`
`))+35:]
+ b = b[bytes.Index(b, []byte(`
`))+3:]
+ t = b[:bytes.Index(b, []byte(`
`))]
+ ret.VipGrowthSpeed, _ = strconv.Atoi(string(t))
+ b = b[bytes.Index(b, []byte(`
`))+35:]
+ b = b[bytes.Index(b, []byte(`
`))+3:]
+ t = b[:bytes.Index(b, []byte(`
`))]
+ ret.VipGrowthTotal, _ = strconv.Atoi(string(t))
+ return &ret,nil
+}
+
func (c *QQClient) GetGroupHonorInfo(groupCode int64, honorType HonorType) (*GroupHonorInfo, error) {
b, err := utils.HttpGetBytes(fmt.Sprintf("https://qun.qq.com/interactive/honorlist?gc=%d&type=%d", groupCode, honorType), c.getCookiesWithDomain("qun.qq.com"))
if err != nil {
diff --git a/client/vip.go b/client/vip.go
new file mode 100644
index 00000000..b92d3f19
--- /dev/null
+++ b/client/vip.go
@@ -0,0 +1,13 @@
+package client
+
+type (
+ VipInfo struct {
+ Uin int64
+ Name string
+ Level int
+ LevelSpeed float64
+ VipLevel string
+ VipGrowthSpeed int
+ VipGrowthTotal int
+ }
+)
\ No newline at end of file