Merge pull request #240 from DoveBoy/patch-1

更新云函数教程
This commit is contained in:
LXK9301
2021-01-25 16:26:31 +08:00
committed by GitHub
5 changed files with 23 additions and 13 deletions

View File

@@ -166,3 +166,5 @@ jobs:
SERVERLESS_PLATFORM_VENDOR: tencent
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }}
TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }}
TENCENT_REGION: ${{ secrets.SCF_REGION }}
TENCENT_FUNCTION_NAME: ${{ secrets.TENCENT_FUNCTION_NAME }}

View File

@@ -1,5 +1,5 @@
# 云函数快速部署京东脚本
# 云函数快速部署京东脚本(由于云函数官方升级此方法暂时失效)
>
> - 本地安装依赖使用serverless部署[点这里](tencentscf.md#1-安装-nodejs-环境)
> - Github Action 部署[点这里](tencentscf.md#github-action-部署)
@@ -109,6 +109,9 @@ triggers:
> 将SecretId和SecretKey分别配置在仓库的secrets变量里面 TENCENT_SECRET_ID对应你的SecretId的值TENCENT_SECRET_KEY对应你的SecretKey的值
## 3. 配置自己需要secrets变量[参考这里](githubAction.md#下方提供使用到的-secrets全集合)
目前因为云函数改版升级原GitHub Action部署云函数方案需要作出相应调整secret变量新增`SCF_REGION``TENCENT_FUNCTION_NAME``SCF_REGION`用于控制部署区域的选择,具体参数代码填写可以自行查找官方说明 [地域和可用区](https://cloud.tencent.com/document/product/213/6091) `TENCENT_FUNCTION_NAME`用于控制部署到云函数后函数名的命名。<br>
### __重要的说三遍__
### 如果涉及一个变量配置多个值如多个cookie多个取消订阅关键字去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接
### 如果涉及一个变量配置多个值如多个cookie多个取消订阅关键字去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接
@@ -118,6 +121,9 @@ triggers:
## 4.执行action workflow进行部署workflow未报错即部署成功
**在执行action workflow进行部署前先在需要部署的区域下新建一个空函数名称可以任意比如`jd`此时secret中`TENCENT_FUNCTION_NAME`值也必须是`jd`,保持与云函数的函数名一致,目前部署云函数的策略是覆盖的方式,故而此步骤至关重要。**<br>
![image](https://user-images.githubusercontent.com/6993269/99513289-6a152980-29c5-11eb-9266-3f56ba13d3b2.png)
## 5. 查看和测试
登录后,在 [腾讯云函数地址](https://console.cloud.tencent.com/scf/index) 点击管理控制台,查看最新部署的函数。

File diff suppressed because one or more lines are too long

View File

@@ -9,17 +9,17 @@
============Quantumultx===============
[task_local]
#京东炸年兽🧨
10 * * * * 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 * * * 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 "10 * * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js,tag=京东炸年兽🧨
cron "0 9,12,20 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js,tag=京东炸年兽🧨
===============Surge=================
京东炸年兽🧨 = type=cron,cronexp="10 * * * *",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 * * *",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="10 * * * *", timeout=3600, enable=true
京东炸年兽🧨 = type=cron,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, cronexpr="0 9,12,20 * * *", timeout=3600, enable=true
*/
const $ = new Env('京东炸年兽🧨');
@@ -50,7 +50,7 @@ const inviteCodes = [
`cgxZaDXWZPCmiUa2akPVmFMI27K6antJzucULQPYNim_BPEW1Dwd@cgxZdTXtIrPYuAqfDgSpusxr97nagU6hwFa3TXxnqM95u3ib-xt4nWqZdz8@cgxZdTXtIO-O6QmYDVf67KCEJ19JcybuMB2_hYu8NSNQg0oS2Z_FpMce45g@cgxZdTXtILiLvg7OAASp61meehou4OeZvqbjghsZlc3rI5SBk7b3InUqSQ0@cgxZdTXtIumO4w2cDgSqvYcqHwjaAzLxu0S371Dh_fctFJtN0tXYzdR7JaY`
];
const pkInviteCodes = [
'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEd8@IgNWdiLGaPaZskfACQyhgLSpZWps-WtQEW3McifV@IgNWdiLGaPaAvmHPAQf769XqjJjMyRirPzN9-AS-WHY9Y_G7t9Cwe5gdiI2qEvHZ',
'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEd8@IgNWdiLGaPaZskfACQyhgLSpZWps-WtQEW3McifV@IgNWdiLGaPaAvmHPAQf769XqjJjMyRirPzN9-AS-WHY9Y_G7t9Cwe5gdiI2qEvHZ@IgNWdiLGaPYCeJUfsq18UNi5ln9xEZSPRdOue8Wl3hJTS2SQzU0vulL0fHeULJaIfgqHFd7f_Ks',
'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEd8@IgNWdiLGaPaZskfACQyhgLSpZWps-WtQEW3McifV@IgNWdiLGaPaAvmHPAQf769XqjJjMyRirPzN9-AS-WHY9Y_G7t9Cwe5gdiI2qEvHZ'
]
!(async () => {
@@ -78,7 +78,7 @@ const pkInviteCodes = [
continue
}
await shareCodesFormat();
// await shareCodesFormatPk()
await shareCodesFormatPk()
await jdNian()
}
}
@@ -99,7 +99,7 @@ async function jdNian() {
$.hasGroup = false
await pkTaskDetail()
if ($.hasGroup) await pkInfo()
// await helpFriendsPK()
await helpFriendsPK()
}
await $.wait(2000)
await killCouponList()

View File

@@ -11,7 +11,7 @@ const clientConfig = {
secretId: process.env.TENCENT_SECRET_ID,
secretKey: process.env.TENCENT_SECRET_KEY,
},
region: "ap-hongkong",
region: process.env.TENCENT_REGION, // 区域参考https://cloud.tencent.com/document/product/213/6091
profile: {
httpProfile: {
endpoint: "scf.tencentcloudapi.com",
@@ -22,7 +22,7 @@ const clientConfig = {
const client = new ScfClient(clientConfig);
const params = {
"Handler": "index.main_handler",
"FunctionName": "jd",
"FunctionName": process.env.TENCENT_FUNCTION_NAME, // 云函数程序名,例如 jd_scripts
"ZipFile": contents_in_base64
};
client.UpdateFunctionCode(params).then(