mirror of
https://github.com/hex-ci/smzdm_script.git
synced 2026-06-16 23:18:09 +08:00
修复分享任务
This commit is contained in:
@@ -276,7 +276,7 @@ class SmzdmTaskBot extends SmzdmBot {
|
|||||||
async doShareTaskMulti(task) {
|
async doShareTaskMulti(task) {
|
||||||
$.log(`开始任务: ${task.task_name}`);
|
$.log(`开始任务: ${task.task_name}`);
|
||||||
|
|
||||||
const articles = await this.getArticleList();
|
const articles = await this.getArticleList(task.task_even_num - task.task_finished_num);
|
||||||
|
|
||||||
for (let i = 0; i < articles.length; i++) {
|
for (let i = 0; i < articles.length; i++) {
|
||||||
$.log(`开始分享第 ${i + 1} 篇文章...`);
|
$.log(`开始分享第 ${i + 1} 篇文章...`);
|
||||||
@@ -286,13 +286,13 @@ class SmzdmTaskBot extends SmzdmBot {
|
|||||||
$.log('等候 5 秒');
|
$.log('等候 5 秒');
|
||||||
await $.wait(3000);
|
await $.wait(3000);
|
||||||
|
|
||||||
await this.shareDailyReward(article.channel_id);
|
await this.shareDailyReward(article.article_channel_id);
|
||||||
await this.shareCallback(article.article_id, article.channel_id);
|
await this.shareCallback(article.article_id, article.article_channel_id);
|
||||||
|
|
||||||
$.log('等候 3 秒');
|
$.log('等候 3 秒');
|
||||||
await $.wait(3000);
|
await $.wait(3000);
|
||||||
|
|
||||||
await this.shareArticleDone(article.article_id, article.channel_id);
|
await this.shareArticleDone(article.article_id, article.article_channel_id);
|
||||||
|
|
||||||
$.log('等候 5 秒');
|
$.log('等候 5 秒');
|
||||||
await $.wait(5000);
|
await $.wait(5000);
|
||||||
@@ -497,13 +497,14 @@ class SmzdmTaskBot extends SmzdmBot {
|
|||||||
|
|
||||||
// 分享完成,可以领取奖励了
|
// 分享完成,可以领取奖励了
|
||||||
async shareArticleDone(articleId, channelId) {
|
async shareArticleDone(articleId, channelId) {
|
||||||
const { isSuccess, response } = await requestApi('https://user-api.smzdm.com/share/article_reward', {
|
const { isSuccess, response } = await requestApi('https://user-api.smzdm.com/share/complete_share_rule', {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: this.getHeaders(),
|
headers: this.getHeaders(),
|
||||||
data: {
|
data: {
|
||||||
token: this.token,
|
token: this.token,
|
||||||
article_id: articleId,
|
article_id: articleId,
|
||||||
channel_id: channelId
|
channel_id: channelId,
|
||||||
|
tag_name: 'shouye'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -533,7 +534,8 @@ class SmzdmTaskBot extends SmzdmBot {
|
|||||||
data: {
|
data: {
|
||||||
token: this.token,
|
token: this.token,
|
||||||
article_id: articleId,
|
article_id: articleId,
|
||||||
channel_id: channelId
|
channel_id: channelId,
|
||||||
|
touchstone_event: '{}'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -595,18 +597,24 @@ class SmzdmTaskBot extends SmzdmBot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取 Web 文章列表
|
// 获取 Web 文章列表
|
||||||
async getArticleList() {
|
async getArticleList(num) {
|
||||||
const { isSuccess, data, response } = await requestApi('https://post.smzdm.com/json_more/?tab_id=tuijian&filterUrl=tuijian', {
|
const { isSuccess, data, response } = await requestApi('https://article-api.smzdm.com/ranking_list/articles', {
|
||||||
sign: false,
|
headers: this.getHeaders(),
|
||||||
headers: {
|
data: {
|
||||||
...this.getHeadersForWeb(),
|
offset: 0,
|
||||||
Referer: 'https://post.smzdm.com/'
|
channel_id: 76,
|
||||||
|
tab: 2,
|
||||||
|
order: 0,
|
||||||
|
limit: 20,
|
||||||
|
exclude_article_ids: '',
|
||||||
|
stream: 'a',
|
||||||
|
ab_code: 'b'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
// 目前只取前两个做任务
|
// 取前 num 个做任务
|
||||||
return data.data.slice(0, 2);
|
return data.data.rows.slice(0, num);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$.log(`获取文章列表失败: ${response}`);
|
$.log(`获取文章列表失败: ${response}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user