diff --git a/jd_speed_sign_Part1.js b/jd_speed_sign_Part1.js index fcd23c9..437b244 100644 --- a/jd_speed_sign_Part1.js +++ b/jd_speed_sign_Part1.js @@ -8,7 +8,7 @@ const notify = $.isNode() ? require('./sendNotify') : ''; //Node.js用户请在jdCookie.js处填写京东ck; const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; - +let llAPIError=false; let cookiesArr = [], cookie = '', message; if ($.isNode()) { Object.keys(jdCookieNode).forEach((item) => { @@ -50,7 +50,7 @@ const JD_API_HOST = 'https://api.m.jd.com/', actCode = 'visa-card-001'; continue } await jdGlobal() - await $.wait(2*1000) + await $.wait(10*1000) } } })() @@ -63,19 +63,20 @@ const JD_API_HOST = 'https://api.m.jd.com/', actCode = 'visa-card-001'; async function jdGlobal() { try { + await richManIndex() await wheelsHome() await apTaskList() await wheelsHome() - await signInit() - await sign() + //await signInit() + //await sign() $.score = 0 $.total = 0 await taskList() await queryJoy() - await signInit() + // await signInit() await cash() await showMsg() } catch (e) { @@ -165,7 +166,7 @@ async function taskList() { if (safeGet(data)) { data = JSON.parse(data); for (let task of data.data) { - $.taskName = task.taskInfo.mainTitle + $.taskName = task.taskInfo.mainTitle; if (task.taskInfo.status === 0) { if (task.taskType >= 1000) { await doTask(task.taskType) @@ -183,6 +184,9 @@ async function taskList() { } else { console.log(`${task.taskInfo.mainTitle}已完成`) } + + if (llAPIError) + break; } } } @@ -205,6 +209,7 @@ async function doTask(taskId) { if (err) { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) + llAPIError=true; } else { if (safeGet(data)) { data = JSON.parse(data); @@ -231,7 +236,7 @@ async function queryJoy() { try { if (err) { console.log(`${JSON.stringify(err)}`) - console.log(`${$.name} API请求失败,请检查网路重试`) + console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (safeGet(data)) { data = JSON.parse(data); @@ -292,6 +297,8 @@ async function queryItem(activeType = 1) { if (err) { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) + $.canStartNewItem = false; + llAPIError=true; } else { if (safeGet(data)) { data = JSON.parse(data); @@ -328,6 +335,8 @@ async function startItem(activeId, activeType) { if (err) { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) + $.canStartNewItem = false; + llAPIError=true; } else { if (safeGet(data)) { data = JSON.parse(data); @@ -338,6 +347,7 @@ async function startItem(activeId, activeType) { videoBrowsing = activeType === 1 ? 5 : 10 console.log(`【${taskCompletionProgress + 1}/${taskCompletionLimit}】浏览商品任务记录成功,等待${videoBrowsing}秒`) await $.wait(videoBrowsing * 1000) + await $.wait(3000); await endItem(data.data.uuid, activeType, activeId, activeType === 3 ? videoBrowsing : "") } else { console.log(`${$.taskName}任务已达上限`) @@ -377,6 +387,7 @@ async function endItem(uuid, activeType, activeId = "", videoTimeLength = "") { if (err) { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) + } else { if (safeGet(data)) { data = JSON.parse(data); diff --git a/jd_speed_sign_Part2.js b/jd_speed_sign_Part2.js index f8ca5fe..4c115c5 100644 --- a/jd_speed_sign_Part2.js +++ b/jd_speed_sign_Part2.js @@ -8,7 +8,7 @@ const notify = $.isNode() ? require('./sendNotify') : ''; //Node.js用户请在jdCookie.js处填写京东ck; const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; - +let llAPIError=false; let cookiesArr = [], cookie = '', message; if ($.isNode()) { Object.keys(jdCookieNode).forEach((item) => { @@ -58,7 +58,7 @@ const JD_API_HOST = 'https://api.m.jd.com/', actCode = 'visa-card-001'; continue } await jdGlobal() - await $.wait(2*1000) + await $.wait(10*1000) } } })() @@ -77,13 +77,13 @@ async function jdGlobal() { await apTaskList() await wheelsHome() - await signInit() - await sign() + //await signInit() + //await sign() $.score = 0 $.total = 0 await taskList() await queryJoy() - await signInit() + //await signInit() await cash() await showMsg() } catch (e) { @@ -173,7 +173,7 @@ async function taskList() { if (safeGet(data)) { data = JSON.parse(data); for (let task of data.data) { - $.taskName = task.taskInfo.mainTitle + $.taskName = task.taskInfo.mainTitle; if (task.taskInfo.status === 0) { if (task.taskType >= 1000) { await doTask(task.taskType) @@ -191,6 +191,8 @@ async function taskList() { } else { console.log(`${task.taskInfo.mainTitle}已完成`) } + if (llAPIError) + break; } } } @@ -213,6 +215,7 @@ async function doTask(taskId) { if (err) { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) + llAPIError=true; } else { if (safeGet(data)) { data = JSON.parse(data); @@ -300,6 +303,8 @@ async function queryItem(activeType = 1) { if (err) { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) + $.canStartNewItem = false; + llAPIError=true; } else { if (safeGet(data)) { data = JSON.parse(data); @@ -336,6 +341,8 @@ async function startItem(activeId, activeType) { if (err) { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) + $.canStartNewItem = false; + llAPIError=true; } else { if (safeGet(data)) { data = JSON.parse(data); @@ -346,6 +353,7 @@ async function startItem(activeId, activeType) { videoBrowsing = activeType === 1 ? 5 : 10 console.log(`【${taskCompletionProgress + 1}/${taskCompletionLimit}】浏览商品任务记录成功,等待${videoBrowsing}秒`) await $.wait(videoBrowsing * 1000) + await $.wait(3000); await endItem(data.data.uuid, activeType, activeId, activeType === 3 ? videoBrowsing : "") } else { console.log(`${$.taskName}任务已达上限`) diff --git a/jd_speed_sign_Part3.js b/jd_speed_sign_Part3.js index 0a3a87f..5d80d47 100644 --- a/jd_speed_sign_Part3.js +++ b/jd_speed_sign_Part3.js @@ -8,7 +8,7 @@ const notify = $.isNode() ? require('./sendNotify') : ''; //Node.js用户请在jdCookie.js处填写京东ck; const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; - +let llAPIError=false; let cookiesArr = [], cookie = '', message; if ($.isNode()) { Object.keys(jdCookieNode).forEach((item) => { @@ -56,7 +56,7 @@ const JD_API_HOST = 'https://api.m.jd.com/', actCode = 'visa-card-001'; continue } await jdGlobal() - await $.wait(2*1000) + await $.wait(10*1000) } } })() @@ -75,13 +75,13 @@ async function jdGlobal() { await apTaskList() await wheelsHome() - await signInit() - await sign() + //await signInit() + //await sign() $.score = 0 $.total = 0 await taskList() await queryJoy() - await signInit() + //await signInit() await cash() await showMsg() } catch (e) { @@ -171,7 +171,7 @@ async function taskList() { if (safeGet(data)) { data = JSON.parse(data); for (let task of data.data) { - $.taskName = task.taskInfo.mainTitle + $.taskName = task.taskInfo.mainTitle; if (task.taskInfo.status === 0) { if (task.taskType >= 1000) { await doTask(task.taskType) @@ -189,6 +189,8 @@ async function taskList() { } else { console.log(`${task.taskInfo.mainTitle}已完成`) } + if (llAPIError) + break; } } } @@ -211,6 +213,7 @@ async function doTask(taskId) { if (err) { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) + llAPIError=true; } else { if (safeGet(data)) { data = JSON.parse(data); @@ -298,6 +301,8 @@ async function queryItem(activeType = 1) { if (err) { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) + $.canStartNewItem = false; + llAPIError=true; } else { if (safeGet(data)) { data = JSON.parse(data); @@ -334,6 +339,8 @@ async function startItem(activeId, activeType) { if (err) { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) + $.canStartNewItem = false; + llAPIError=true; } else { if (safeGet(data)) { data = JSON.parse(data); @@ -344,6 +351,7 @@ async function startItem(activeId, activeType) { videoBrowsing = activeType === 1 ? 5 : 10 console.log(`【${taskCompletionProgress + 1}/${taskCompletionLimit}】浏览商品任务记录成功,等待${videoBrowsing}秒`) await $.wait(videoBrowsing * 1000) + await $.wait(3000); await endItem(data.data.uuid, activeType, activeId, activeType === 3 ? videoBrowsing : "") } else { console.log(`${$.taskName}任务已达上限`)