diff --git a/models/available.go b/models/available.go index bdabc69..1e18846 100644 --- a/models/available.go +++ b/models/available.go @@ -242,7 +242,57 @@ func CookieOK(ck *JdCookie) bool { } ui := &UserInfoResult{} if nil != json.Unmarshal(data, ui) { - return true + (&JdCookie{}).Push("第一个接口失效,切换到第二个接口,可能黑IP") + b2 := av2(cookie) + if b2 == false { + if ck.Available == True { + ck.Update(Available, False) + logs.Info(ck.Available) + if Config.Wskey { + if len(ck.WsKey) > 0 { + var pinky = fmt.Sprintf("pin=%s;wskey=%s;", ck.PtPin, ck.WsKey) + msg, err := getKey(pinky) + if err != nil { + logs.Error(err) + } + //JdCookie{}.Push(fmt.Sprintf("自动转换wskey---%s", msg)) + //缺少错误判断 + if strings.Contains(msg, "错误") { + ck.Push(fmt.Sprintf("Wskey失效账号,%s", ck.PtPin)) + (&JdCookie{}).Push(fmt.Sprintf("Wskey失效,%s", ck.PtPin)) + } else { + 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)) + } + } else { + ck.Push(fmt.Sprintf("失效账号,%s", ck.PtPin)) + JdCookie{}.Push(fmt.Sprintf("失效账号,%s", ck.Nickname)) + } + + } + return false + } else { + return true + } } switch ui.Retcode { case "1001": //ck.BeanNum