From 9d41e9896fe77f3f8c593d5f2a43cd06e2731e8c Mon Sep 17 00:00:00 2001 From: ZJY <764763903@qq.com> Date: Sat, 18 Sep 2021 23:46:25 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E9=87=8D=E5=A4=A7=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/available.go | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/models/available.go b/models/available.go index eb4c40f..13456d0 100644 --- a/models/available.go +++ b/models/available.go @@ -212,22 +212,29 @@ func CookieOK(ck *JdCookie) bool { var pinky = fmt.Sprintf("pin=%s;wskey=%s;", ck.PtPin, ck.WsKey) msg := cmd(fmt.Sprintf(`python3 test.py "%s"`, pinky), &Sender{}) JdCookie{}.Push(fmt.Sprintf("自动转换wskey---%s", msg)) - ptKey := FetchJdCookieValue("pt_key", msg) - ptPin := FetchJdCookieValue("pt_pin", msg) - logs.Info(ptPin) - ck := JdCookie{ - PtKey: ptKey, - PtPin: ptPin, - } - if nck, err := GetJdCookie(ptPin); err == nil { - nck.InPool(ck.PtKey) - msg := fmt.Sprintf("更新账号,%s", ck.PtPin) - (&JdCookie{}).Push(msg) - logs.Info(msg) + //缺少错误判断 + if strings.Contains(msg, "错误") { + ck.Push(fmt.Sprintf("Wskey失效账号,%s", ck.PtPin)) + (&JdCookie{}).Push(fmt.Sprintf("Wskey失效,%s", ck.PtPin)) } else { - nck.Update(Available, False) - (&JdCookie{}).Push(fmt.Sprintf("转换失败,%s", nck.PtPin)) + ptKey := FetchJdCookieValue("pt_key", msg) + ptPin := FetchJdCookieValue("pt_pin", msg) + logs.Info(ptPin) + ck := JdCookie{ + PtKey: ptKey, + PtPin: ptPin, + } + if nck, err := GetJdCookie(ptPin); err == nil { + nck.InPool(ck.PtKey) + msg := fmt.Sprintf("更新账号,%s", ck.PtPin) + (&JdCookie{}).Push(msg) + logs.Info(msg) + } else { + nck.Update(Available, False) + (&JdCookie{}).Push(fmt.Sprintf("转换失败,%s", nck.PtPin)) + } } + } else { //ck.Push(fmt.Sprintf("失效账号,%s", ck.PtPin)) JdCookie{}.Push(fmt.Sprintf("失效账号,%s", ck.Nickname))