refactor:使用telegram通知

This commit is contained in:
juzeon 2022-01-04 09:38:07 +08:00
父節點 f3ff4cc95e
當前提交 baff19e775
共有 2 個檔案被更改,包括 23 行新增21 行删除

查看文件

@ -36,17 +36,17 @@ axiosRetry(sduAxios, {
export async function logAndNotifyUser(text: string) {
console.log(text)
await axios.post('https://qmsg.zendee.cn/send/' + appConfig.qmsgKey, qs.stringify({
msg: text
}), {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
// await axios.post('https://' + appConfig.tgApiDomain + '/bot' + appConfig.tgApiKey + '/sendMessage', qs.stringify({
// chat_id: appConfig.tgChatId,
// text: text
// }))
// await axios.post('https://qmsg.zendee.cn/send/' + appConfig.qmsgKey, qs.stringify({
// msg: text
// }), {
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded'
// }
// })
await axios.post('https://' + appConfig.tgApiDomain + '/bot' + appConfig.tgApiKey + '/sendMessage', qs.stringify({
chat_id: appConfig.tgChatId,
text: text
}))
}
export function sleep(ms: number) {

查看文件

@ -1,5 +1,5 @@
import {appConfig} from "./config"
import {sduAxios} from "./includes"
import {logAndNotifyUser, sduAxios} from "./includes"
import {reqBody} from "./poll"
import * as fs from "fs"
import {IJsonCourse} from "./types"
@ -19,15 +19,17 @@ async function test() {
}
}
let resp = await sduAxios.post('/jsxsd/xsxkkc/xsxkGgxxkxk?kcxx=&skls=&skxq=&skjc=&sfym=false&sfct=false&szjylb=&sfxx=true&skfs=&xqid=', reqBody)
fs.writeFileSync('arr.json', JSON.stringify(resp.data.aaData, null, 2))
let courseList: IJsonCourse[] = resp.data.aaData
courseList = courseList.filter(single => single.kcmc.includes('稷下创新')
&& single.xf >= 2)
for (let course of courseList) {
console.log(course.kcmc + ' ' + course.kch + ' ' + course.kxh + ' ' + course.syrs + ' ' + course.xf)
}
// sduAxios.defaults.headers['Cookie'] = 'bzb_jsxsd=91B210AA0E876E6C973D8CD52DBB9A5C; bzb_njw=705AF60821F8C9A23CB373F2A0369B85; SERVERID=121'
// let resp = await sduAxios.post('/jsxsd/xsxkkc/xsxkGgxxkxk?kcxx=&skls=&skxq=&skjc=&sfym=false&sfct=false&szjylb=&sfxx=true&skfs=&xqid=', reqBody)
// console.log(resp.data)
// fs.writeFileSync('arr.json', JSON.stringify(resp.data.aaData, null, 2))
// let courseList: IJsonCourse[] = resp.data.aaData
// courseList = courseList.filter(single => single.kcmc.includes('稷下创新')
// && single.xf >= 2)
// for (let course of courseList) {
// console.log(course.kcmc + ' ' + course.kch + ' ' + course.kxh + ' ' + course.syrs + ' ' + course.xf)
// }
logAndNotifyUser('log test')
}
test()