需要自行去青龙面板添加环境变量P5X,如果不需要推送自行修改,环境变量内容是完美账号Cookie
const notify = require('./sendNotify.js');
let axios = require('axios');
let title = "P5X签到\n";
let cookie = process.env.P5X;
let maxRetries = 5;
let attempt = 0;
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function sendRequest() {
attempt++;
try {
let response = await axios({
url: 'https://pwgcapi.wanmei.com/m/act/month-sign/sign?uid=137532109&actId=195&roleId=10006484353&serverId=88',
method: 'get',
headers: {
Cookie: cookie
}
});
console.log(response.data);
notify.sendNotify(title + JSON.stringify(response.data), '');
} catch (err) {
console.log(err);
if (attempt < maxRetries) {
console.log(`Retrying... (${attempt}/${maxRetries})`);
await sleep(1000); // 休眠 1 秒
sendRequest();
} else {
notify.sendNotify(title + '登录失败', '');
}
}
}
// 开始请求
sendRequest();