Merge pull request #133 from eatmoreapple/handle-xml-syntax-error
This commit is contained in:
commit
b18242699a
5
bot.go
5
bot.go
@ -141,10 +141,13 @@ func (b *Bot) LoginWithUUID(uuid string) error {
|
|||||||
switch resp.Code {
|
switch resp.Code {
|
||||||
case StatusSuccess:
|
case StatusSuccess:
|
||||||
// 判断是否有登录回调,如果有执行它
|
// 判断是否有登录回调,如果有执行它
|
||||||
|
if err = b.HandleLogin(resp.Raw); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if b.LoginCallBack != nil {
|
if b.LoginCallBack != nil {
|
||||||
b.LoginCallBack(resp.Raw)
|
b.LoginCallBack(resp.Raw)
|
||||||
}
|
}
|
||||||
return b.HandleLogin(resp.Raw)
|
return nil
|
||||||
case StatusScanned:
|
case StatusScanned:
|
||||||
// 执行扫码回调
|
// 执行扫码回调
|
||||||
if b.ScanCallBack != nil {
|
if b.ScanCallBack != nil {
|
||||||
|
@ -4,7 +4,9 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
@ -86,6 +88,10 @@ func (c *Caller) GetLoginInfo(body []byte) (*LoginInfo, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// 判断是否重定向
|
||||||
|
if resp.StatusCode != http.StatusMovedPermanently {
|
||||||
|
return nil, fmt.Errorf("%w: try to login with Desktop Mode", ErrForbidden)
|
||||||
|
}
|
||||||
defer func() { _ = resp.Body.Close() }()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
|
|
||||||
var loginInfo LoginInfo
|
var loginInfo LoginInfo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user