diff --git a/bot_test.go b/bot_test.go index 872724d..adaabaf 100644 --- a/bot_test.go +++ b/bot_test.go @@ -179,7 +179,7 @@ func TestLogout(t *testing.T) { } func TestSendMessage(t *testing.T) { - bot := defaultBot() + bot := defaultBot(Desktop) if err := bot.Login(); err != nil { t.Error(err) return diff --git a/caller.go b/caller.go index ac39870..e19de9f 100644 --- a/caller.go +++ b/caller.go @@ -4,6 +4,7 @@ import ( "errors" "net/http" "os" + "strings" ) // 调用请求和解析请求 @@ -71,6 +72,11 @@ func (c *Caller) GetLoginInfo(body []byte) (*LoginInfo, error) { return nil, errors.New("redirect url does not match") } path := string(results[1]) + if strings.Contains(path, "wx2") { + c.Client.UrlManager = normal + } else { + c.Client.UrlManager = desktop + } resp := NewReturnResponse(c.Client.GetLoginInfo(path)) if resp.Err() != nil { return nil, resp.Err()