修复bug

This commit is contained in:
lxk0301
2020-12-06 22:34:12 +08:00
parent 7ba6da38dc
commit fae05741b4
2 changed files with 20 additions and 14 deletions

View File

@ -2,7 +2,7 @@
* @Author: lxk0301 https://github.com/lxk0301
* @Date: 2020-11-25 18:19:21
* @Last Modified by: lxk0301
* @Last Modified time: 2020-11-28 09:58:02
* @Last Modified time: 2020-12-06 22:58:02
*/
/*
东东工厂,不是京喜工厂
@ -45,7 +45,7 @@ if ($.isNode()) {
} else {
cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')]);
}
let wantProduct = ``;//心仪商品名称
let wantProduct = `移动电源`;//心仪商品名称
const JD_API_HOST = 'https://api.m.jd.com/client.action';
const inviteCodes = [`P04z54XCjVWnYaS5u2ak7ZCdan1Bdd2GGiWvC6_uERj`, 'P04z54XCjVWnYaS5m9cZ2ariXVJwHf0bgkG7Uo'];
!(async () => {
@ -193,16 +193,21 @@ async function algorithm() {
wantProductSkuId = item.skuId;
}
}
message += `心仪商品数量:${couponCount}\n`;
message += `心仪商品所需电量:${totalScore}\n`;
message += `您当前总电量:${$.batteryValue * 1}\n`;
if (wantProductSkuId && (($.batteryValue * 1) >= (totalScore))) {
console.log(`\n提供的心仪商品${name}目前数量:${couponCount},且当前总电量${$.batteryValue * 1},【满足】兑换此商品所需总电量:${totalScore}`);
console.log(`请去活动页面选择心仪商品并手动投入电量兑换\n`);
$.msg($.name, '', `京东账号${$.index}${$.nickName}\n提供的心仪商品${name}目前数量:${couponCount}\n当前总电量为:${$.batteryValue * 1}\n【满足】兑换此商品所需总电量:${totalScore}\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'});
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}${$.nickName}\n您提供的心仪商品${name}目前数量:${couponCount}\n当前总电量为:${$.batteryValue * 1}\n【满足】兑换此商品所需总电量:${totalScore}\n请去活动页面选择心仪商品并手动投入电量兑换`);
if (totalScore) {
// 库存存在您设置的心仪商品
message += `心仪商品数量:${couponCount}\n`;
message += `心仪商品所需电量:${totalScore}\n`;
message += `当前总电量:${$.batteryValue * 1}\n`;
if (wantProductSkuId && (($.batteryValue * 1) >= (totalScore))) {
console.log(`\n提供的心仪商品${name}目前数量:${couponCount},且当前总电量为:${$.batteryValue * 1}【满足】兑换此商品所需总电量:${totalScore}`);
console.log(`请去活动页面选择心仪商品并手动投入电量兑换\n`);
$.msg($.name, '', `京东账号${$.index}${$.nickName}\n您提供的心仪商品${name}目前数量:${couponCount}\n当前总电量为:${$.batteryValue * 1}\n【满足】兑换此商品所需总电量:${totalScore}\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'});
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}${$.nickName}\n您提供的心仪商品${name}目前数量:${couponCount}\n当前总电量为:${$.batteryValue * 1}\n【满足】兑换此商品所需总电量:${totalScore}\n请去活动页面选择此心仪商品并手动投入电量兑换`);
} else {
console.log(`您心仪商品${name}\n当前数量为:${couponCount}\n兑换所需电量为:${totalScore}\n您当前总电量为:${$.batteryValue * 1}\n不满足兑换心仪商品的条件\n`)
}
} else {
console.log(`您心仪商品${name}\n当前数量为:${couponCount}\n兑换所需电量为:${totalScore}\n您当前总电量为:${$.batteryValue * 1}\n不满足兑换心仪商品的条件\n`)
message += `目前库存:暂无您设置的心仪商品\n`;
}
} else {
console.log(`BoxJs或环境变量暂未提供心仪商品\n如需兑换心仪商品,请提供心仪商品名称\n`);