feat:resetCookie脚本

This commit is contained in:
2022-02-28 08:35:03 +08:00
parent a0ef04285e
commit eb39fb1c04
7 changed files with 93 additions and 3 deletions

46
src/draw.ts Normal file
View File

@@ -0,0 +1,46 @@
import {countStr, getTimeNow, logAndNotifyUser, resetCookie, sduAxios, sleep} from "./includes"
import * as fs from "fs"
export async function draw() {
while (true) {
let html = ''
try {
let resp = await sduAxios.get("jsxsd/xsxkjg/comeXkjglb?isktx=true")
html = JSON.stringify(resp.data)
} catch (e) {
console.log(e)
}
if (countStr(html, 'cqOper') < 2) {
logAndNotifyUser('登录失败重设cookie ' + getTimeNow())
try {
await resetCookie()
} catch (e) {
console.log(e)
}
continue
}
if (countStr(html, 'cqOper') > 2) {
logAndNotifyUser('可以抽签,正在进行抽签')
fs.writeFileSync('draw-' + Date.now() + '.html', html)
let arr = [
'2021202222605',// 英语
'2021202225984',// 周易
'2021202225817',// 刻瓷
'2021202222614',// 众智
'2021202222613',// 移动互联网
]
for (let id of arr) {
try {
let resp = await sduAxios.get('/jsxsd/xsxkjg/xscqOper?jx0404id=' + id + '&cqqk=3')// 3抽的中2抽不中
logAndNotifyUser(JSON.stringify(resp.data))
} catch (e) {
console.log(e)
}
}
}
console.log('轮询中:' + getTimeNow())
await sleep(1000)
}
}
draw()