[Asm] 纯文本查看 复制代码
let tokenColumn = "A"; // 设置变量为A
let zhanghao = "B";
let smtp_mail = Application.Range("D1").Text; // SMTP服务器域名
let port_mail = parseInt(Application.Range("D2").Text); // port
let mail_mail = Application.Range("D3").Text; // 发送邮箱地址
let mima_mail = Application.Range("D4").Text; // 邮箱SMTP密码
let jieshou_mail = Application.Range("F1").Text; // 接受邮箱
let wangzhan = Application.Range("H1").Text; // 网站
for (let row = 2; row <= 10; row++) { // 做2-20的循环
let refresh_token = Application.Range(tokenColumn + row).Text; // 设置变量refresh_token的文本为A加上循环的次数
let tz = Application.Range(zhanghao + row).Text;
if (refresh_token != "") { // 如果变量refresh_token位置为不为空时,发起POST请求
let resp = HTTP.fetch(wangzhan +"/user/checkin", { //请求的网站,例如论坛签到的链接[url=http://www.52pojie.cn/home.php?mod=task&do=apply&id=2]www.52pojie.cn/home.php?mod=task&do=apply&id=2[/url][color=#a31515][backcolor=rgb(255, 255, 254)][font=Consolas, "] 改为[/font][/backcolor][/color]wangzhan +"[color=#a31515][backcolor=rgb(255, 255, 254)][font=Consolas, "]/home.php?mod=task&do=apply&id=2[/font][/backcolor][/color]", 在对应let wangzhan = Application.Range("H1").Text; // 写入网站地址
method: "POST",
timeout: 2000,
headers: {
"Accept": "application/json, text/javascript, */*; q=0.01",
"X-Requested-With": "XMLHttpRequest",
"sec-ch-ua-mobile": "?0",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.69",
"Origin": wangzhan,
"Referer": wangzhan +"/user",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
"Cookie": refresh_token
},
body: JSON.stringify({})
});
if (resp.status !== 200) {
throw new Error("fetch err! status is " + resp.status);
}
// 使用resp.text()来获取响应内容
let text3 = resp.text();
let text2; // 新增的变量
// 检查响应文本并设置相应的消息
if (text3.includes("dQ")) { //这里是因为签到返回的出现乱码我只能根据部分信息来判断,有大佬可以教下。这里的意思是如果包含就返回对应的值。
text2 = "你已经签到过了。";
} else if (text3.includes("RXJB")) {
text2 = "签到成功。";
} else {
text2 = "未知响应内容:" + text3;
}
// 发送邮件
mailer = SMTP.login({
host: smtp_mail,
port: port_mail,
username: mail_mail,
password: mima_mail,
secure: true
});
mailer.send({
from: "xxx签到<"+ mail_mail + ">",
to: jieshou_mail, //如果是通知不相同的邮箱可以写to: tz,
subject: "xxx签到通知 - " + tz,
text: "账号"+ " " + tz + " " + text2,
});
// 打印消息
console.log("账号"+ " " + tz + " " + text2);
}
}