重构代码

This commit is contained in:
Hex
2023-11-20 10:44:24 +08:00
parent 5118f27fa1
commit ac413bd398
5 changed files with 1518 additions and 1508 deletions

View File

@@ -26,7 +26,7 @@
### 青龙拉库
```bash
ql repo https://github.com/hex-ci/smzdm_script.git "" "env.js|bot.js|sendNotify.js" "env.js|bot.js|sendNotify.js"
ql repo https://github.com/hex-ci/smzdm_script.git "smzdm_" "" "env.js|bot.js|sendNotify.js|library_" "main"
```
建议自行更改青龙面板的脚本执行时间

1447
library_task.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
"description": "smzdm 自用脚本 for 青龙面板,支持 App 端签到、转盘抽奖、每日任务等功能",
"main": "smzdm_checkin.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"lint": "eslint --cache --max-warnings 0 \"./*.{js,ts}\" --ignore-path .gitignore"
},
"repository": {
"type": "git",

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@ cron: 20 15 * * *
const Env = require('./env');
const { requestApi, getEnvCookies, wait } = require('./bot');
const notify = require('./sendNotify');
const { SmzdmTaskBot } = require('./smzdm_task');
const { SmzdmTaskBot } = require('./library_task');
// ------------------------------------
@@ -16,7 +16,7 @@ const $ = new Env('smzdm 全民众测能量值任务');
class SmzdmTestingTaskBot extends SmzdmTaskBot {
constructor(cookie) {
super(cookie);
super(cookie, $);
}
// 主函数
@@ -54,12 +54,12 @@ class SmzdmTestingTaskBot extends SmzdmTaskBot {
const { isSuccess, data, response } = await requestApi('https://zhiyou.m.smzdm.com/task/task/ajax_get_activity_id', {
method: 'get',
data: {
'from': 'zhongce',
'from': 'zhongce'
},
headers: {
...this.getHeadersForWeb(),
Origin: 'https://test.m.smzdm.com',
Referer: 'https://test.m.smzdm.com/',
Referer: 'https://test.m.smzdm.com/'
}
});
@@ -80,9 +80,9 @@ class SmzdmTestingTaskBot extends SmzdmTaskBot {
const { isSuccess, data, response } = await requestApi('https://zhiyou.m.smzdm.com/task/task/ajax_get_activity_info', {
method: 'get',
data: {
'activity_id': id,
'activity_id': id
},
headers: this.getHeadersForWeb(),
headers: this.getHeadersForWeb()
});
if (isSuccess) {
@@ -101,11 +101,11 @@ class SmzdmTestingTaskBot extends SmzdmTaskBot {
const { isSuccess, data, response } = await requestApi('https://test.m.smzdm.com/win_coupon/user_data', {
method: 'get',
headers: this.getHeadersForWeb(),
headers: this.getHeadersForWeb()
});
if (isSuccess) {
let msg = `当前拥有必中券: ${data.data.my_energy.my_energy_total}\n必中券过期时间: ${data.data.my_energy.energy_expired_time}`;
const msg = `当前拥有必中券: ${data.data.my_energy.my_energy_total}\n必中券过期时间: ${data.data.my_energy.energy_expired_time}`;
$.log(msg);
@@ -123,9 +123,9 @@ class SmzdmTestingTaskBot extends SmzdmTaskBot {
const { isSuccess, response } = await requestApi('https://zhiyou.m.smzdm.com/task/task/ajax_activity_task_receive', {
method: 'post',
data: {
'task_id': taskId,
'task_id': taskId
},
headers: this.getHeadersForWeb(),
headers: this.getHeadersForWeb()
});
if (isSuccess) {
@@ -133,7 +133,7 @@ class SmzdmTestingTaskBot extends SmzdmTaskBot {
return {
isSuccess,
msg: '',
msg: ''
};
}
else {
@@ -141,7 +141,7 @@ class SmzdmTestingTaskBot extends SmzdmTaskBot {
return {
isSuccess,
msg: '领取任务奖励失败!',
msg: '领取任务奖励失败!'
};
}
}