升级,定时每天早上8点 晚上8点准时更新

This commit is contained in:
ZJY 2021-09-07 01:46:53 +08:00
parent 1eed2eadc8
commit 1ebe1aa3b5
3 changed files with 47 additions and 4 deletions

View File

@ -133,7 +133,49 @@ func initCookie() {
go func() {
Save <- &JdCookie{}
}()
}
func updateCookie() {
cks := GetJdCookies()
l := len(cks)
for i := 0; i < l-1; i++ {
if len(cks[i].WsKey) > 0 {
rsp := cmd(fmt.Sprintf(`python3 test.py "%s"`, cks[i].WsKey), &Sender{})
ss := regexp.MustCompile(`pt_key=([^;=\s]+);pt_pin=([^;=\s]+)`).FindAllStringSubmatch(rsp, -1)
if len(ss) > 0 {
xyb := 0
for _, s := range ss {
ck := JdCookie{
PtKey: s[1],
PtPin: s[2],
}
if CookieOK(&ck) {
xyb++
if HasKey(ck.PtKey) {
(&JdCookie{}).Push(fmt.Sprintf("重复提交"))
} else {
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 {
NewJdCookie(&ck)
msg := fmt.Sprintf("添加账号,账号名:%s", ck.PtPin)
logs.Info(msg)
}
}
} else {
(&JdCookie{}).Push(fmt.Sprintf("无效CK转换失败%s", ck.PtPin))
}
}
}
go func() {
Save <- &JdCookie{}
}()
}
}
}
func CookieOK(ck *JdCookie) bool {

View File

@ -9,9 +9,10 @@ func intiSky() {
c := cron.New(cron.WithSeconds()) //精确到秒
//定时任务
spec := "1 * * * * ?" //cron表达式每秒一次
spec := "0 0 8/12 * * ?" //cron表达式每秒一次
c.AddFunc(spec, func() {
fmt.Println("11111")
fmt.Println("开始wskey转换")
})
c.Start()

View File

@ -6,7 +6,7 @@
在青龙里面系统设置,添加应用后配置
3.发送wskey即可自动添加账号
4.账号过期自动换key 更新修复完成
5.定时十二小时自动换key 暂未好
5.定时十二小时自动换key 开发完没测试
6.缓存token
7.批量绑定wskey
8.多容器 token缓存过期问题修复 修复
@ -15,7 +15,7 @@
12.可替换失效wskey
13wskey失效检测 等待开发
14 找猫咪偷一下CK模糊检测
15 写入失败问题
15 写入失败问题 不知道啥原因
16 wskey失效两次转换