From 6e9a446da53713f9cc03323c9ece3f40072a569e Mon Sep 17 00:00:00 2001 From: ZJY <764763903@qq.com> Date: Mon, 13 Sep 2021 13:29:14 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=8C=87=E5=AE=9A=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/command.go | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/models/command.go b/models/command.go index 4518dca..f930aff 100644 --- a/models/command.go +++ b/models/command.go @@ -671,27 +671,26 @@ var codeSignals = []CodeSignal{ if len(ck.WsKey) > 0 { var pinky = fmt.Sprintf("pin=%s;wskey=%s;", ck.PtPin, ck.WsKey) rsp := cmd(fmt.Sprintf(`python3 test.py "%s"`, pinky), &Sender{}) - ss := regexp.MustCompile(`pt_key=([^;=\s]+);pt_pin=([^;=\s]+)`).FindAllStringSubmatch(rsp, -1) - if len(ss) > 0 { - for _, s := range ss { - ck := JdCookie{ - PtKey: s[1], - PtPin: s[2], - } - if nck, err := GetJdCookie(ck.PtPin); err == nil { - nck.InPool(ck.PtKey) - msg := fmt.Sprintf("更新账号,%s", ck.PtPin) - sender.Reply(msg) - logs.Info(msg) - } else { - if Cdle { - ck.Hack = True - } - sender.Reply("转换失败") - } + if len(rsp) > 0 { + ptKey := FetchJdCookieValue("pt_key", rsp) + ptPin := FetchJdCookieValue("pt_pin", rsp) + ck := JdCookie{ + PtKey: ptKey, + PtPin: ptPin, } + if nck, err := GetJdCookie(ck.PtPin); err == nil { + nck.InPool(ck.PtKey) + msg := fmt.Sprintf("更新账号,%s", ck.PtPin) + sender.Reply(msg) + logs.Info(msg) + } else { + sender.Reply("转换失败") + } + } else { + sender.Reply(fmt.Sprintf("Wskey失效,%s", ck.Nickname)) } - sender.Reply(fmt.Sprintf("已更新指定账号%s", ck.Nickname)) + } else { + sender.Reply(fmt.Sprintf("Wskey为空,%s", ck.Nickname)) } })