Skip to content

Commit

Permalink
改用Layer
Browse files Browse the repository at this point in the history
  • Loading branch information
TennousuAthena committed May 6, 2020
1 parent 1110c91 commit 8f57fe0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@
![image.png](https://i.loli.net/2020/05/05/E56lYMm7TdjzSWP.png)
选择空白函数,内存128mb即可
![image.png](https://i.loli.net/2020/05/05/w1LdGBkr74ocyfx.png)
下载一个最新的[Release](https://github.com/qcminecraft/Serverless-DPlayer-PHP/releases),上传
下载一个最新的[Release](https://github.com/qcminecraft/Serverless-DPlayer-PHP/releases)中的layer.zip,新建一个层(名称随意)并上传
![image.png](https://i.loli.net/2020/05/06/6nxDT5uZQXAgcop.png)
绑定
![image.png](https://i.loli.net/2020/05/06/NCBIs927rWh5Vz3.png)

### 0x003

![image.png](https://i.loli.net/2020/05/05/rFQUCxHuEij6ZT5.png)
在触发管理中添加一个API网关的触发器

### 0x0003
### 0x0004
配置config.php中的信息,完成!
Dplayer后端地址形如 https://service-henghenghengaaa-114514.gz.apigw.tencentcs.com/release/danmaku/

Expand All @@ -42,5 +48,8 @@ Dplayer后端地址形如 https://service-henghenghengaaa-114514.gz.apigw.tencen
| 1536 | 266,667 |
| 3072 | 133,333 |

## 我可以用我自己的服务器吗?
目前仅支持SCF,请见谅

### 还有问题?
加入[Telegram群](https://t.me/oi_ez)或提交[Issue](https://github.com/qcminecraft/Serverless-DPlayer-PHP/issues)
9 changes: 5 additions & 4 deletions danmaku.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

require 'vendor/cos-php-sdk-v5/vendor/autoload.php';
require '/opt/cos-php-sdk-v5/vendor/autoload.php';
require '/opt/tencentcloud-sdk-php/TCloudAutoLoader.php';
require 'config.php';
require 'vendor/tencentcloud-sdk-php/TCloudAutoLoader.php';

use TencentCloud\Common\Credential;
use TencentCloud\Common\Profile\ClientProfile;
Expand All @@ -18,12 +18,13 @@
'secretKey' => $secret_key)));

//敏感词
function aword($str, $cms=false){
function aword($str){
if(!$str){
return false;
}
if($cms){
if(getenv('CMS')){
try {
echo "CMS Ready \n";
$cred = new Credential($secret_id, $secret_key);
$httpProfile = new HttpProfile();
$httpProfile->setEndpoint("cms.tencentcloudapi.com");
Expand Down
3 changes: 2 additions & 1 deletion template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Resources:
CodeUri: .
Description: Dplayer 弹幕后端
Environment:
Variables: {}
Variables:
CMS: false
Events: {}
Handler: danmaku.main_handler
MemorySize: 128
Expand Down

0 comments on commit 8f57fe0

Please sign in to comment.