Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复冻结账号会触发SetRelogin导致无限登录的问题 #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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[bot.Uin] {
if bot.Online.Load() {
log.Warn("Bot已登录")
return
Expand Down
1 change: 1 addition & 0 deletions pkg/bot/captcha.go
Original file line number Diff line number Diff line change
Expand Up @@ -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-<QQ>.json文件后再次尝试")
msg := rsp.ErrorMessage
Expand Down