diff --git a/Loon/lxk0301_LoonTask.conf b/Loon/lxk0301_LoonTask.conf index 05a84a24..f7d7a7ad 100644 --- a/Loon/lxk0301_LoonTask.conf +++ b/Loon/lxk0301_LoonTask.conf @@ -161,7 +161,7 @@ cron "8 0-23/3 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/maste cron "20 7 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_super_box.js,tag=京东超级盒子 # 东东超市 -cron "11 1-23/5 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_superMarket.js,tag=东东超市 +cron "11 * * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_superMarket.js,tag=东东超市 # 赚京豆 cron "10 7 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_syj.js, tag=赚京豆 diff --git a/QuantumultX/lxk0301_gallery.json b/QuantumultX/lxk0301_gallery.json index 1ba90708..f5bf7bfd 100644 --- a/QuantumultX/lxk0301_gallery.json +++ b/QuantumultX/lxk0301_gallery.json @@ -48,7 +48,7 @@ "16 22 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_small_home.js, tag=东东小窝, img-url=https://raw.githubusercontent.com/58xinian/icon/master/ddxw.png, enabled=true", "8 0-23/3 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_speed.js, tag=京东天天加速, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdjs.png, enabled=true", "20 7 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_super_box.js, tag=京东超级盒子, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png, enabled=true", - "11 1-23/5 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_superMarket.js, tag=东东超市, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jxc.png, enabled=true", + "11 * * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_superMarket.js, tag=东东超市, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jxc.png, enabled=true", "10 7 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_syj.js, tag=赚京豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_syj.png, enabled=true", "55 23 * * 6 https://gitee.com/lxk0301/jd_scripts/raw/master/jd_unbind.js, tag=注销京东会员卡, img-url= https://raw.githubusercontent.com/58xinian/icon/master/jd_unbind.png, enabled=true", "55 23 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_unsubscribe.js, tag=取关京东店铺商品, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png, enabled=true", diff --git a/Surge/lxk0301_Task.sgmodule.sgmodule b/Surge/lxk0301_Task.sgmodule.sgmodule index de783315..0bbbf089 100644 --- a/Surge/lxk0301_Task.sgmodule.sgmodule +++ b/Surge/lxk0301_Task.sgmodule.sgmodule @@ -59,7 +59,7 @@ crazyJoy任务 = type=cron,cronexp="10 7 * * *",wake-system=1,timeout=3600,scrip 东东小窝 = type=cron,cronexp="16 22 * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_small_home.js 天天加速 = type=cron,cronexp="8 0-23/3 * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_speed.js 京东超级盒子 = type=cron,cronexp="20 7 * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_super_box.js -东东超市 = type=cron,cronexp="11 1-23/5 * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_superMarket.js +东东超市 = type=cron,cronexp="11 * * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_superMarket.js 赚京豆 = type=cron,cronexp="10 7 * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_syj.js 注销京东会员卡 = type=cron,cronexp="55 23 * * 6",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_unbind.js 取关京东店铺商品 = type=cron,cronexp="55 23 * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_unsubscribe.js diff --git a/index.js b/index.js index 02ee6309..40d28368 100644 --- a/index.js +++ b/index.js @@ -1,24 +1,38 @@ //'use strict'; exports.main_handler = async (event, context, callback) => { try { + const { SCF_SOURCE_TYPE, SCF_SOURCE_URL } = process.env //如果想在一个定时触发器里面执行多个js文件需要在定时触发器的【附加信息】里面填写对应的名称,用 & 链接 //例如我想一个定时触发器里执行jd_speed.js和jd_bean_change.js,在定时触发器的【附加信息】里面就填写 jd_speed&jd_bean_change for (const v of event["Message"].split("&")) { console.log(v); var request = require('request'); - //1.执行自己上传的js文件 - //delete require.cache[require.resolve('./'+v+'.js')]; - //require('./'+v+'.js') - - //2.执行国内gitee远端js文件如果部署,在国内节点,选择1或2的方式 - //request('https://gitee.com/lxk0301/jd_scripts/raw/master/'+v+'.js', function (error, response, body) { - // eval(response.body) - //}) - - //3.执行github远端的js文件(因github的raw类型的文件被墙,此方法云函数不推荐) - request('https://gitee.com/lxk0301/jd_scripts/raw/master/' + v + '.js', function (error, response, body) { - eval(response.body) - }) + switch (SCF_SOURCE_TYPE) { + case 'local': + //1.执行自己上传的js文件 + delete require.cache[require.resolve('./'+v+'.js')]; + require('./'+v+'.js') + break; + case 'git': + //2.执行github远端的js文件(因github的raw类型的文件被墙,此方法云函数不推荐) + request(`https://raw.githubusercontent.com/LXK9301/jd_scripts/master/${v}.js`, function (error, response, body) { + eval(response.body) + }) + break; + case 'custom': + //3.执行自定义远端js文件网址 + if (!SCF_SOURCE_URL) return console.log('自定义模式需要设置SCF_SOURCE_URL变量') + request(`${SCF_SOURCE_URL}${v}.js`, function (error, response, body) { + eval(response.body) + }) + break; + default: + //4.执行国内gitee远端js文件如果部署,在国内节点,选择1或2的方式 + request(`https://gitee.com/lxk0301/jd_scripts/raw/master/${v}.js`, function (error, response, body) { + eval(response.body) + }) + break; + } } } catch (e) { console.error(e) diff --git a/jd_immortal_answer.js b/jd_immortal_answer.js index 3ebde23c..50fea157 100644 --- a/jd_immortal_answer.js +++ b/jd_immortal_answer.js @@ -178,10 +178,8 @@ function getQuestions() { hasFound = true } else { console.log(`在脚本内置题库中 未找到答案,去线上题库寻找~`); - await requireTk(); - ques = $.tk.filter(qo => qo.questionId === vo.questionId); - if (ques.length) { - ques = ques[0] + ques = await getQues(vo.questionId) + if (ques) { let ans = JSON.parse(ques.correct) let opt = vo.options.filter(bo => bo.optionDesc === ans.optionDesc) if (opt.length) { @@ -282,6 +280,30 @@ function submitQues(question) { }) } +function getQues(questionId) { + return new Promise(resolve => { + $.get({ + 'url': `http://qa.turinglabs.net:8081/api/v1/question/${questionId}/`, + 'headers': { + 'Content-Type': 'application/json' + } + }, (err, resp, data) => { + try { + data = JSON.parse(data) + if (data.status === 200) { + resolve(data.data) + } else { + resolve(null) + } + } catch (e) { + console.log(e) + } finally { + resolve() + } + }) + }) +} + function answer(body = {}) { return new Promise((resolve) => { $.get(taskUrl('mcxhd_brandcity_answerQuestion', {"costTime": 1, ...body}), async (err, resp, data) => { @@ -427,24 +449,6 @@ function TotalBean() { }) } -function requireTk() { - return new Promise(resolve => { - $.get({ - url: `http://qn6l5d6wm.hn-bkt.clouddn.com/question.json?t=${new Date().getTime()}`, - headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4371.0 Safari/537.36' - } - }, (err, resp, data) => { - try { - $.tk = JSON.parse(data).RECORDS; - } catch (e) { - console.log(e) - } finally { - resolve() - } - }) - }) -} function safeGet(data) { try { diff --git a/jd_nian_ar.js b/jd_nian_ar.js index 7a752f15..b890a3ff 100644 --- a/jd_nian_ar.js +++ b/jd_nian_ar.js @@ -134,7 +134,7 @@ function getHomeData(info=false) { $.secretp = null return } - console.log(`当前爆竹${$.userInfo.raiseInfo.remainScore}🧨,下一关需要${$.userInfo.raiseInfo.nextLevelScore}🧨`) + console.log(`当前爆竹${$.userInfo.raiseInfo.remainScore}🧨,下一关需要${$.userInfo.raiseInfo.nextLevelScore - $.userInfo.raiseInfo.curLevelStartScore}🧨`) if(info) { message += `当前爆竹${$.userInfo.raiseInfo.remainScore}🧨\n` diff --git a/jd_nian_sign.js b/jd_nian_sign.js index 0c242e68..3578efed 100644 --- a/jd_nian_sign.js +++ b/jd_nian_sign.js @@ -136,7 +136,7 @@ function getHomeData(info=false) { $.secretp = null return } - console.log(`当前爆竹${$.userInfo.raiseInfo.remainScore}🧨,下一关需要${$.userInfo.raiseInfo.nextLevelScore}🧨`) + console.log(`当前爆竹${$.userInfo.raiseInfo.remainScore}🧨,下一关需要${$.userInfo.raiseInfo.nextLevelScore - $.userInfo.raiseInfo.curLevelStartScore}🧨`) } else{ $.secretp = null diff --git a/serverless.yml b/serverless.yml index 81335f58..d9253f30 100644 --- a/serverless.yml +++ b/serverless.yml @@ -40,12 +40,12 @@ inputs: cronExpression: "0 3 */1 * * * *" enable: true argument: jd_joy_feedPets&jd_joy&jd_moneyTree&jd_plantBean&jd_dreamFactory&jd_jdfactory&jd_nianCollect - - timer: #宠汪汪积分兑换奖品 #宠汪汪偷好友积分与狗 #点点券 #东东小窝 #京东直播18豆 #集鞭炮赢京豆 + - timer: #宠汪汪积分兑换奖品 #宠汪汪偷好友积分与狗 #点点券 #东东小窝 #京东直播18豆 parameters: - name: joyreward_joysteal_necklace_smallhome_live_firecrackers + name: joyreward_joysteal_necklace_smallhome_live cronExpression: "0 0 0-16/8,20 * * * *" enable: true - argument: jd_joy_reward&jd_joy_steal&jd_necklace&jd_small_home&jd_live&jd_firecrackers + argument: jd_joy_reward&jd_joy_steal&jd_necklace&jd_small_home&jd_live - timer: #京东全民开红包 #进店领豆 #取关京东店铺商品 #注销京东会员卡 #京东抽奖机 #京东汽车 #京东秒秒币 #小鸽有礼 parameters: name: redPacket_shop_unsubscribe_unbind_lotteryMachine_car_ms_xg