Update dwnc.js

This commit is contained in:
smallfawn
2023-05-06 12:33:18 +08:00
committed by GitHub
parent cc95381d0d
commit b01bd2009f

137
dwnc.js
View File

@@ -7,7 +7,10 @@
* ========= 青龙--配置文件 =========== * ========= 青龙--配置文件 ===========
* # 得物农场 * # 得物农场
* export dwnc_data='token @ token' * export dwnc_data='token @ token'
* * 一定要改下自己脚本内的自定义参数 自定义变量 在35-42行
* 一定要改下自己脚本内的自定义参数 自定义变量 在35-42行
* 一定要改下自己脚本内的自定义参数 自定义变量 在35-42行
* 不改黑号不负责
* 得物APP => 购物 => 上方推荐 - 免费领好礼 * 得物APP => 购物 => 上方推荐 - 免费领好礼
* 找不到的话去 我 => 星愿森林 进入活动 * 找不到的话去 我 => 星愿森林 进入活动
* 抓app.dewu.com域名下headers参数x-auth-token 多账号 @ 分割 * 抓app.dewu.com域名下headers参数x-auth-token 多账号 @ 分割
@@ -27,19 +30,23 @@ let userCookie = ($.isNode() ? process.env[ckName] : $.getdata(ckName)) || '';
let userList = []; let userList = [];
let userIdx = 0; let userIdx = 0;
let userCount = 0; let userCount = 0;
//---------------------- 自定义变量区域 -----------------------------------
let shareCodeArr = [] let shareCodeArr = []
let ua = 'duapp/5.4.5(android;10)' //---------------------- 自定义变量区域 -----------------------------------
let deviceTrait = 'MI+8+Lite' let ua = ''
let channel = 'xiaomi' let deviceTrait = ''
let channel = ''
let SK = '' let SK = ''
let shumeiId = '' let shumeiId = ''
let uuid = '' let uuid = ''
let deviceId = '' let deviceId = uuid
let UserAgent = 'Mozilla/5.0 (Linux; Android 10; MI 8 Lite Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/81.0.4044.138 Mobile Safari/537.36/duapp/5.4.5(android;10)' let UserAgent = ''
//--------------------------------------------------------- //---------------------------------------------------------
async function start() { async function start() {
console.log('!!!一定要改下自己脚本内的自定义参数 自定义变量 在35-42行,不改黑号不负责!!!');
console.log(`拉完库记得改脚本文件名字 不要把脚本放到[smallfawn_QLScriptPublic]目录下 换其他目录 然后更换命令 因为脚本自动判断是否改了默认参数 每次拉库自动更新`);
if (ua && deviceTrait && channel && SK && shumeiId && uuid && deviceId && UserAgent) {
console.log('\n================== 奖励 ==================\n'); console.log('\n================== 奖励 ==================\n');
taskall = []; taskall = [];
for (let user of userList) { for (let user of userList) {
@@ -49,7 +56,7 @@ async function start() {
} }
await Promise.all(taskall); await Promise.all(taskall);
console.log('\n================== 查询未完成任务 ==================\n'); //console.log('\n================== 查询未完成任务 ==================\n');
taskall = []; taskall = [];
for (let user of userList) { for (let user of userList) {
taskall.push(await user.task_list()); taskall.push(await user.task_list());
@@ -88,6 +95,19 @@ async function start() {
//await wait(1); //延迟 //await wait(1); //延迟
} }
await Promise.all(taskall); await Promise.all(taskall);
console.log('\n------------------- [进度] -------------------\n');
taskall = [];
for (let user of userList) {
await $.wait(3000)
taskall.push(await user.get_tree());
//await wait(1); //延迟
}
await Promise.all(taskall);
} else {
console.log(`未修改脚本默认参数停止执行`)
return
}
@@ -109,10 +129,26 @@ class UserInfo {
Host: 'app.dewu.com', Host: 'app.dewu.com',
'x-auth-token': "Bearer " + this.XAToken, 'x-auth-token': "Bearer " + this.XAToken,
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'ua': ua,
'deviceTrait': deviceTrait,
'channel': channel,
'SK': SK,
'shumeiId': shumeiId,
'uuid': uuid,
'deviceId': deviceId,
'User-Agent': UserAgent
}; };
this.headersGet = { this.headersGet = {
Host: 'app.dewu.com', Host: 'app.dewu.com',
'x-auth-token': "Bearer " + this.XAToken, 'x-auth-token': "Bearer " + this.XAToken,
'ua': ua,
'deviceTrait': deviceTrait,
'channel': channel,
'SK': SK,
'shumeiId': shumeiId,
'uuid': uuid,
'deviceId': deviceId,
'User-Agent': UserAgent
} }
} }
@@ -149,7 +185,7 @@ class UserInfo {
method: 'POST', method: 'POST',
url: 'https://app.dewu.com/hacking-tree/v1/user/init?sign=c921f91a4c0b7ca7f1640adcb16eb239', url: 'https://app.dewu.com/hacking-tree/v1/user/init?sign=c921f91a4c0b7ca7f1640adcb16eb239',
headers: this.headersPost, headers: this.headersPost,
body: JSON.stringify({ keyword: '' }), body: JSON.stringify({ keyword: '🌱😻🙉👶🌷💥' }),
}; };
//console.log(options); //console.log(options);
let result = await httpRequest(options); let result = await httpRequest(options);
@@ -215,7 +251,7 @@ class UserInfo {
async task_false() { // 查看未完成的任务且执行 async task_false() { // 查看未完成的任务且执行
console.log(`账号[${this.index}] 正在尝试完成所有任务`); console.log(`账号[${this.index}] 正在尝试完成所有任务`);
//console.log(this.taskList);
for (let i in this.taskList) { for (let i in this.taskList) {
let isComplete = this.taskList[i].isComplete let isComplete = this.taskList[i].isComplete
let taskId = this.taskList[i].taskId let taskId = this.taskList[i].taskId
@@ -223,11 +259,13 @@ class UserInfo {
let taskType = this.taskList[i].taskType let taskType = this.taskList[i].taskType
let classify = this.taskList[i].classify let classify = this.taskList[i].classify
let jumpUrl = this.taskList[i].jumpUrl let jumpUrl = this.taskList[i].jumpUrl
let rewardCount = this.taskList[i].rewardCount
if (isComplete == false) { if (isComplete == false) {
if (taskType == 49) { if (taskType == 49) {
console.log('签到'); console.log('签到');
await this.task_signIn2() //提交完成任务 commit https://app.dewu.com/hacking-task/v1/task/commit?sign=34c4ac7855b7c592469c9d147483c2ea await this.task_signIn2() //提交完成任务 commit https://app.dewu.com/hacking-task/v1/task/commit?sign=34c4ac7855b7c592469c9d147483c2ea
//post传参taskId 和 taskType {} //post传参taskId 和 taskType {}
await this.task_commit({ taskId: taskId, taskType: taskType.toString() })
} }
let taskIdObject = { let taskIdObject = {
"multi_times": async () => { "multi_times": async () => {
@@ -239,6 +277,9 @@ class UserInfo {
} }
console.log(`时间段领水`); console.log(`时间段领水`);
}, },
'revisit': async () => { //做任务浏览【我】的右上角星愿森林入口 classify 1
//console.log(`特定任务${taskName}`);
},
"1": async () => { //做任务一 完成五次浇灌 classify 1 "1": async () => { //做任务一 完成五次浇灌 classify 1
//console.log(`特定任务${taskName}`); //console.log(`特定任务${taskName}`);
}, },
@@ -264,18 +305,34 @@ class UserInfo {
//console.log(`BTD 数据${btd}`); //console.log(`BTD 数据${btd}`);
let taskTypeIfObject = { let taskTypeIfObject = {
1: async () => { 1: async () => {
if (taskName.indexOf('晒图') !== -1) {
console.log('晒图');
await this.task_commit_pre({ taskId: taskId, taskType: taskType })
await $.wait(16000)
await this.task_commit({ taskId: taskId, taskType: taskType.toString(), activityType: null, activityId: null, taskSetId: null, venueCode: null, venueUnitStyle: null, taskScene: null })
} else if (taskName.indexOf('国潮') !== -1) {
console.log('国潮');
await this.task_commit_pre({ taskId: taskId, taskType: taskType, btd: null })
await $.wait(16000)
await this.task_commit({ taskId: taskId, taskType: taskType.toString(), activityType: null, activityId: null, taskSetId: null, venueCode: null, venueUnitStyle: null, taskScene: null, btd: null })
} else {
console.log('逛逛'); console.log('逛逛');
await this.task_commit_pre(taskId, taskType, btd) await this.task_commit_pre({ taskId: taskId, taskType: taskType, btd: btd })
await $.wait(16000)
await this.task_commit({ taskId: taskId, taskType: taskType.toString(), activityType: null, activityId: null, taskSetId: null, venueCode: null, venueUnitStyle: null, taskScene: null, btd: btd }) await this.task_commit({ taskId: taskId, taskType: taskType.toString(), activityType: null, activityId: null, taskSetId: null, venueCode: null, venueUnitStyle: null, taskScene: null, btd: btd })
}
}, },
16: async () => { 16: async () => {
console.log('参与0元抽奖'); console.log('参与0元抽奖');
await this.task_commit({ taskType: taskType.toString(), taskId: taskId, })
}, },
43: async () => { 43: async () => {
console.log('参与上上签'); console.log('参与上上签');
await this.task_commit({ taskType: taskType.toString(), taskId: taskId })
}, },
47: async () => { 47: async () => {
console.log('订阅'); console.log('订阅');
await this.task_commit({ taskId: taskId, taskType: taskType.toString(), btd: btd })
}, },
50: async () => { 50: async () => {
console.log('收藏'); console.log('收藏');
@@ -283,15 +340,19 @@ class UserInfo {
}, },
123: async () => { 123: async () => {
console.log('从组件访问农场'); console.log('从组件访问农场');
await this.task_commit({ taskType: taskType.toString() })
}, },
251: async () => { //会场水滴大放送 251: async () => { //会场水滴大放送
if (rewardCount !== 10000) {
console.log('会场水滴大放送');
await this.task_obtain(taskId, taskType) await this.task_obtain(taskId, taskType)
console.log(`延迟6s`); //console.log(`延迟6s`);
await $.wait(6000) await $.wait(6000)
await this.task_commit_pre(taskId, taskType, btd) await this.task_commit_pre({ taskId: taskId, taskType: 16 })
console.log(`延迟16s`); //console.log(`延迟16s`);
await $.wait(16000) await $.wait(16000)
await this.task_commit({ taskId: taskId, taskType: taskType.toString() }) await this.task_commit({ taskId: taskId, taskType: taskType.toString() })
}
}, },
} }
if (taskType in taskTypeIfObject) { if (taskType in taskTypeIfObject) {
@@ -324,9 +385,6 @@ class UserInfo {
} }
} }
//await wait(1); //延迟 //await wait(1); //延迟
} }
async task_obtain(taskId, taskType) { // 任务列表前置 OBTAIN async task_obtain(taskId, taskType) { // 任务列表前置 OBTAIN
try { try {
@@ -353,30 +411,26 @@ class UserInfo {
console.log(error); console.log(error);
} }
} }
async task_commit_pre(taskId, taskType, btd) { // 任务 开始 且等待16s TaskType有变化 浏览15s会场会变成16 async task_commit_pre(body) {
// 任务 开始 且等待16s TaskType有变化 浏览15s会场会变成16
try { try {
let options = { let options = {
method: 'POST', method: 'POST',
url: `https://app.dewu.com/hacking-task/v1/task/pre_commit`, url: `https://app.dewu.com/hacking-task/v1/task/pre_commit`,
headers: this.headersPost, headers: this.headersPost,
body: JSON.stringify({ taskId: taskId, taskType: taskType }), body: JSON.stringify(body),
}; };
if (taskType == 1) {
options.body = JSON.stringify({ taskId: taskId, taskType: taskType, btd: btd })
let result = await httpRequest(options); let result = await httpRequest(options);
//console.log(result);
if (result.code == 200) { if (result.code == 200) {
//DoubleLog(`账号[${this.index}] 任务开始${result.msg}${result.data.isOk}`); //DoubleLog(`账号[${this.index}] 任务开始${result.msg}${result.data.isOk}`);
return true return true
} else { } else {
//DoubleLog(`账号[${this.index}] 任务开始失败:原因未知`); //DoubleLog(`账号[${this.index}] 任务开始失败:原因未知`);
console.log(options); //console.log(options);
console.log(result); console.log(result);
return false return false
} }
}
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
@@ -396,10 +450,8 @@ class UserInfo {
return true return true
} else { } else {
//DoubleLog(`账号[${this.index}] 任务结束[${result.msg}]:原因未知`); //DoubleLog(`账号[${this.index}] 任务结束[${result.msg}]:原因未知`);
console.log(options); //console.log(options);
console.log(result); console.log(result);
return false return false
} }
@@ -466,7 +518,11 @@ class UserInfo {
let result = await httpRequest(options); let result = await httpRequest(options);
//console.log(result); //console.log(result);
if (result.code == 200) { if (result.code == 200) {
if('rewardNum' in result.data.wateringReward){
DoubleLog(`账号[${this.index}] 浇水[${result.msg}][${result.data.wateringReward.rewardNum}g]`); DoubleLog(`账号[${this.index}] 浇水[${result.msg}][${result.data.wateringReward.rewardNum}g]`);
}else{
DoubleLog(`账号[${this.index}] 浇水[${result.msg}]`);
}
} else if (result.code == 711110001) { } else if (result.code == 711110001) {
DoubleLog(`账号[${this.index}] 浇水[${result.msg}]`); DoubleLog(`账号[${this.index}] 浇水[${result.msg}]`);
console.log(result); console.log(result);
@@ -493,7 +549,7 @@ class UserInfo {
DoubleLog(`账号[${this.index}] 领取累计浇水奖励[${result.msg}][${result.data.rewardNum}g]`); DoubleLog(`账号[${this.index}] 领取累计浇水奖励[${result.msg}][${result.data.rewardNum}g]`);
} else if (result.code == 711070005) { } else if (result.code == 711070005) {
DoubleLog(`账号[${this.index}] 领取累计浇水奖励[${result.msg}]`); DoubleLog(`账号[${this.index}] 领取累计浇水奖励[${result.msg}]`);
console.log(result); //console.log(result);
} else { } else {
DoubleLog(`账号[${this.index}] 领取累计浇水奖励失败:原因未知`); DoubleLog(`账号[${this.index}] 领取累计浇水奖励失败:原因未知`);
console.log(result); console.log(result);
@@ -665,6 +721,27 @@ class UserInfo {
console.log(error); console.log(error);
} }
} }
async get_tree() { // 农场水滴剩余 和信息
try {
let options = {
method: 'GET',
url: 'https://app.dewu.com/hacking-tree/v1/tree/get_tree_info?sign=fe26befc49444d362c8f17463630bdba',
headers: this.headersGet,
};
//console.log(options);
let result = await httpRequest(options);
//console.log(result);
if (result.code == 200) {
this.ckStatus = true
DoubleLog(`账号[${this.index}] [${result.data.treeId}] 成熟进度[${result.data.userWateringDroplet}/${result.data.currentLeveNeedWateringDroplet}g]`);
} else {
DoubleLog(`账号[${this.index}] 农场信息查询失败:原因未知`);
console.log(result);
}
} catch (error) {
console.log(error);
}
}
} }