diff --git a/conf/demo_config.yaml b/conf/demo_config.yaml index 208a0b6..5d8a682 100644 --- a/conf/demo_config.yaml +++ b/conf/demo_config.yaml @@ -23,6 +23,7 @@ resident: user_agent: telegram_bot_token: telegram_user_id: +TGURL: #填写TG代理地址参考https://www.kejiwanjia.com/server/5221.html#3worker qquid: qqgid: qbot_public_mode: true diff --git a/models/available.go b/models/available.go index c154fcf..d4b4e12 100644 --- a/models/available.go +++ b/models/available.go @@ -168,7 +168,10 @@ func updateCookie() { ck := cks[i] //JdCookie{}.Push(fmt.Sprintf("更新账号账号,%s", ck.Nickname)) var pinky = fmt.Sprintf("pin=%s;wskey=%s;", ck.PtPin, ck.WsKey) - rsp := cmd(fmt.Sprintf(`python3 test.py "%s"`, pinky), &Sender{}) + rsp, err := getKey(pinky) + if err != nil { + logs.Error(err) + } if strings.Contains(rsp, "错误") { ck.Push(fmt.Sprintf("Wskey失效账号,%s", ck.PtPin)) (&JdCookie{}).Push(fmt.Sprintf("Wskey失效,%s", ck.PtPin)) @@ -234,7 +237,10 @@ func CookieOK(ck *JdCookie) bool { if Config.Wskey { 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{}) + msg, err := getKey(pinky) + if err != nil { + logs.Error(err) + } JdCookie{}.Push(fmt.Sprintf("自动转换wskey---%s", msg)) //缺少错误判断 if strings.Contains(msg, "错误") { diff --git a/models/config.go b/models/config.go index b362567..5ea75db 100644 --- a/models/config.go +++ b/models/config.go @@ -37,6 +37,7 @@ type Yaml struct { IsOldV4 bool `yaml:"IsOldV4"` ApiToken string `yaml:"ApiToken"` Wskey bool `yaml:"Wskey"` + TGURL string `yaml:"TGURL"` Node string Npm string Python string diff --git a/models/tbot.go b/models/tbot.go index b9300b2..7071112 100644 --- a/models/tbot.go +++ b/models/tbot.go @@ -20,6 +20,7 @@ func initTgBot() { } var err error b, err = tb.NewBot(tb.Settings{ + URL: Config.TGURL, Token: Config.TelegramBotToken, Poller: &tb.LongPoller{Timeout: 10 * time.Second}, }) diff --git a/models/wck.go b/models/wck.go index 7f4307d..001b41b 100644 --- a/models/wck.go +++ b/models/wck.go @@ -57,12 +57,12 @@ func getKey(WSCK string) (string, error) { logs.Info(string(data)) logs.Info("获取token正常") tokenKey, _ := jsonparser.GetString(data, "tokenKey") - pt_key, err := appjmp(tokenKey) - logs.Info(pt_key) + ptKey, err := appjmp(tokenKey) + logs.Info(ptKey) if err != nil { return "", err } - return pt_key, nil + return ptKey, nil } func appjmp(tokenKey string) (string, error) {