diff --git a/models/available.go b/models/available.go index e52602e..af90056 100644 --- a/models/available.go +++ b/models/available.go @@ -220,33 +220,25 @@ func CookieOK(ck *JdCookie) bool { if ui.Msg == "not login" { if ck.Available == True { ck.Push(fmt.Sprintf("失效账号,%s", ck.PtPin)) - //临时使用别人代码 JdCookie{}.Push(fmt.Sprintf("失效账号,%s", ck.Nickname)) if len(ck.WsKey) > 0 { var pinky = fmt.Sprintf("pin=%s;wskey=%s;", ck.PtPin, ck.WsKey) - msg1 := cmd(fmt.Sprintf(`python3 test.py "%s"`, pinky), &Sender{}) - JdCookie{}.Push(fmt.Sprintf("自动转换wskey---%s", msg1)) - ss := regexp.MustCompile(`pt_key=([^;=\s]+);pt_pin=([^;=\s]+)`).FindAllStringSubmatch(msg1, -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) - (&JdCookie{}).Push(msg) - logs.Info(msg) - } else { - if Cdle { - ck.Hack = True - } - (&JdCookie{}).Push("转换失败") - } - } - - return false + 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) + ck := JdCookie{ + PtKey: ptKey, + PtPin: ptPin, + } + if nck, err := GetJdCookie(ck.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("转换失败") } }