forked from Zoybzo/ikuuu-CheckIn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkin.js
61 lines (49 loc) · 1.36 KB
/
checkin.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
52
53
54
55
56
57
58
59
60
61
const axios = require('axios');
const checkIn = async (cookie) => {
return axios({
method: 'post',
url: 'https://ikuuu.dev/user/checkin',
headers: {
'Cookie': cookie
}
});
};
const checkInAndGetStatus = async (cookie) => {
const checkInMessage = (await checkIn(cookie))?.data?.message;
return {
'签到情况': checkInMessage
};
};
const pushplus = (token, infos) => {
const titleCheckInMessage = infos?.[0]['签到情况'];
const title = (
'签到情况: ' + `${titleCheckInMessage}`
).slice(0, 100);
const data = {
token,
title,
content: JSON.stringify(infos),
template: 'json'
};
console.log(data);
return axios({
method: 'post',
url: `http://www.pushplus.plus/send`,
data
});
};
const ikuuuCheckIn = async () => {
try {
const cookies = process.env.COOKIES?.split('&&') ?? [];
const infos = await Promise.all(cookies.map(async cookie => await checkInAndGetStatus(cookie)));
console.log(infos);
const PUSHPLUS = process.env.PUSHPLUS;
if (PUSHPLUS && infos.length) {
const pushResult = (await pushplus(PUSHPLUS, infos))?.data?.msg;
console.log(pushResult);
}
} catch (error) {
console.log(error);
}
};
ikuuuCheckIn();