From 9b7effb71a2549c195f927843e9d17d2e8265834 Mon Sep 17 00:00:00 2001 From: buhuang28 Date: Thu, 10 Feb 2022 02:02:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=BB=E7=BB=93?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E4=BC=9A=E8=A7=A6=E5=8F=91SetRelogin?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=97=A0=E9=99=90=E7=99=BB=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/bot/bot.go | 7 ++++--- pkg/bot/captcha.go | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/bot/bot.go b/pkg/bot/bot.go index 80677d1..3bd782f 100644 --- a/pkg/bot/bot.go +++ b/pkg/bot/bot.go @@ -11,8 +11,9 @@ import ( //go:generate go run github.com/a8m/syncmap -o "gen_client_map.go" -pkg bot -name ClientMap "map[int64]*client.QQClient" //go:generate go run github.com/a8m/syncmap -o "gen_token_map.go" -pkg bot -name TokenMap "map[int64][]byte" var ( - Clients ClientMap - LoginTokens TokenMap + Clients ClientMap + LoginTokens TokenMap + FrozenClient = make(map[int64]bool) ) func InitLog(cli *client.QQClient) { @@ -56,7 +57,7 @@ func SetRelogin(cli *client.QQClient, retryInterval int, retryCount int) { } bot.Disconnect() var times = 1 - for IsClientExist(bot.Uin) { + for IsClientExist(bot.Uin) && !FrozenClient[cli.Uin] { if bot.Online.Load() { log.Warn("Bot已登录") return diff --git a/pkg/bot/captcha.go b/pkg/bot/captcha.go index c2dc206..6b68b6d 100644 --- a/pkg/bot/captcha.go +++ b/pkg/bot/captcha.go @@ -128,6 +128,7 @@ func ProcessLoginRsp(cli *client.QQClient, rsp *client.LoginResponse) (bool, err } return ProcessLoginRsp(cli, rsp) case client.OtherLoginError, client.UnknownLoginError: + FrozenClient[cli.Uin] = true log.Errorf(rsp.ErrorMessage) log.Warnf("登陆失败,建议开启/关闭设备锁后重试,或删除device-.json文件后再次尝试") msg := rsp.ErrorMessage From 1b1f264c5c83d5f1cd572093a3d033131a903146 Mon Sep 17 00:00:00 2001 From: buhuang28 Date: Thu, 10 Feb 2022 02:03:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=BB=E7=BB=93?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E4=BC=9A=E8=A7=A6=E5=8F=91SetRelogin?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=97=A0=E9=99=90=E7=99=BB=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/bot/bot.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/bot/bot.go b/pkg/bot/bot.go index 3bd782f..3e2b4f7 100644 --- a/pkg/bot/bot.go +++ b/pkg/bot/bot.go @@ -57,7 +57,7 @@ func SetRelogin(cli *client.QQClient, retryInterval int, retryCount int) { } bot.Disconnect() var times = 1 - for IsClientExist(bot.Uin) && !FrozenClient[cli.Uin] { + for IsClientExist(bot.Uin) && !FrozenClient[bot.Uin] { if bot.Online.Load() { log.Warn("Bot已登录") return