Skip to content

Commit

Permalink
🔧修复环境变量类型问题
Browse files Browse the repository at this point in the history
  • Loading branch information
TennousuAthena committed May 7, 2020
1 parent 8f57fe0 commit a96c17f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions danmaku.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@

//敏感词
function aword($str){
global $appid, $secret_id, $secret_key;
if(!$str){
return false;
}
if(getenv('CMS')){
if(getenv('CMS') == "true"){
try {
echo "CMS Ready \n";
echo "CMS Log: \n";
var_dump($secret_id);
$cred = new Credential($secret_id, $secret_key);
$httpProfile = new HttpProfile();
$httpProfile->setEndpoint("cms.tencentcloudapi.com");
Expand All @@ -46,6 +48,7 @@ function aword($str){
var_dump($result);
}
catch(TencentCloudSDKException $e) {
echo "CMS Error:\n";
echo $e;
}
if($result->Data->EvilFlag)
Expand All @@ -63,9 +66,9 @@ function aword($str){
}

function main_handler($event, $context) {
print "start main handler\n";
print "Event info:\n";
print_r($event);
global $appid;
global $appid, $secret_id, $secret_key;
global $cosClient;
global $bucket;
global $origin;
Expand All @@ -91,6 +94,7 @@ function main_handler($event, $context) {
$bucket = "danmaku-".$appid; //存储桶名称 格式:BucketName-APPID
$result = $cosClient->createBucket(array('Bucket' => $bucket));
//请求成功
echo "Bucket Create:\n";
print_r($result);
} catch (\Exception $e) {
//请求失败
Expand Down Expand Up @@ -145,6 +149,7 @@ function main_handler($event, $context) {
'Body' => fopen("/".$key, 'rb'),
));
// 请求成功
echo "File upload: \n";
print_r($result);
// $this->versionId = $result['VersionId'];
return $danmaku;
Expand Down Expand Up @@ -172,7 +177,8 @@ function main_handler($event, $context) {
'Key' => "data/".$body->id.".json",
'Body' => fopen("/".$key, 'rb'),
));
// 请求成功
// 请求成功
echo "File upload: \n";
print_r($result);
return $danmaku;
} catch (\Exception $e) {
Expand Down

0 comments on commit a96c17f

Please sign in to comment.