|
12 | 12 | */ |
13 | 13 |
|
14 | 14 | function sign() { |
15 | | - const cookieName = "网易云音乐"; |
16 | | - const ccookieKey = "chavy_cookie_neteasemusic"; |
17 | | - const cookieVal = $prefs.valueForKey(cookieKey); |
| 15 | + const cookieName = '网易云音乐' |
| 16 | + const cookieKey = 'chavy_cookie_neteasemusic' |
| 17 | + const cookieVal = $prefs.valueForKey(cookieKey) |
18 | 18 |
|
19 | | - const pc = `http://music.163.com/api/point/dailyTask?type=1`; |
20 | | - const mobile = `http://music.163.com/api/point/dailyTask?type=0`; |
| 19 | + const pc = `http://music.163.com/api/point/dailyTask?type=1` |
| 20 | + const mobile = `http://music.163.com/api/point/dailyTask?type=0` |
21 | 21 |
|
22 | 22 | let url = { |
23 | 23 | url: null, |
24 | 24 | headers: { |
25 | 25 | Cookie: cookieVal |
26 | 26 | } |
27 | | - }; |
28 | | - url.url = pc; |
29 | | - $task.fetch(url).then(response => { |
30 | | - log("网易云音乐(PC端)", response.body); |
31 | | - }); |
| 27 | + } |
| 28 | + url.url = pc |
| 29 | + $task.fetch(url).then((response) => { |
| 30 | + log('网易云音乐(PC端)', response.body) |
| 31 | + }) |
32 | 32 |
|
33 | | - url.url = mobile; |
34 | | - $task.fetch(url).then(response => { |
35 | | - log("网易云音乐(移动端)", response.body); |
36 | | - }); |
| 33 | + url.url = mobile |
| 34 | + $task.fetch(url).then((response) => { |
| 35 | + log('网易云音乐(移动端)', response.body) |
| 36 | + }) |
37 | 37 | } |
38 | 38 |
|
39 | 39 | function log(title, data) { |
40 | | - let result = JSON.parse(data); |
| 40 | + let result = JSON.parse(data) |
41 | 41 | if (result.code == 200) { |
42 | | - console.log(`签到成功: ${title}`); |
43 | | - $notify("签到成功", title, ""); |
| 42 | + console.log(`签到成功: ${title}`) |
| 43 | + $notify('签到成功', title, '') |
44 | 44 | } else if (result.code == -2) { |
45 | | - console.log( |
46 | | - `签到跳过: ${title}, 编码: ${result.code}, 原因: ${result.msg}` |
47 | | - ); |
48 | | - $notify("签到跳过", title, `原因: ${result.msg}`); |
| 45 | + console.log(`签到跳过: ${title}, 编码: ${result.code}, 原因: ${result.msg}`) |
| 46 | + $notify('签到跳过', title, `原因: ${result.msg}`) |
49 | 47 | } else { |
50 | | - console.log( |
51 | | - `签到失败: ${title}, 编码: ${result.code}, 原因: ${result.msg}` |
52 | | - ); |
53 | | - $notify("签到失败", title, `原因: ${result.msg}`); |
| 48 | + console.log(`签到失败: ${title}, 编码: ${result.code}, 原因: ${result.msg}`) |
| 49 | + $notify('签到失败', title, `原因: ${result.msg}`) |
54 | 50 | } |
55 | 51 | } |
56 | 52 |
|
57 | | -sign(); |
| 53 | +sign() |
0 commit comments