forked from Wenmoux/checkbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheverphoto.js
61 lines (60 loc) · 1.7 KB
/
everphoto.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");
phone = config.everphoto.phone;
password = config.everphoto.password;
let result = "【时光相册每日签到】:";
let header = {
headers: {
"User-Agent": "EverPhoto/2.7.0 (Android;2702;ONEPLUS A6000;28;oppo)",
"x-device-mac": "02:00:00:00:00:00",
application: "tc.everphoto",
authorization: "Bearer 94P6RfZqvVQ2hH4jULaYGI",
"x-locked": "1",
"content-length": "0",
},
};
token = null;
function balance() {
return new Promise(async (resolve) => {
try {
let url = "https://web.everphoto.cn/api/auth";
data = `mobile=${phone}&password=${password}`;
let res = await axios.post(url, data, header);
token = res.data.data.token;
} catch (err) {
console.log("登陆失败" + err.response.data.message);
result += "登陆失败" + err.response.data.message + " ";
}
resolve();
});
}
function check() {
return new Promise(async (resolve) => {
try {
let url = "https://api.everphoto.cn/users/self/checkin/v2";
data = "";
let res = await axios.post(url, data, header);
if (res.data.code == 0) {
if (!res.data.data.checkin_result) {
msg = "已签到过或签到失败";
} else {
msg = "签到成功";
}
} else {
msg = "签到失败";
}
result += msg;
console.log(msg);
} catch (err) {
console.log(err.response.data.message);
// result +=err.response.data.message
}
resolve(result);
});
}
async function task() {
await balance();
header.headers.authorization = `Bearer ${token}`;
return await check();
}
//task()
module.exports = task;