From d0238a00aefb42d946e2286173d9384ff4738cdd Mon Sep 17 00:00:00 2001 From: eatMoreApple <15055461510@163.com> Date: Fri, 7 May 2021 23:47:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0desktop=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot_test.go | 2 +- caller.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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()