MCPcopy Create free account
hub / github.com/ClydeTime/Surge / signCheckin

Function signCheckin

Script/Task/ADrive.js:96–156  ·  view source on GitHub ↗
(authorization)

Source from the content-addressed store, hash-verified

94}
95
96function signCheckin(authorization) {
97 let date = new Date()
98 let timeStamp = Date.parse(date)
99 const xumt = 'defaultFY1_fyjs_not_loaded@@https://pages.aliyundrive.com/mobile-page/web/dailycheck.html@@' + timeStamp
100 const url_fetch_sign = {
101 url: 'https://member.aliyundrive.com/v1/activity/sign_in_list',
102 headers: {
103 'Content-Type': 'application/json',
104 'accept': 'application/json, text/plain, */*',
105 'authorization': authorization,
106 'x-canary': ADriveInfo.headers['x-canary'],
107 'x-umt': xumt,
108 'origin': 'https://pages.aliyundrive.com',
109 'x-ua': xumt,
110 'user-agent': ADriveInfo.headers['user-agent'],
111 'referer': 'https://pages.aliyundrive.com/'
112 },
113 body: $.toStr({})
114 }
115 $.log('签到开始')
116 $.post(url_fetch_sign, function (error, response, data) {
117 if (error) {
118 $.log('错误:' + error)
119 $.msg($.name, '❌签到失败', '无法签到,请手动签到')
120 $.done()
121 } else if (!data) {
122 $.log('没有获取到数据')
123 } else {
124 let body = $.toObj(data)
125 let signInCount = Number(body.result.signInCount)
126 let isReward = body.result.isReward
127 let stitle = '🎉' + body.result.title + ' 签到成功'
128 let signInLogs = body.result.signInLogs
129 $.log('签到天数: ' + signInCount)
130 let reward = ''
131 signInLogs.forEach(function (i) {
132 if (Number(i.day) === signInCount) {
133 if (i.isReward) {
134 reward = ' 第' + signInCount + '天奖励,' + i.reward.name + i.reward.description
135 $.log('签到奖励:' + reward)
136 } else {
137 reward = i.poster?.reason + '\n' + i.poster?.name
138 if (reward === 'undefined\nundefined') {
139 reward = ''
140 $.log('签到完成')
141 GetReword(authorization, signInCount)
142 }
143 }
144 }
145 })
146 if (isReward && reward) {
147 $.msg($.name, stitle, reward)
148 }
149 if (!isReward && reward) {
150 stitle = '⚠️今天已经签到过了'
151 $.msg($.name, stitle, reward)
152 }
153 $.done()

Callers 1

GetAuthorizationKeyFunction · 0.85

Calls 8

GetRewordFunction · 0.85
parseMethod · 0.45
toStrMethod · 0.45
logMethod · 0.45
postMethod · 0.45
msgMethod · 0.45
doneMethod · 0.45
toObjMethod · 0.45

Tested by

no test coverage detected