修复神仙书院不签到的问题

This commit is contained in:
any
2021-01-23 22:49:15 +08:00
parent 6b8375484f
commit cec67f1894

View File

@@ -87,6 +87,7 @@ const inviteCodes = [
.finally(() => { .finally(() => {
$.done(); $.done();
}) })
async function jdNian() { async function jdNian() {
try { try {
$.risk = false $.risk = false
@@ -102,6 +103,7 @@ async function jdNian() {
$.logErr(e) $.logErr(e)
} }
} }
function showMsg() { function showMsg() {
return new Promise(resolve => { return new Promise(resolve => {
message += `本次运行获得${$.earn}金币,当前${$.coin}金币` message += `本次运行获得${$.earn}金币,当前${$.coin}金币`
@@ -113,6 +115,7 @@ function showMsg() {
resolve() resolve()
}) })
} }
async function helpFriends() { async function helpFriends() {
for (let code of $.newShareCodes) { for (let code of $.newShareCodes) {
if (!code) continue if (!code) continue
@@ -120,6 +123,7 @@ async function helpFriends() {
await $.wait(2000) await $.wait(2000)
} }
} }
function doTask(itemToken) { function doTask(itemToken) {
return new Promise((resolve) => { return new Promise((resolve) => {
$.post(taskPostUrl('mcxhd_brandcity_doTask', {itemToken: itemToken}, 'mcxhd_brandcity_doTask'), async (err, resp, data) => { $.post(taskPostUrl('mcxhd_brandcity_doTask', {itemToken: itemToken}, 'mcxhd_brandcity_doTask'), async (err, resp, data) => {
@@ -137,8 +141,7 @@ function doTask(itemToken) {
else { else {
console.log(`任务请求结果未知`) console.log(`任务请求结果未知`)
} }
} } else {
else{
console.log(data.retMessage) console.log(data.retMessage)
} }
} }
@@ -150,6 +153,7 @@ function doTask(itemToken) {
}) })
}) })
} }
function doTask2(taskToken) { function doTask2(taskToken) {
let body = { let body = {
"dataSource": "newshortAward", "dataSource": "newshortAward",
@@ -167,8 +171,7 @@ function doTask2(taskToken) {
data = JSON.parse(data); data = JSON.parse(data);
if (data.code === "0") { if (data.code === "0") {
console.log(data.toast.subTitle) console.log(data.toast.subTitle)
} } else {
else{
console.log(`任务完成失败,错误信息:${JSON.stringify(data)}`) console.log(`任务完成失败,错误信息:${JSON.stringify(data)}`)
} }
} }
@@ -181,6 +184,7 @@ function doTask2(taskToken) {
}) })
}) })
} }
function getHomeData(info = false) { function getHomeData(info = false) {
return new Promise((resolve) => { return new Promise((resolve) => {
$.post(taskPostUrl('mcxhd_brandcity_homePage'), async (err, resp, data) => { $.post(taskPostUrl('mcxhd_brandcity_homePage'), async (err, resp, data) => {
@@ -198,8 +202,7 @@ function getHomeData(info=false) {
console.log(`当前用户金币${userCoinNum}`) console.log(`当前用户金币${userCoinNum}`)
} }
$.coin = userCoinNum $.coin = userCoinNum
} } else {
else{
$.risk = true $.risk = true
console.log(`账号被风控,无法参与活动`) console.log(`账号被风控,无法参与活动`)
message += `账号被风控,无法参与活动\n` message += `账号被风控,无法参与活动\n`
@@ -229,7 +232,7 @@ function getTaskList(body={}) {
if (data.retCode === '200') { if (data.retCode === '200') {
$.tasks = data.result.tasks $.tasks = data.result.tasks
for (let vo of $.tasks) { for (let vo of $.tasks) {
if(vo.taskType==="1" || vo.taskType==="2" || vo.taskType==="5" || vo.taskType==="3") { if (vo.taskType === "13" || vo.taskType === "2" || vo.taskType === "5" || vo.taskType === "3") {
// 签到,逛一逛 // 签到,逛一逛
for (let i = vo.times, j = 0; i < vo.maxTimes && j < vo.subItem.length; ++i, ++j) { for (let i = vo.times, j = 0; i < vo.maxTimes && j < vo.subItem.length; ++i, ++j) {
console.log(`去做${vo.taskName}任务,${i + 1}/${vo.maxTimes}`) console.log(`去做${vo.taskName}任务,${i + 1}/${vo.maxTimes}`)
@@ -271,7 +274,10 @@ function getTaskList(body={}) {
function readShareCode() { function readShareCode() {
console.log(`开始`) console.log(`开始`)
return new Promise(async resolve => { return new Promise(async resolve => {
$.get({url: `http://jd.turinglabs.net/api/v2/jd/immortal/read/${randomCount}/`, 'timeout': 10000}, (err, resp, data) => { $.get({
url: `http://jd.turinglabs.net/api/v2/jd/immortal/read/${randomCount}/`,
'timeout': 10000
}, (err, resp, data) => {
try { try {
if (err) { if (err) {
console.log(`${JSON.stringify(err)}`) console.log(`${JSON.stringify(err)}`)
@@ -292,6 +298,7 @@ function readShareCode() {
resolve() resolve()
}) })
} }
//格式化助力码 //格式化助力码
function shareCodesFormat() { function shareCodesFormat() {
return new Promise(async resolve => { return new Promise(async resolve => {
@@ -304,7 +311,7 @@ function shareCodesFormat() {
const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1); const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
$.newShareCodes = inviteCodes[tempIndex].split('@'); $.newShareCodes = inviteCodes[tempIndex].split('@');
} }
const readShareCodeRes = await readShareCode(); const readShareCodeRes = [] //await readShareCode();
if (readShareCodeRes && readShareCodeRes.code === 200) { if (readShareCodeRes && readShareCodeRes.code === 200) {
$.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])]; $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
} }
@@ -312,6 +319,7 @@ function shareCodesFormat() {
resolve(); resolve();
}) })
} }
function requireConfig() { function requireConfig() {
return new Promise(async resolve => { return new Promise(async resolve => {
console.log(`开始获取${$.name}配置文件\n`); console.log(`开始获取${$.name}配置文件\n`);
@@ -393,6 +401,7 @@ function taskPostUrl(function_id, body = {}, function_id2) {
} }
} }
} }
function taskPostUrl2(function_id, body = {}, function_id2) { function taskPostUrl2(function_id, body = {}, function_id2) {
let url = `${JD_API_HOST}`; let url = `${JD_API_HOST}`;
if (function_id2) { if (function_id2) {
@@ -410,6 +419,7 @@ function taskPostUrl2(function_id, body = {}, function_id2) {
} }
} }
} }
function TotalBean() { function TotalBean() {
return new Promise(async resolve => { return new Promise(async resolve => {
const options = { const options = {
@@ -450,6 +460,7 @@ function TotalBean() {
}) })
}) })
} }
function safeGet(data) { function safeGet(data) {
try { try {
if (typeof JSON.parse(data) == "object") { if (typeof JSON.parse(data) == "object") {
@@ -461,6 +472,7 @@ function safeGet(data) {
return false; return false;
} }
} }
function jsonParse(str) { function jsonParse(str) {
if (typeof str == "string") { if (typeof str == "string") {
try { try {