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 {
|
||||
case StatusSuccess:
|
||||
// 判断是否有登录回调,如果有执行它
|
||||
if err = b.HandleLogin(resp.Raw); err != nil {
|
||||
return err
|
||||
}
|
||||
if b.LoginCallBack != nil {
|
||||
b.LoginCallBack(resp.Raw)
|
||||
}
|
||||
return b.HandleLogin(resp.Raw)
|
||||
return nil
|
||||
case StatusScanned:
|
||||
// 执行扫码回调
|
||||
if b.ScanCallBack != nil {
|
||||
|
@ -4,7 +4,9 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
)
|
||||
@ -86,6 +88,10 @@ func (c *Caller) GetLoginInfo(body []byte) (*LoginInfo, error) {
|
||||
if err != nil {
|
||||
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() }()
|
||||
|
||||
var loginInfo LoginInfo
|
||||
|
Loading…
x
Reference in New Issue
Block a user