diff --git a/Loon/lxk0301_LoonTask.conf b/Loon/lxk0301_LoonTask.conf index 82a334a3..751b5868 100644 --- a/Loon/lxk0301_LoonTask.conf +++ b/Loon/lxk0301_LoonTask.conf @@ -107,7 +107,7 @@ cron "10 0,20 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_sc cron "1 7 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nh.js,tag=京东年货节 # 京东炸年兽🧨 -cron "0 9,12,20 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js,tag=京东炸年兽🧨 +cron "0 9,12,20,21 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js,tag=京东炸年兽🧨 # 京东炸年兽领爆竹🧨 cron "50 * * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js,tag=京东收🧨 diff --git a/QuantumultX/lxk0301_gallery.json b/QuantumultX/lxk0301_gallery.json index d0e4bb2c..3009d359 100644 --- a/QuantumultX/lxk0301_gallery.json +++ b/QuantumultX/lxk0301_gallery.json @@ -30,7 +30,7 @@ "3 0-23/2 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_moneyTree.js, tag=京东摇钱树, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdyqs.png, enabled=true", "10 0,20 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_necklace.js, tag=点点券, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png, enabled=true", "1 7 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nh.js, tag=京东年货节, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png, enabled=true", - "0 9,12,20 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, tag=京东炸年兽🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true", + "0 9,12,20,21 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, tag=京东炸年兽🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true", "50 * * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js, tag=京东收🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nianCollect.png, enabled=true", "0 9 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_ar.js, tag=京东炸年兽AR, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true", "30 8 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_sign.js, tag=京东炸年兽签到任务🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true", diff --git a/Surge/lxk0301_Task.sgmodule.sgmodule b/Surge/lxk0301_Task.sgmodule.sgmodule index af1bd196..87467466 100644 --- a/Surge/lxk0301_Task.sgmodule.sgmodule +++ b/Surge/lxk0301_Task.sgmodule.sgmodule @@ -41,7 +41,7 @@ crazyJoy任务 = type=cron,cronexp="10 7 * * *",wake-system=1,timeout=3600,scrip 京东摇钱树 = type=cron,cronexp="3 0-23/2 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_moneyTree.js 点点券 = type=cron,cronexp="10 0,20 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_necklace.js 京东年货节 = type=cron,cronexp="1 7 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nh.js -京东炸年兽🧨 = type=cron,cronexp="0 9,12,20 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js +京东炸年兽🧨 = type=cron,cronexp="0 9,12,20,21 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js 京东收🧨 = type=cron,cronexp="50 * * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js 京东炸年兽AR = type=cron,cronexp="0 9 * * *",wake-system=1,timeout=36000,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_ar.js 京东炸年兽签到任务🧨 = type=cron,cronexp="30 8 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_sign.js diff --git a/jd_joy.js b/jd_joy.js index 08eb0446..e68fc206 100644 --- a/jd_joy.js +++ b/jd_joy.js @@ -2,7 +2,7 @@ jd宠汪汪 搬的https://github.com/uniqueque/QuantumultX/blob/4c1572d93d4d4f883f483f907120a75d925a693e/Script/jd_joy.js 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js IOS用户支持京东双账号,NodeJs用户支持N个京东账号 -更新时间:2021-1-22 +更新时间:2021-1-26 建议先凌晨0点运行jd_joy.js脚本获取狗粮后,再运行此脚本(jd_joy_steal.js)可偷好友积分,6点运行可偷好友狗粮 feedCount:自定义 每次喂养数量; 等级只和喂养次数有关,与数量无关 推荐每次投喂10个,积累狗粮,然后去玩聚宝盆赌 @@ -265,11 +265,11 @@ async function petTask() { } //每日喂狗粮 if (item['taskType'] === 'FeedEveryDay') { - if (item['taskStatus'] === 'processing') { + if (item['receiveStatus'] === 'chance_left') { console.log(`\n${item['taskName']}任务进行中\n`) } else if (item['receiveStatus'] === 'unreceive') { const res = await getFood('FeedEveryDay'); - console.log(`领取每日帮好友喂一次狗粮 狗粮结果:${res.data}`); + console.log(`领取每日喂狗粮 结果:${res.data}`); } } // diff --git a/jd_nian.js b/jd_nian.js index 98b85033..eb5fbb94 100644 --- a/jd_nian.js +++ b/jd_nian.js @@ -9,17 +9,17 @@ ============Quantumultx=============== [task_local] #京东炸年兽🧨 -0 9,12,20 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, tag=京东炸年兽🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true +0 9,12,20,21 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, tag=京东炸年兽🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true ================Loon============== [Script] -cron "0 9,12,20 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js,tag=京东炸年兽🧨 +cron "0 9,12,20,21 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js,tag=京东炸年兽🧨 ===============Surge================= -京东炸年兽🧨 = type=cron,cronexp="0 9,12,20 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js +京东炸年兽🧨 = type=cron,cronexp="0 9,12,20,21 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js ============小火箭========= -京东炸年兽🧨 = type=cron,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, cronexpr="0 9,12,20 * * *", timeout=3600, enable=true +京东炸年兽🧨 = type=cron,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, cronexpr="0 9,12,20,21 * * *", timeout=3600, enable=true */ const $ = new Env('京东炸年兽🧨'); @@ -50,8 +50,8 @@ const inviteCodes = [ `cgxZaDXWZPCmiUa2akPVmFMI27K6antJzucULQPYNim_BPEW1Dwd@cgxZdTXtIrPYuAqfDgSpusxr97nagU6hwFa3TXxnqM95u3ib-xt4nWqZdz8@cgxZdTXtIO-O6QmYDVf67KCEJ19JcybuMB2_hYu8NSNQg0oS2Z_FpMce45g@cgxZdTXtILiLvg7OAASp61meehou4OeZvqbjghsZlc3rI5SBk7b3InUqSQ0@cgxZdTXtIumO4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NWdiLGaPYCeJUfsq18UNi5ln9xEZSPRdOue8Wl3hLRjZBAJLHzBpcl18AeskNYctp-8A' ] !(async () => { await requireConfig(); @@ -107,6 +107,7 @@ async function jdNian() { $.hasGroup = false await pkTaskStealDetail() if ($.hasGroup) await pkInfo() + await helpFriendsPK() } await $.wait(2000) await killCouponList() @@ -118,7 +119,7 @@ async function jdNian() { await $.wait(1000) await doTask() await $.wait(2000) - await helpFriends() + // await helpFriends() await $.wait(2000) await getHomeData(true) await showMsg() @@ -1079,7 +1080,7 @@ function readShareCodePk() { console.log(`开始`) return new Promise(async resolve => { $.get({ - url: `http://jd.turinglabs.net/api/v2/jd/nian_pk/read/${randomCount}/`, + url: `http://jd.turinglabs.net/api/v2/jd/nian/read/${randomCount}/`, 'timeout': 10000 }, (err, resp, data) => { try { @@ -1135,7 +1136,9 @@ function shareCodesFormatPk() { const tempIndex = $.index > pkInviteCodes.length ? (pkInviteCodes.length - 1) : ($.index - 1); $.newShareCodesPk = pkInviteCodes[tempIndex].split('@'); } - const readShareCodeRes = null //await readShareCodePk(); + let readShareCodeRes = null + if (new Date().getUTCHours() >= 12) + readShareCodeRes = await readShareCodePk(); if (readShareCodeRes && readShareCodeRes.code === 200) { $.newShareCodesPk = [...new Set([...$.newShareCodesPk, ...(readShareCodeRes.data || [])])]; } diff --git a/tencentscf.js b/tencentscf.js index ba6a9bab..94680cba 100644 --- a/tencentscf.js +++ b/tencentscf.js @@ -1,8 +1,7 @@ // Depends on tencentcloud-sdk-nodejs version 4.0.3 or higher const tencentcloud = require("tencentcloud-sdk-nodejs"); const fs = require('fs') -const file_buffer = fs.readFileSync('./myfile.zip'); -const contents_in_base64 = file_buffer.toString('base64'); +const yaml = require('js-yaml'); const ScfClient = tencentcloud.scf.v20180416.Client; @@ -18,57 +17,77 @@ const clientConfig = { }, }, }; +const sleep = ms => new Promise(res => setTimeout(res, ms)); +!(async () => { + const client = new ScfClient(clientConfig); -const client = new ScfClient(clientConfig); -let params = { - "Handler": "index.main_handler", - "FunctionName": process.env.TENCENT_FUNCTION_NAME, // 云函数程序名,例如 jd_scripts - "ZipFile": contents_in_base64 -}; -client.UpdateFunctionCode(params).then( - (data) => { - console.log(data); - }, - (err) => { - console.error("error", err); - } -); + let params + await client.ListFunctions({}).then( + async (data) => { + let func = data.Functions.filter(vo=>vo.FunctionName===process.env.TENCENT_FUNCTION_NAME) + const file_buffer = fs.readFileSync('./myfile.zip'); + const contents_in_base64 = file_buffer.toString('base64'); + if(func.length){ + console.log(`函数已存在,去更新函数`) + // 更新代码 + params = { + "Handler": "index.main_handler", + "FunctionName": process.env.TENCENT_FUNCTION_NAME, + "ZipFile": contents_in_base64 + }; + await client.UpdateFunctionCode(params).then( + (data) => { + console.log(data); + }, + (err) => { + console.error("error", err); + } + ); + } else{ + console.log(`函数不存在,去创建函数`) + params = { + "Code": { + "ZipFile": contents_in_base64 + }, + "FunctionName": process.env.TENCENT_FUNCTION_NAME, + "Runtime": "Nodejs12.16" + }; + await client.CreateFunction(params).then( + (data) => { + console.log(data); + }, + (err) => { + console.error("error", err); + } + ); + await sleep(1000*100) // 等待100秒 + } + }, + (err) => { + console.error("error", err); + } + ); -// 更新环境变量 -let vars = [] -for(let key in process.env){ - vars.push({ - "Key": key, - "Value": process.env[key] - }) -} - -params = { - "Environment": { - "Variables": vars + console.log(`更新环境变量`) + // 更新环境变量 + let inputYML = '.github/workflows/deploy_tencent_scf.yml'; + let obj = yaml.load(fs.readFileSync(inputYML, {encoding: 'utf-8'})) + let vars = [] + for(let key in obj.jobs.build.steps[3].env){ + if(key!=='PATH' && process.env.hasOwnProperty(key)) + vars.push({ + "Key": key, + "Value": process.env[key] + }) } -}; -client.UpdateFunctionConfiguration(params).then( - (data) => { - console.log(data); - }, - (err) => { - console.error("error", err); - } -); - -// 更新触发器 -const inputYML = 'serverless.yml'; -const yaml = require('js-yaml'); -const obj = yaml.load(fs.readFileSync(inputYML, {encoding: 'utf-8'})) -for(let vo of obj.inputs.events){ - let param = { - 'Type' : "timer", - 'TriggerDesc' : vo.timer.parameters.cronExpression, - 'CustomArgument' : vo.timer.parameters.argument, - 'Enable' : "true" - } - client.CreateTrigger(param).then( + console.log(`您一共填写了${vars.length}个环境变量`) + params = { + "FunctionName": process.env.TENCENT_FUNCTION_NAME, + "Environment": { + "Variables": vars + } + }; + await client.UpdateFunctionConfiguration(params).then( (data) => { console.log(data); }, @@ -76,4 +95,58 @@ for(let vo of obj.inputs.events){ console.error("error", err); } ); -} + let triggers = [] + params = { + "FunctionName": process.env.TENCENT_FUNCTION_NAME, + } + await client.ListTriggers(params).then( + (data) => { + console.log(data); + triggers = data.Triggers + }, + (err) => { + console.error("error", err); + } + ); + for(let vo of triggers){ + params = { + "FunctionName": process.env.TENCENT_FUNCTION_NAME, + "Type": "timer", + "TriggerName": vo.TriggerName + } + await client.DeleteTrigger(params).then( + (data) => { + console.log(data); + }, + (err) => { + console.error("error", err); + } + ); + } + // 更新触发器 + console.log(`去更新触发器`) + inputYML = 'serverless.yml'; + obj = yaml.load(fs.readFileSync(inputYML, {encoding: 'utf-8'})) + for(let vo of obj.inputs.events){ + let param = { + "FunctionName": process.env.TENCENT_FUNCTION_NAME, + "TriggerName": vo.timer.parameters.name, + 'Type' : "timer", + 'TriggerDesc' : vo.timer.parameters.cronExpression, + 'CustomArgument' : vo.timer.parameters.argument, + 'Enable' : "OPEN", + } + await client.CreateTrigger(param).then( + (data) => { + console.log(data); + }, + (err) => { + console.error("error", err); + } + ); + } + +})() + .catch((e) => console.log(e)) + .finally(async () => { + })