Ptqrlogin 登录回调
(qrsig string, qrtoken string)
| 65 | |
| 66 | // Ptqrlogin 登录回调 |
| 67 | func Ptqrlogin(qrsig string, qrtoken string) (data []byte, cookie string, err error) { |
| 68 | client := &http.Client{ |
| 69 | CheckRedirect: func(req *http.Request, via []*http.Request) error { |
| 70 | return http.ErrUseLastResponse |
| 71 | }, |
| 72 | } |
| 73 | ptqrloginReq, err := http.NewRequest("GET", fmt.Sprintf(ptqrloginURL, qrtoken), nil) |
| 74 | if err != nil { |
| 75 | return |
| 76 | } |
| 77 | ptqrloginReq.Header.Add("cookie", "qrsig="+qrsig) |
| 78 | ptqrloginResp, err := client.Do(ptqrloginReq) |
| 79 | if err != nil { |
| 80 | return |
| 81 | } |
| 82 | defer ptqrloginResp.Body.Close() |
| 83 | for _, v := range ptqrloginReq.Cookies() { |
| 84 | if v.Value != "" { |
| 85 | cookie += v.Name + "=" + v.Value + ";" |
| 86 | } |
| 87 | } |
| 88 | data, err = io.ReadAll(ptqrloginResp.Body) |
| 89 | return |
| 90 | } |
| 91 | |
| 92 | // LoginRedirect 登录成功回调 |
| 93 | func LoginRedirect(redirectURL string) (cookie string, err error) { |