mirror of
https://github.com/hex-ci/smzdm_script.git
synced 2026-02-03 02:24:41 +08:00
增加重试机制&小修改
This commit is contained in:
15
bot.js
15
bot.js
@@ -76,7 +76,20 @@ const requestApi = async (url, inputOptions = {}) => {
|
||||
|
||||
const gotOptions = {
|
||||
method: options.method.toUpperCase(),
|
||||
headers: options.headers
|
||||
headers: options.headers,
|
||||
retry: {
|
||||
limit: 2,
|
||||
methods: [
|
||||
'GET',
|
||||
'POST'
|
||||
],
|
||||
statusCodes: [
|
||||
],
|
||||
errorCodes: [
|
||||
'ECONNRESET',
|
||||
'EAI_AGAIN'
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
if (options.method === 'get') {
|
||||
|
||||
@@ -93,7 +93,7 @@ class SmzdmCheckinBot extends SmzdmBot {
|
||||
msg2 = `${data.data.normal_reward.gift.title}: ${data.data.normal_reward.gift.content_str}`;
|
||||
}
|
||||
else {
|
||||
msg2 = `${data.data.normal_reward.gift.content_str}: ${data.data.normal_reward.gift.sub_content}`;
|
||||
msg2 = `${data.data.normal_reward.gift.sub_content}`;
|
||||
}
|
||||
|
||||
$.log(`${msg1}\n${msg2}\n`);
|
||||
|
||||
Reference in New Issue
Block a user