forked from Wenmoux/checkbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhuashi6.js
73 lines (70 loc) · 2.87 KB
/
huashi6.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const axios = require("axios")
const url1 = "https://rt.huashi6.com"
const url2 = "https://app.huashi6.com/app"
function get(url, method = "get", data = null) {
return new Promise(async (resolve) => {
try {
let headers = { "cookie": config.huashi6.cookie }
if (method == "get") res = await axios.get(url, {
headers
});
headers ["content-type"] = "application/json;charset=utf-8"
if (method == "post") res = await axios.post(url, data, {
headers
});
resolve(res.data)
} catch (err) {
console.log(err);
resolve({msg:"签到接口请求出错"})
}
resolve();
});
}
async function task() {
let taskres = await get(`${url1}/front/growthTask/user/list`, "post")
if (taskres.success) {
taskList = ((taskres && taskres.data && taskres.data.daily) ?? []).filter(x => !x.finish)
if (taskList) {
for (t of taskList) {
console.log("去做任务:"+t.name)
if (t.id == 4) await get(`${url2}/growthTask/share`, "post") //分享
else if (t.id == 23) { //点赞
await get(`${url2}/like/like`, "post", {
"like": false,
"requestId": "",
"objectId": 638,
"objectType": 80
})
await get(`${url2}/like/like`, "post", {
"like": true,
"requestId": "",
"objectId": 638,
"objectType": 80
})
} else if (t.id == 9) {await get(`${url2}/comment/add`,"post", {
"resourceId": 955042,
"requestId": "",
"content": "🤤🤤",
"resourceType": 1
})} else if (t.id == 19){await get(`${url2}/user/currentUser`,"post", {
"requestId": ""
}) }//评论
}
}
console.log("\n\n")
//签到
let signres = await get(`${url1}/app/user/signin`, "post")
signInfo =""
if (signres.success) signInfo=`签到:连签${signres.data.continueCount}天\n`
//查询
let [coinInfo,levelInfo] = await Promise.all([
get(`${url2}/user/coinAccount`, "post",{"requestId":""}),
get(`${url2}/user/levelInfo`,"post", {"requestId":""})
]);
let coin = coinInfo&&coinInfo.data&&coinInfo.data.currentCoinCount
let level = levelInfo.data.levelInfo.fullLevelName
msg = signInfo+ "cc币:"+coin+"\n"+"等级:"+level+"\n"+ `升级进度:${levelInfo.data.currentExp}/${levelInfo.data.nextLevelExp}`
} else msg = taskres.msg
return "【触站】:\n"+msg
}
module.exports = task