共计 2153 个字符,预计需要花费 6 分钟才能阅读完成。
不想自己折腾的就直接跳到步骤8获取token。然后贴到我的在线文档去
**********************分割线*************************************************************************
1.打开金山在线文档
2.新建一个在线表格
3.找到效率开发
4.新建脚本
5.添加服务
6.三个服务都要添加
7.复制脚本粘贴进去
var myDate = new Date();
var data_time = myDate.toLocaleDateString()
function sleep(d){
for(var t = Date.now();Date.now() - t <= d;);
}
var value= ""
for (let ii = 2; ii <= 20; ii++){
dyg = "A"+ii
var refresh_token = Application.Range(dyg).Text
if(refresh_token != ""){
// 发起网络请求-获取token
let data = HTTP.post("https://auth.aliyundrive.com/v2/account/token",
JSON.stringify({
"grant_type": "refresh_token",
"refresh_token":refresh_token
})
)
data = data.json()
var access_token = data['access_token']
var phone = data["user_name"]
if (access_token == undefined){
var value ="单元格【"+dyg+"】内的token值错误,程序执行失败,请重新复制正确的token值"+"\n"
}else{
try{
var access_token2 = 'Bearer '+access_token
// 签到
let data2 = HTTP.post("https://member.aliyundrive.com/v1/activity/sign_in_list",
JSON.stringify({"_rx-s": "mobile"}),
{headers:{"Authorization":access_token2}}
)
data2=data2.json()
var signin_count = data2['result']['signInCount']
var value =value+ "账号:"+data["user_name"]+"-签到成功, 本月累计签到"+ signin_count+"天"+"\n"
}catch{
var value ="单元格【"+dyg+"】内的token签到失败"+"\n"
return
}
sleep(1000)
var sflq = Application.Range("B"+ii).Text
if (sflq == "是"){
try{
// 领取奖励
let data3 = HTTP.post(
"https://member.aliyundrive.com/v1/activity/sign_in_reward?_rx-s=mobile",
JSON.stringify({"signInDay": signin_count}),
{headers:{"Authorization":access_token2}}
)
data3=data3.json()
var value = value +"本次签到获得"+data3["result"]["name"] +","+data3["result"]["description"]+"\n"
}catch{
var value = value+ "账号:"+data["user_name"]+"-领取奖励失败"+"\n"
}
}else{
value = value +"奖励待领取"+"\n"
}
}
}
}
var sftz = Application.Range("E"+1).Text
if (sftz=="是"){
var jsyx = Application.Range("E"+2).Text
// 配置发送邮箱
let mailer = SMTP.login({
host: "smtp.exmail.qq.com", // 邮箱 的SMTP服务器的域名
port: 465,
username: "*********", // 邮箱地址
password: "********.", // 邮箱的SMTP密码,非密码
secure: true
});
mailer.send({
from: "阿里云盘签到<fs8484848@163.com>", // 发件人
to: jsyx, // 收件人
subject: "阿里云盘签到通知-"+data_time, // 主题
text: value, // 文本
})
}else{
console.log(value)
}
8.获取阿里云盘的token
利用alist文档获取token
https://alist.nn.ci/zh/guide/drivers/aliyundrive.html
9.粘贴表格并跟进脚本内容填写相关内容
10.最后就是创建定时任务,1天1次即可
分割线,以下是签到日志
正文完