diff --git a/activity/jd_apple_live.js b/activity/jd_apple_live.js index 26022817..e2d04104 100644 --- a/activity/jd_apple_live.js +++ b/activity/jd_apple_live.js @@ -283,7 +283,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/activity/jd_jxstory.js b/activity/jd_jxstory.js index cd46e3ed..45c79941 100644 --- a/activity/jd_jxstory.js +++ b/activity/jd_jxstory.js @@ -498,7 +498,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/activity/jd_pubg.js b/activity/jd_pubg.js index bed15df4..cc22b60c 100644 --- a/activity/jd_pubg.js +++ b/activity/jd_pubg.js @@ -330,7 +330,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_crazy_joy.js b/jd_crazy_joy.js index a87e8711..f1d1f5d9 100644 --- a/jd_crazy_joy.js +++ b/jd_crazy_joy.js @@ -666,7 +666,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_dreamFactory.js b/jd_dreamFactory.js index 11687c97..713a46f9 100644 --- a/jd_dreamFactory.js +++ b/jd_dreamFactory.js @@ -1305,7 +1305,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_fruit.js b/jd_fruit.js index 03185eb1..2cb8ec94 100644 --- a/jd_fruit.js +++ b/jd_fruit.js @@ -1239,7 +1239,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取个${randomCount}码放到您固定的互助码后面`) + console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_health.js b/jd_health.js index ee4ffe9b..b05005d0 100644 --- a/jd_health.js +++ b/jd_health.js @@ -265,7 +265,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_jdfactory.js b/jd_jdfactory.js index b756da1d..546b7109 100644 --- a/jd_jdfactory.js +++ b/jd_jdfactory.js @@ -108,8 +108,8 @@ function showMsg() { } else { $.log(`京东账号${$.index}${$.nickName}\n${message}`); } - if (new Date().getHours() === 23) { - $.msg($.name, '', `京东账号${$.index}${$.nickName}\n${message}`); + if (new Date().getHours() === 12) { + $.msg($.name, '', `${message}`); } resolve() }) @@ -181,6 +181,7 @@ async function algorithm() { } } else { console.log(`\n此账号${$.index}${$.nickName}暂未选择商品\n`); + message += `京东账号${$.index} ${$.nickName}\n`; message += `已选商品:暂无\n`; message += `心仪商品:${wantProduct ? wantProduct : '暂无'}\n`; if (wantProduct) { @@ -216,17 +217,17 @@ async function algorithm() { } else { console.log(`BoxJs或环境变量暂未提供心仪商品\n如需兑换心仪商品,请提供心仪商品名称\n`); await jdfactory_getProductList(true); - message += `当前剩余最多商品:${$.canMakeList[0].name}\n`; - message += `兑换所需电量:${$.canMakeList[0].fullScore}\n`; + message += `当前剩余最多商品:${$.canMakeList[0] && $.canMakeList[0].name}\n`; + message += `兑换所需电量:${$.canMakeList[0] && $.canMakeList[0].fullScore}\n`; message += `您当前总电量:${$.batteryValue * 1}\n`; - if ($.canMakeList[0].couponCount > 0 && $.batteryValue * 1 >= $.canMakeList[0].fullScore) { + if ($.canMakeList[0] && $.canMakeList[0].couponCount > 0 && $.batteryValue * 1 >= $.canMakeList[0] && $.canMakeList[0].fullScore) { let nowTimes = new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000); if (new Date(nowTimes).getHours() === 12) { - $.msg($.name, '', `京东账号${$.index}${$.nickName}\n${message}【满足】兑换${$.canMakeList[0].name}所需总电量:${$.canMakeList[0].fullScore}\n请点击弹窗直达活动页面\n选择此心仪商品并手动投入电量兑换`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2uSsV2wHEkySvompfjB43nuKkcHp/index.html%22%20%7D'}); - if ($.isNode()) await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】${$.nickName}\n${message}【满足】兑换${$.canMakeList[0].name}所需总电量:${$.canMakeList[0].fullScore}\n请速去活动页面查看`); + $.msg($.name, '', `京东账号${$.index}${$.nickName}\n${message}【满足】兑换${$.canMakeList[0] && $.canMakeList[0] && [0].name}所需总电量:${$.canMakeList[0] && $.canMakeList[0].fullScore}\n请点击弹窗直达活动页面\n选择此心仪商品并手动投入电量兑换`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2uSsV2wHEkySvompfjB43nuKkcHp/index.html%22%20%7D'}); + if ($.isNode()) await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】${$.nickName}\n${message}【满足】兑换${$.canMakeList[0] && $.canMakeList[0].name}所需总电量:${$.canMakeList[0].fullScore}\n请速去活动页面查看`); } } else { - console.log(`\n目前电量${$.batteryValue * 1},不满足兑换 ${$.canMakeList[0].name}所需的 ${$.canMakeList[0].fullScore}电量\n`) + console.log(`\n目前电量${$.batteryValue * 1},不满足兑换 ${$.canMakeList[0] && $.canMakeList[0].name}所需的 ${$.canMakeList[0] && $.canMakeList[0].fullScore}电量\n`) } } } @@ -535,17 +536,20 @@ function jdfactory_getProductList(flag = false) { if (safeGet(data)) { data = JSON.parse(data); if (data.data.bizCode === 0) { + $.canMakeList = []; $.canMakeList = data.data.result.canMakeList;//当前可选商品列表 sellOut:1为已抢光,0为目前可选择 - $.canMakeList.sort(sortCouponCount); - console.log(`商品名称 可选状态 剩余量`) - for (let item of $.canMakeList) { - console.log(`${item.name.slice(-4)} ${item.sellOut === 1 ? '已抢光':'可 选'} ${item.couponCount}`); - } - if (!flag) { + if ($.canMakeList && $.canMakeList.length > 0) { + $.canMakeList.sort(sortCouponCount); + console.log(`商品名称 可选状态 剩余量`) for (let item of $.canMakeList) { - if (item.name.indexOf(wantProduct) > -1 && item.couponCount > 0 && item.sellOut === 0) { - await jdfactory_makeProduct(item.skuId); - break + console.log(`${item.name.slice(-4)} ${item.sellOut === 1 ? '已抢光':'可 选'} ${item.couponCount}`); + } + if (!flag) { + for (let item of $.canMakeList) { + if (item.name.indexOf(wantProduct) > -1 && item.couponCount > 0 && item.sellOut === 0) { + await jdfactory_makeProduct(item.skuId); + break + } } } } @@ -624,7 +628,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_jdzz.js b/jd_jdzz.js index f5da3632..5ea61aa2 100644 --- a/jd_jdzz.js +++ b/jd_jdzz.js @@ -343,7 +343,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取${randomCount}个码放到您固定的互助码后面`) + console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_pet.js b/jd_pet.js index 9b19c20f..cde3fd7f 100644 --- a/jd_pet.js +++ b/jd_pet.js @@ -442,7 +442,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取个${randomCount}码放到您固定的互助码后面`) + console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } } diff --git a/jd_plantBean.js b/jd_plantBean.js index 8fbe3d0f..c573903e 100644 --- a/jd_plantBean.js +++ b/jd_plantBean.js @@ -521,7 +521,7 @@ function readShareCode() { console.log(`${$.name} API请求失败,请检查网路重试`) } else { if (data) { - console.log(`随机取个${randomCount}码放到您固定的互助码后面`) + console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`) data = JSON.parse(data); } }