[Alibaba Cloud Disk] Automatic daily check-in, no deployment required, no server required

1. Enter the web version of Kingsoft Documentation

https://www.kdocs.cn/

2. Create a new empty form, click [Efficiency] - [Advanced Development] - [AirScript Script Editor]

insert image description here

3. Click [Create Script] - [Document Sharing Script]

insert image description here

4. After the creation is successful, name it casually. Here I name it: Aliyun disk sign-in

insert image description here

5. Click【Service】-【Add Service】

insert image description here

6. Add all three services

insert image description here

7. Copy the following code into the editor

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.163.com", // 邮箱 的SMTP服务器的域名
      port: 465,
      username: "[email protected]", // 邮箱地址
      password: "QADSEMPKDHDAVWVD", // 邮箱的SMTP密码,非密码
      secure: true
});
  mailer.send({
    
    
          from: "阿里云盘签到<[email protected]>", // 发件人
          to: jsyx, // 收件人
          subject: "阿里云盘签到通知-"+data_time, // 主题
          text: value, // 文本
      })
}else{
    
    
  console.log(value)
}

8. Obtain the value of refresh_token from the browser: log in to Alibaba Cloud Disk with the browser

insert image description here

9. Copy the refresh_token value to the table, (A2-A20) can write multiple account tokens

insert image description here

10. Fill in the form whether to receive the reward (if yes, you will automatically receive the sign-in reward, if not, you will only sign in, and you can manually receive the sign-in reward when you need it), whether to send an email notification, if you send an email notification, you must write it in the receiving mailbox Address, don’t write it if you don’t send it, pay attention to the correct position, remember to save it after editing the form.

insert image description here

11. In the script, click the [Save] button above, and then click the [Run] button

insert image description here

12. Close the code editing box, click [Efficiency] - [Advanced Development] - [Timed Task]

insert image description here

13. Click [Create Task] to set the running time every day, select the script you just selected, save it, and you're done

insert image description here

14. You can set your own mailbox and SMTP protocol in the script

15. Effect

insert image description here

Guess you like

Origin blog.csdn.net/ihero/article/details/131627785