-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHAM.js
51 lines (47 loc) · 1.18 KB
/
HAM.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* 任务名称
* name: 俊介:业余无线电考试报名
* 定时规则
* cron: 23 * * * *
*/
// 导入
const axios = require('axios');
// 登录令牌
const hamKey = process.env.HAMKEY;
// 获取列表
const getListURL = 'http://82.157.138.16:8091/CRAC/app/exam_exam/getExamList';
async function getList() {
// 构建请求体
const data = {
req: {
province: '1681', // 省份
type: 'A', // 类型
page_no: 1,
page_size: 10,
},
req_meta: {
user_id: hamKey, // 用户 ID
},
};
// 设置请求头
const headers = {
headers: {
'Content-Type': 'application/json',
},
};
// 发送请求
try {
const res = await axios.post(getListURL, data, headers);
if (res.data.code === 10010) {
console.log('湖北业余无线电无考试');
} else {
console.log('获取到业余无线电考试报名考试安排');
QLAPI.notify('获取到业余无线电考试报名考试安排', JSON.stringify(res.data));
}
} catch (error) {
console.error(`❗️ 获取数据失败!\n${error}`);
QLAPI.notify('业余无线电考试报名监控', '接口请求失败');
}
}
// 调用函数
getList();