| 26 | cryptic = helper.BytesToString(t) |
| 27 | } |
| 28 | func getRole(uid string) (body []byte, err error) { |
| 29 | var client = &http.Client{} |
| 30 | req, err := http.NewRequest(http.MethodGet, nets+path+uid, nil) |
| 31 | |
| 32 | if err != nil { |
| 33 | return nil, err |
| 34 | } |
| 35 | req.Header.Add("User-Agent", cryptic) |
| 36 | req.Header.Add("Accept", "*/*") |
| 37 | |
| 38 | res, err := client.Do(req) |
| 39 | if err != nil { |
| 40 | return nil, err |
| 41 | } |
| 42 | defer res.Body.Close() |
| 43 | |
| 44 | if res.StatusCode < http.StatusOK || res.StatusCode >= http.StatusBadRequest { |
| 45 | return nil, errors.New("获取数据失败, Code: " + strconv.Itoa(res.StatusCode)) |
| 46 | } |
| 47 | body, err = io.ReadAll(res.Body) |
| 48 | if err != nil { |
| 49 | return nil, err |
| 50 | } |
| 51 | return |
| 52 | } |
| 53 | |
| 54 | type info struct { |
| 55 | PlayerDetailInfo struct { |