From 52f7eb27d060260d31be96ca72d94354566d74cb Mon Sep 17 00:00:00 2001 From: ZJY <764763903@qq.com> Date: Sat, 18 Sep 2021 21:59:02 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=96=B0=E5=A2=9E=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=BB=98=E8=AE=A4=E7=A6=81=E7=94=A8wskey?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=20=E9=9C=80=E8=A6=81=E7=9A=84=E5=A1=ABtrue?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=85=8D=E7=BD=AE=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=85=B3=E9=97=ADwskey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/demo_config.yaml | 1 + controllers/login.go | 3 +-- models/available.go | 47 ++++++++++++++++++++++++------------------- models/config.go | 1 + models/wskey.go | 18 ++++++++++++----- readme.txt | 8 +++++--- 6 files changed, 47 insertions(+), 31 deletions(-) diff --git a/conf/demo_config.yaml b/conf/demo_config.yaml index 0f113bd..208a0b6 100644 --- a/conf/demo_config.yaml +++ b/conf/demo_config.yaml @@ -12,6 +12,7 @@ AtTime: #填写1-12之间的数 填错自负默认为10 10点容易出现高 IsHelp: #填写true或者false false IsOldV4: #填写true或者false false是否新版或者旧版V4 ApiToken: #为空默认随机禁用 +Wskey: # 填空默认禁用wskey转换 需要的填true theme: static: ./static master: diff --git a/controllers/login.go b/controllers/login.go index 6129b2d..00f8c68 100644 --- a/controllers/login.go +++ b/controllers/login.go @@ -352,8 +352,7 @@ func (c *LoginController) CkLogin() { logs.Info(pin) logs.Info(key) - c.Ctx.Redirect(200, "/userCenter?pin="+pin) - c.StopRun() + c.Ctx.WriteString("添加成功") //if key != "" && pin != "" { // //ptKey := FetchJdCookieValue("pt_key", cookies) // //ptPin := FetchJdCookieValue("pt_pin", cookies) diff --git a/models/available.go b/models/available.go index dc546eb..6c3a05d 100644 --- a/models/available.go +++ b/models/available.go @@ -207,28 +207,33 @@ func CookieOK(ck *JdCookie) bool { if ui.Msg == "not login" { if ck.Available == True { - ck.Push(fmt.Sprintf("失效账号,%s", ck.PtPin)) - ck.Update(Available, false) - JdCookie{}.Push(fmt.Sprintf("失效账号,%s", ck.Nickname)) - if len(ck.WsKey) > 0 { - 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) - 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("转换失败") + if Config.Wskey { + ck.Push(fmt.Sprintf("失效账号,%s", ck.PtPin)) + ck.Update(Available, false) + JdCookie{}.Push(fmt.Sprintf("失效账号,%s", ck.Nickname)) + if len(ck.WsKey) > 0 { + 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) + 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("转换失败") + } } + } else { + ck.Push(fmt.Sprintf("失效账号,%s", ck.PtPin)) + JdCookie{}.Push(fmt.Sprintf("失效账号,%s", ck.Nickname)) } } diff --git a/models/config.go b/models/config.go index fbe3123..b362567 100644 --- a/models/config.go +++ b/models/config.go @@ -36,6 +36,7 @@ type Yaml struct { IsHelp bool `yaml:"IsHelp"` IsOldV4 bool `yaml:"IsOldV4"` ApiToken string `yaml:"ApiToken"` + Wskey bool `yaml:"Wskey"` Node string Npm string Python string diff --git a/models/wskey.go b/models/wskey.go index 16398db..b6cd122 100644 --- a/models/wskey.go +++ b/models/wskey.go @@ -14,10 +14,18 @@ func intiSky() { //定时任务 spec := "0 " + strconv.Itoa(rand.Intn(59)) + " " + Config.CTime + "/12 * * ?" //cron表达式,每秒一次 logs.Info(spec) - c.AddFunc(spec, func() { - fmt.Println("开始wskey转换") - updateCookie() - }) + if Config.Wskey { + c.AddFunc(spec, func() { + fmt.Println("开始wskey转换") + updateCookie() + }) - c.Start() + c.Start() + } + //c.AddFunc(spec, func() { + // fmt.Println("开始wskey转换") + // updateCookie() + //}) + // + //c.Start() } diff --git a/readme.txt b/readme.txt index f5304ea..7a1a52f 100644 --- a/readme.txt +++ b/readme.txt @@ -36,15 +36,17 @@ fix 重大BUG修复,解决以下几个问题, 2.不管是CK新增还是WSKEY新增账号导致清空CK,由1导致的 3.新增添加后自动回复查询参数。 4.修复账号无限判错问题。 +新增纯CK版本 可配置调整为WSKEY+CK 和纯CK版本 +Wskey: # 填空默认禁用wskey转换 需要的填true新增配置 默认关闭wskey +需要的自己设置下 + 以上是做完了 以下是待开发 -新增纯CK版本 可配置调整为WSKEY+CK 和纯CK版本 + 验证码登录直接接入 plus登陆页面 ---会员中心给你们看个样板图把 -考虑仓库私有化 另附如果不喜欢别用 ninja和xdd魔改版大有人做 免费开源没收你钱总不能还挨你一顿喷? - 编码问题参考 https://blog.csdn.net/qq_29499107/article/details/83583983 /usr/lib64/python3.6/http