mirror of
https://github.com/hex-ci/smzdm_script.git
synced 2026-11-04 22:55:16 +08:00
Update smzdm_task.js
This commit is contained in:
@@ -132,7 +132,7 @@ class SmzdmTaskBot extends SmzdmBot {
|
|||||||
$.log('等候 3 秒');
|
$.log('等候 3 秒');
|
||||||
await $.wait(3000);
|
await $.wait(3000);
|
||||||
|
|
||||||
for (let i = 0; i < 3; i++) {
|
for (let i = 0; i < Number(task.task_even_num - task.task_finished_num); i++) {
|
||||||
if (user.is_follow == '1') {
|
if (user.is_follow == '1') {
|
||||||
await this.follow({
|
await this.follow({
|
||||||
method: 'destroy',
|
method: 'destroy',
|
||||||
@@ -178,15 +178,15 @@ class SmzdmTaskBot extends SmzdmBot {
|
|||||||
let lanmuId = '';
|
let lanmuId = '';
|
||||||
|
|
||||||
if (task.task_redirect_url.link_val == '0') {
|
if (task.task_redirect_url.link_val == '0') {
|
||||||
const tags = await this.getTags(1);
|
const tag = await this.getTagByRandom();
|
||||||
|
|
||||||
if (!tags[0]) {
|
if (tag === false) {
|
||||||
return {
|
return {
|
||||||
isSuccess: false
|
isSuccess: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
lanmuId = tags[0].lanmu_id;
|
lanmuId = tag.lanmu_id;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lanmuId = task.task_redirect_url.link_val;
|
lanmuId = task.task_redirect_url.link_val;
|
||||||
@@ -712,12 +712,13 @@ class SmzdmTaskBot extends SmzdmBot {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$.log(`获取栏目信息失败!${response}`);
|
$.log(`获取栏目信息失败!${response}`);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取栏目列表
|
// 获取栏目列表
|
||||||
async getTags(num) {
|
async getTagByRandom() {
|
||||||
const { isSuccess, data, response } = await requestApi('https://dingyue-api.smzdm.com/tuijian/search_result', {
|
const { isSuccess, data, response } = await requestApi('https://dingyue-api.smzdm.com/tuijian/search_result', {
|
||||||
headers: this.getHeaders(),
|
headers: this.getHeaders(),
|
||||||
data: {
|
data: {
|
||||||
@@ -729,11 +730,12 @@ class SmzdmTaskBot extends SmzdmBot {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
return data.data.rows.slice(0, num);
|
return data.data.rows[Math.floor(Math.random() * data.data.rows.length)];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$.log(`获取栏目列表失败!${response}`);
|
$.log(`获取栏目列表失败!${response}`);
|
||||||
return [];
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user