refactor:使用telegram通知
This commit is contained in:
父節點
f3ff4cc95e
當前提交
baff19e775
@ -36,17 +36,17 @@ axiosRetry(sduAxios, {
|
|||||||
|
|
||||||
export async function logAndNotifyUser(text: string) {
|
export async function logAndNotifyUser(text: string) {
|
||||||
console.log(text)
|
console.log(text)
|
||||||
await axios.post('https://qmsg.zendee.cn/send/' + appConfig.qmsgKey, qs.stringify({
|
// await axios.post('https://qmsg.zendee.cn/send/' + appConfig.qmsgKey, qs.stringify({
|
||||||
msg: text
|
// msg: text
|
||||||
}), {
|
// }), {
|
||||||
headers: {
|
// headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
// 'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
// await axios.post('https://' + appConfig.tgApiDomain + '/bot' + appConfig.tgApiKey + '/sendMessage', qs.stringify({
|
await axios.post('https://' + appConfig.tgApiDomain + '/bot' + appConfig.tgApiKey + '/sendMessage', qs.stringify({
|
||||||
// chat_id: appConfig.tgChatId,
|
chat_id: appConfig.tgChatId,
|
||||||
// text: text
|
text: text
|
||||||
// }))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sleep(ms: number) {
|
export function sleep(ms: number) {
|
||||||
|
22
src/test.ts
22
src/test.ts
@ -1,5 +1,5 @@
|
|||||||
import {appConfig} from "./config"
|
import {appConfig} from "./config"
|
||||||
import {sduAxios} from "./includes"
|
import {logAndNotifyUser, sduAxios} from "./includes"
|
||||||
import {reqBody} from "./poll"
|
import {reqBody} from "./poll"
|
||||||
import * as fs from "fs"
|
import * as fs from "fs"
|
||||||
import {IJsonCourse} from "./types"
|
import {IJsonCourse} from "./types"
|
||||||
@ -19,15 +19,17 @@ async function test() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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)
|
// 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))
|
// console.log(resp.data)
|
||||||
let courseList: IJsonCourse[] = resp.data.aaData
|
// fs.writeFileSync('arr.json', JSON.stringify(resp.data.aaData, null, 2))
|
||||||
courseList = courseList.filter(single => single.kcmc.includes('稷下创新')
|
// let courseList: IJsonCourse[] = resp.data.aaData
|
||||||
&& single.xf >= 2)
|
// courseList = courseList.filter(single => single.kcmc.includes('稷下创新')
|
||||||
for (let course of courseList) {
|
// && single.xf >= 2)
|
||||||
console.log(course.kcmc + ' ' + course.kch + ' ' + course.kxh + ' ' + course.syrs + ' ' + course.xf)
|
// for (let course of courseList) {
|
||||||
}
|
// console.log(course.kcmc + ' ' + course.kch + ' ' + course.kxh + ' ' + course.syrs + ' ' + course.xf)
|
||||||
|
// }
|
||||||
|
logAndNotifyUser('log test')
|
||||||
}
|
}
|
||||||
|
|
||||||
test()
|
test()
|
||||||
|
載入中…
x
新增問題並參考
Block a user