改写兑换京豆逻辑.从高到低的京豆进行兑换.如WO币不够则一直攒着

This commit is contained in:
lxk0301
2020-12-11 14:48:11 +08:00
parent 0a3fdcbe82
commit e3d77e46d3

View File

@@ -2,15 +2,13 @@
* @Author: lxk0301 https://github.com/lxk0301 * @Author: lxk0301 https://github.com/lxk0301
* @Date: 2020-11-12 11:42:12 * @Date: 2020-11-12 11:42:12
* @Last Modified by: lxk0301 * @Last Modified by: lxk0301
* @Last Modified time: 2020-12-11 12:27:20 * @Last Modified time: 2020-12-11 14:27:20
*/ */
/* /*
东东小窝 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js 东东小窝 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js
现有功能: 现有功能:
做日常任务任务每日抽奖有机会活动京豆使用的是免费机会不消耗WO币 做日常任务任务每日抽奖有机会活动京豆使用的是免费机会不消耗WO币
助力好友:一个账号一天只能助力一次(即:每个人助力机会只有一次) 自动使用WO币购买装饰品可以获得京豆分别可获得5,2050,100,200,400,7001200京豆
后期有空优化相互助力功能
TODO装扮领京豆使用WO币购买装饰品可以获得京豆分别可获得5,2050,100,200,400,7001200京豆
注:目前使用此脚本会给脚本内置的两个码进行助力,请知晓 注:目前使用此脚本会给脚本内置的两个码进行助力,请知晓
@@ -263,12 +261,18 @@ function queryFurnituresCenterList() {
$.canBuyList.push(item); $.canBuyList.push(item);
}) })
$.canBuyList.sort(sortByjdBeanNum); $.canBuyList.sort(sortByjdBeanNum);
for (let canBuyItem of $.canBuyList) { if ($.canBuyList[0].needWoB <= $.woB) {
if (canBuyItem.needWoB <= $.woB) { await furnituresCenterPurchase($.canBuyList[0].id, $.canBuyList[0].jdBeanNum);
await furnituresCenterPurchase(canBuyItem.id, canBuyItem.jdBeanNum); } else {
break console.log(`\n兑换${$.canBuyList[0].jdBeanNum}京豆失败:当前wo币${$.woB}不够兑换所需的${$.canBuyList[0].needWoB}WO币`)
} message += `【装饰领京豆】兑换${$.canBuyList[0].jdBeanNum}京豆失败,原因:WO币不够\n`;
} }
// for (let canBuyItem of $.canBuyList) {
// if (canBuyItem.needWoB <= $.woB) {
// await furnituresCenterPurchase(canBuyItem.id, canBuyItem.jdBeanNum);
// break
// }
// }
} }
} }
} }