2022-02-28 08:35:03 +08:00

47 行
1.5 KiB
TypeScript

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()