diff --git a/models/available.go b/models/available.go index 497cc90..b0ca466 100644 --- a/models/available.go +++ b/models/available.go @@ -4,9 +4,11 @@ import ( "encoding/json" "fmt" "net/url" + "regexp" "strings" "github.com/beego/beego/v2/client/httplib" + "github.com/beego/beego/v2/core/logs" ) type UserInfoResult struct { @@ -163,7 +165,33 @@ 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)) + var pinky = fmt.Sprintf("pin=%s;wskey=%s;", ck.PtPin, ck.WsKey) + msg1 := cmd(fmt.Sprintf(`wskey="%s" python3 wspt.py`, 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 + } + } + } + + return false + } } return false } diff --git a/models/bot.go b/models/bot.go index a3b233c..da09183 100644 --- a/models/bot.go +++ b/models/bot.go @@ -85,7 +85,6 @@ var handleMessage = func(msgs ...interface{}) interface{} { switch msg { default: { - if strings.Contains(msg, "wskey=") { rsp := cmd(fmt.Sprintf(`python3 test.py "%s"`, msg), &Sender{}) logs.Info(rsp)