update
This commit is contained in:
@@ -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 "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=京东收🧨
|
cron "50 * * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js,tag=京东收🧨
|
||||||
|
@@ -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",
|
"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",
|
"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",
|
"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",
|
"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",
|
"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",
|
"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",
|
||||||
|
@@ -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="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="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="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
|
京东收🧨 = 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
|
京东炸年兽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
|
京东炸年兽签到任务🧨 = type=cron,cronexp="30 8 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_sign.js
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
jd宠汪汪 搬的https://github.com/uniqueque/QuantumultX/blob/4c1572d93d4d4f883f483f907120a75d925a693e/Script/jd_joy.js
|
jd宠汪汪 搬的https://github.com/uniqueque/QuantumultX/blob/4c1572d93d4d4f883f483f907120a75d925a693e/Script/jd_joy.js
|
||||||
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
|
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
|
||||||
IOS用户支持京东双账号,NodeJs用户支持N个京东账号
|
IOS用户支持京东双账号,NodeJs用户支持N个京东账号
|
||||||
更新时间:2021-1-22
|
更新时间:2021-1-26
|
||||||
建议先凌晨0点运行jd_joy.js脚本获取狗粮后,再运行此脚本(jd_joy_steal.js)可偷好友积分,6点运行可偷好友狗粮
|
建议先凌晨0点运行jd_joy.js脚本获取狗粮后,再运行此脚本(jd_joy_steal.js)可偷好友积分,6点运行可偷好友狗粮
|
||||||
feedCount:自定义 每次喂养数量; 等级只和喂养次数有关,与数量无关
|
feedCount:自定义 每次喂养数量; 等级只和喂养次数有关,与数量无关
|
||||||
推荐每次投喂10个,积累狗粮,然后去玩聚宝盆赌
|
推荐每次投喂10个,积累狗粮,然后去玩聚宝盆赌
|
||||||
@@ -265,11 +265,11 @@ async function petTask() {
|
|||||||
}
|
}
|
||||||
//每日喂狗粮
|
//每日喂狗粮
|
||||||
if (item['taskType'] === 'FeedEveryDay') {
|
if (item['taskType'] === 'FeedEveryDay') {
|
||||||
if (item['taskStatus'] === 'processing') {
|
if (item['receiveStatus'] === 'chance_left') {
|
||||||
console.log(`\n${item['taskName']}任务进行中\n`)
|
console.log(`\n${item['taskName']}任务进行中\n`)
|
||||||
} else if (item['receiveStatus'] === 'unreceive') {
|
} else if (item['receiveStatus'] === 'unreceive') {
|
||||||
const res = await getFood('FeedEveryDay');
|
const res = await getFood('FeedEveryDay');
|
||||||
console.log(`领取每日帮好友喂一次狗粮 狗粮结果:${res.data}`);
|
console.log(`领取每日喂狗粮 结果:${res.data}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
21
jd_nian.js
21
jd_nian.js
@@ -9,17 +9,17 @@
|
|||||||
============Quantumultx===============
|
============Quantumultx===============
|
||||||
[task_local]
|
[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==============
|
================Loon==============
|
||||||
[Script]
|
[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=================
|
===============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('京东炸年兽🧨');
|
const $ = new Env('京东炸年兽🧨');
|
||||||
|
|
||||||
@@ -50,8 +50,8 @@ const inviteCodes = [
|
|||||||
`cgxZaDXWZPCmiUa2akPVmFMI27K6antJzucULQPYNim_BPEW1Dwd@cgxZdTXtIrPYuAqfDgSpusxr97nagU6hwFa3TXxnqM95u3ib-xt4nWqZdz8@cgxZdTXtIO-O6QmYDVf67KCEJ19JcybuMB2_hYu8NSNQg0oS2Z_FpMce45g@cgxZdTXtILiLvg7OAASp61meehou4OeZvqbjghsZlc3rI5SBk7b3InUqSQ0@cgxZdTXtIumO4w2cDgSqvYcqHwjaAzLxu0S371Dh_fctFJtN0tXYzdR7JaY`
|
`cgxZaDXWZPCmiUa2akPVmFMI27K6antJzucULQPYNim_BPEW1Dwd@cgxZdTXtIrPYuAqfDgSpusxr97nagU6hwFa3TXxnqM95u3ib-xt4nWqZdz8@cgxZdTXtIO-O6QmYDVf67KCEJ19JcybuMB2_hYu8NSNQg0oS2Z_FpMce45g@cgxZdTXtILiLvg7OAASp61meehou4OeZvqbjghsZlc3rI5SBk7b3InUqSQ0@cgxZdTXtIumO4w2cDgSqvYcqHwjaAzLxu0S371Dh_fctFJtN0tXYzdR7JaY`
|
||||||
];
|
];
|
||||||
const pkInviteCodes = [
|
const pkInviteCodes = [
|
||||||
'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEdw@IgNWdiLGaPaZskfACQyhgLSpZWps-WtQEW3McifW@IgNWdiLGaPYCeJUfsq18UNi5ln9xEZSPRdOue8Wl3hJTS2SQzU0vulL0fHeULJaIfgqHFd7f_Kg',
|
'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEd0@IgNWdiLGaPaZskfACQyhgLSpZWps-WtQEW3McifX@IgNWdiLGaPaAvmHPAQf769XqjJjMyRirPzN9-AS-WHY9Y_G7t9Cwe5gdiI2qEvHb@IgNWdiLGaPYCeJUfsq18UNi5ln9xEZSPRdOue8Wl3hJTS2SQzU0vulL0fHeULJaIfgqHFd7f_Kk@IgNWdiLGaPYCeJUfsq18UNi5ln9xEZSPRdOue8Wl3hLRjZBAJLHzBpcl18AeskNYctp-8A',
|
||||||
'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEdw@IgNWdiLGaPaAvmHPAQf769XqjJjMyRirPzN9-AS-WHY9Y_G7t9Cwe5gdiI2qEvHa@IgNWdiLGaPYCeJUfsq18UNi5ln9xEZSPRdOue8Wl3hLRjZBAJLHzBpcl18AeskNYctp-8Q@IgNWdiLGaPYCeJUfsq18UNi5ln9xEZSPRdOue8Wl3hLRjZBCduDyApZxg5BPuhRfnJvQvQ'
|
'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEd0@IgNWdiLGaPaZskfACQyhgLSpZWps-WtQEW3McifX@IgNWdiLGaPaAvmHPAQf769XqjJjMyRirPzN9-AS-WHY9Y_G7t9Cwe5gdiI2qEvHb@IgNWdiLGaPYCeJUfsq18UNi5ln9xEZSPRdOue8Wl3hJTS2SQzU0vulL0fHeULJaIfgqHFd7f_Kk@IgNWdiLGaPYCeJUfsq18UNi5ln9xEZSPRdOue8Wl3hLRjZBAJLHzBpcl18AeskNYctp-8A'
|
||||||
]
|
]
|
||||||
!(async () => {
|
!(async () => {
|
||||||
await requireConfig();
|
await requireConfig();
|
||||||
@@ -107,6 +107,7 @@ async function jdNian() {
|
|||||||
$.hasGroup = false
|
$.hasGroup = false
|
||||||
await pkTaskStealDetail()
|
await pkTaskStealDetail()
|
||||||
if ($.hasGroup) await pkInfo()
|
if ($.hasGroup) await pkInfo()
|
||||||
|
await helpFriendsPK()
|
||||||
}
|
}
|
||||||
await $.wait(2000)
|
await $.wait(2000)
|
||||||
await killCouponList()
|
await killCouponList()
|
||||||
@@ -118,7 +119,7 @@ async function jdNian() {
|
|||||||
await $.wait(1000)
|
await $.wait(1000)
|
||||||
await doTask()
|
await doTask()
|
||||||
await $.wait(2000)
|
await $.wait(2000)
|
||||||
await helpFriends()
|
// await helpFriends()
|
||||||
await $.wait(2000)
|
await $.wait(2000)
|
||||||
await getHomeData(true)
|
await getHomeData(true)
|
||||||
await showMsg()
|
await showMsg()
|
||||||
@@ -1079,7 +1080,7 @@ function readShareCodePk() {
|
|||||||
console.log(`开始`)
|
console.log(`开始`)
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
$.get({
|
$.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
|
'timeout': 10000
|
||||||
}, (err, resp, data) => {
|
}, (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
@@ -1135,7 +1136,9 @@ function shareCodesFormatPk() {
|
|||||||
const tempIndex = $.index > pkInviteCodes.length ? (pkInviteCodes.length - 1) : ($.index - 1);
|
const tempIndex = $.index > pkInviteCodes.length ? (pkInviteCodes.length - 1) : ($.index - 1);
|
||||||
$.newShareCodesPk = pkInviteCodes[tempIndex].split('@');
|
$.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) {
|
if (readShareCodeRes && readShareCodeRes.code === 200) {
|
||||||
$.newShareCodesPk = [...new Set([...$.newShareCodesPk, ...(readShareCodeRes.data || [])])];
|
$.newShareCodesPk = [...new Set([...$.newShareCodesPk, ...(readShareCodeRes.data || [])])];
|
||||||
}
|
}
|
||||||
|
175
tencentscf.js
175
tencentscf.js
@@ -1,8 +1,7 @@
|
|||||||
// Depends on tencentcloud-sdk-nodejs version 4.0.3 or higher
|
// Depends on tencentcloud-sdk-nodejs version 4.0.3 or higher
|
||||||
const tencentcloud = require("tencentcloud-sdk-nodejs");
|
const tencentcloud = require("tencentcloud-sdk-nodejs");
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const file_buffer = fs.readFileSync('./myfile.zip');
|
const yaml = require('js-yaml');
|
||||||
const contents_in_base64 = file_buffer.toString('base64');
|
|
||||||
|
|
||||||
const ScfClient = tencentcloud.scf.v20180416.Client;
|
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
|
||||||
let params = {
|
await client.ListFunctions({}).then(
|
||||||
"Handler": "index.main_handler",
|
async (data) => {
|
||||||
"FunctionName": process.env.TENCENT_FUNCTION_NAME, // 云函数程序名,例如 jd_scripts
|
let func = data.Functions.filter(vo=>vo.FunctionName===process.env.TENCENT_FUNCTION_NAME)
|
||||||
"ZipFile": contents_in_base64
|
const file_buffer = fs.readFileSync('./myfile.zip');
|
||||||
};
|
const contents_in_base64 = file_buffer.toString('base64');
|
||||||
client.UpdateFunctionCode(params).then(
|
if(func.length){
|
||||||
(data) => {
|
console.log(`函数已存在,去更新函数`)
|
||||||
console.log(data);
|
// 更新代码
|
||||||
},
|
params = {
|
||||||
(err) => {
|
"Handler": "index.main_handler",
|
||||||
console.error("error", err);
|
"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);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// 更新环境变量
|
console.log(`更新环境变量`)
|
||||||
let vars = []
|
// 更新环境变量
|
||||||
for(let key in process.env){
|
let inputYML = '.github/workflows/deploy_tencent_scf.yml';
|
||||||
vars.push({
|
let obj = yaml.load(fs.readFileSync(inputYML, {encoding: 'utf-8'}))
|
||||||
"Key": key,
|
let vars = []
|
||||||
"Value": process.env[key]
|
for(let key in obj.jobs.build.steps[3].env){
|
||||||
})
|
if(key!=='PATH' && process.env.hasOwnProperty(key))
|
||||||
}
|
vars.push({
|
||||||
|
"Key": key,
|
||||||
params = {
|
"Value": process.env[key]
|
||||||
"Environment": {
|
})
|
||||||
"Variables": vars
|
|
||||||
}
|
}
|
||||||
};
|
console.log(`您一共填写了${vars.length}个环境变量`)
|
||||||
client.UpdateFunctionConfiguration(params).then(
|
params = {
|
||||||
(data) => {
|
"FunctionName": process.env.TENCENT_FUNCTION_NAME,
|
||||||
console.log(data);
|
"Environment": {
|
||||||
},
|
"Variables": vars
|
||||||
(err) => {
|
}
|
||||||
console.error("error", err);
|
};
|
||||||
}
|
await client.UpdateFunctionConfiguration(params).then(
|
||||||
);
|
|
||||||
|
|
||||||
// 更新触发器
|
|
||||||
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(
|
|
||||||
(data) => {
|
(data) => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
},
|
},
|
||||||
@@ -76,4 +95,58 @@ for(let vo of obj.inputs.events){
|
|||||||
console.error("error", err);
|
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 () => {
|
||||||
|
})
|
||||||
|
Reference in New Issue
Block a user