Closed worning97 closed 3 years ago
老哥,把代码格式处理下,直接复制出来的各种语法错
老哥,把代码格式处理下,直接复制出来的各种语法错
哦了大兄弟
还是加个pre标签看着舒服呀
var currentCycle = 0; // 请求函数 var request = (functionId, body = {}) => fetch("https://api.m.jd.com/client.action", { body: `functionId=${functionId}&body=${JSON.stringify( body )}&client=wh5&clientVersion=1.0.0`, headers: { "content-type": "application/x-www-form-urlencoded", }, method: "POST", credentials: "include", }); // 循环执行主程序 var excuteMain = () => { let myDate = new Date(); let hour = myDate.getHours(); let minute = myDate.getMinutes(); let boomTimes = [10, 12, 16, 18, 20]; let pergHourIndex = boomTimes.indexOf(hour); let pergHour = pergHourIndex >= 0 ? boomTimes[pergHourIndex] : 0; // 提前1分钟开始抢 一共执行2分钟 if (pergHourIndex >= 0 && (hour == pergHour && minute <= 1) || (hour == (pergHour - 1) && minute >= 59)) { // 战队抢炸弹,感谢 @elevenDimension 提供 functionId request("cakebaker_pk_getCakeBomb"); setTimeout(excuteMain, 100); } else if (hour >= boomTimes[boomTimes.length - 1] && minute > 1) { console.log("本天任务执行结束"); return; } else { console.log("等待 不再时间范围内"); setTimeout(excuteMain, 29000); } }; excuteMain();
不错不错!
还是加个pre标签看着舒服呀
var currentCycle = 0;
// 请求函数 var request = (functionId, body = {}) => fetch("https://api.m.jd.com/client.action", { body:
functionId=${functionId}&body=${JSON.stringify( body )}&client=wh5&clientVersion=1.0.0
, headers: { "content-type": "application/x-www-form-urlencoded", }, method: "POST", credentials: "include", });// 循环执行主程序 var excuteMain = () => { let myDate = new Date(); let hour = myDate.getHours(); let minute = myDate.getMinutes(); let boomTimes = [10, 12, 16, 18, 20]; let pergHourIndex = boomTimes.indexOf(hour); let pergHour = pergHourIndex >= 0 ? boomTimes[pergHourIndex] : 0; // 提前1分钟开始抢 一共执行2分钟 if (pergHourIndex >= 0 && (hour == pergHour && minute <= 1) || (hour == (pergHour - 1) && minute >= 59)) { // 战队抢炸弹,感谢 @elevenDimension 提供 functionId request("cakebaker_pk_getCakeBomb"); setTimeout(excuteMain, 100); } else if (hour >= boomTimes[boomTimes.length - 1] && minute > 1) { console.log("本天任务执行结束"); return; } else { console.log("等待 不再时间范围内"); setTimeout(excuteMain, 29000); } };
excuteMain();
nice
第一 致敬作者~ 写的有点糙,就是个定时器不断触发炸弹的,只需要在页面上run下就可以了
var currentCycle = 0;
// 请求函数 var request = (functionId, body = {}) => fetch("https://api.m.jd.com/client.action", { body: `functionId=${functionId}&body=${JSON.stringify( body )}&client=wh5&clientVersion=1.0.0`, headers: { "content-type": "application/x-www-form-urlencoded", }, method: "POST", credentials: "include", });
// 循环执行主程序 var excuteMain = () => { let myDate = new Date(); let hour = myDate.getHours(); let minute = myDate.getMinutes(); let boomTimes = [10, 12, 16, 18, 20]; let pergHourIndex = boomTimes.indexOf(hour); let pergHour = pergHourIndex >= 0 ? boomTimes[pergHourIndex] : 0; // 提前1分钟开始抢 一共执行2分钟 if(pergHourIndex >= 0 && (hour == pergHour && minute <= 1) || (hour == (pergHour - 1) && minute >= 59)) { // 战队抢炸弹,感谢 @elevenDimension 提供 functionId request("cakebaker_pk_getCakeBomb"); setTimeout(excuteMain, 100); } else if(hour >= boomTimes[boomTimes.length - 1] && minute > 1) { console.log("本天任务执行结束"); return; } else { console.log("等待 不再时间范围内"); setTimeout(excuteMain, 29000); } };
excuteMain();
大神,原脚本挂了,要不你给改改呗?
还是加个pre标签看着舒服呀
var currentCycle = 0;
// 请求函数 var request = (functionId, body = {}) => fetch("https://api.m.jd.com/client.action", { body:
functionId=${functionId}&body=${JSON.stringify( body )}&client=wh5&clientVersion=1.0.0
, headers: { "content-type": "application/x-www-form-urlencoded", }, method: "POST", credentials: "include", });// 循环执行主程序 var excuteMain = () => { let myDate = new Date(); let hour = myDate.getHours(); let minute = myDate.getMinutes(); let boomTimes = [10, 12, 16, 18, 20]; let pergHourIndex = boomTimes.indexOf(hour); let pergHour = pergHourIndex >= 0 ? boomTimes[pergHourIndex] : 0; // 提前1分钟开始抢 一共执行2分钟 if (pergHourIndex >= 0 && (hour == pergHour && minute <= 1) || (hour == (pergHour - 1) && minute >= 59)) { // 战队抢炸弹,感谢 @elevenDimension 提供 functionId request("cakebaker_pk_getCakeBomb"); setTimeout(excuteMain, 100); } else if (hour >= boomTimes[boomTimes.length - 1] && minute > 1) { console.log("本天任务执行结束"); return; } else { console.log("等待 不再时间范围内"); setTimeout(excuteMain, 29000); } };
excuteMain();
大神,原脚本挂了,要不你给改改呗?
@igangx 哪是啥大神。。。 你说的原脚本挂了是说执行完还有没浏览完的吗?
@igangx 哪是啥大神。。。 你说的原脚本挂了是说执行完还有没浏览完的吗?
大部分都不起作用啊,控制台显示success: false……你的不会吗?
哥哥我运行时候显示uncaught syntaxerror:invalid or unexpected token 怎么办
哥哥我运行时候显示uncaught syntaxerror:invalid or unexpected token 怎么办
给个图看下
哥哥我运行时候显示uncaught syntaxerror:invalid or unexpected token 怎么办
给个图看下
今天可以啦哈哈,是运行一次就可以了吗
@igangx 哪是啥大神。。。 你说的原脚本挂了是说执行完还有没浏览完的吗?
大部分都不起作用啊,控制台显示success: false……你的不会吗?
你说了之后咋都是false了,之前好好的。。。
@igangx 哪是啥大神。。。 你说的原脚本挂了是说执行完还有没浏览完的吗?
大部分都不起作用啊,控制台显示success: false……你的不会吗?
你说了之后咋都是false了,之前好好的。。。
哈哈哈哈哈哈哈哈哈哈哈。。。。。我已经自己搞定了
@igangx 哪是啥大神。。。 你说的原脚本挂了是说执行完还有没浏览完的吗?
大部分都不起作用啊,控制台显示success: false……你的不会吗?
你说了之后咋都是false了,之前好好的。。。
哈哈哈哈哈哈哈哈哈哈哈。。。。。我已经自己搞定了
独乐乐不如众乐乐!
@igangx 哪是啥大神。。。 你说的原脚本挂了是说执行完还有没浏览完的吗?
大部分都不起作用啊,控制台显示success: false……你的不会吗?
你说了之后咋都是false了,之前好好的。。。
哈哈哈哈哈哈哈哈哈哈哈。。。。。我已经自己搞定了
独乐乐不如众乐乐!
https://github.com/zarkin404/sweater/issues/27#issuecomment-643756848
哥哥我运行时候显示uncaught syntaxerror:invalid or unexpected token 怎么办
给个图看下
为什么我的好像只有第一次可以成功抢到,后面就不行了?
咦。。。我好像用的旧版,我自己改一改再试试。
@igangx 谢啦。