Initial commit,修正

This commit is contained in:
2025-07-13 19:37:38 +08:00
parent 38ce288e27
commit 65bbd06981
12384 changed files with 3985464 additions and 8 deletions
+70
View File
@@ -0,0 +1,70 @@
<?php
# @Author: 嗨噜客(三亚) <fm453>
# @Date: 2022-05-13T09:20:03+08:00
# @Email: fm453@lukegzs.com
# @Last modified by: fm453
# @Last modified time: 2022-05-21T09:28:23+08:00
# @Copyright: www.hiluker.cn
//主入口页
namespace backend\controllers;
use Yii;
use yii\data\Pagination;
use vendor\huawei\obsclient\Hwobs;
use vendor\huawei\obsclient\TemporarySignature;
use vendor\huawei\obsclient\PostObject;
class ObsController extends Common
{
public function actionIndex()
{
$apis = [
'getkey'=>'获取访问Key',
];
$this->result('您正使用CMTS系统-华为云OBS接口!', $apis, 200);
}
private function getconf()
{
return [
'id'=> 'ee124c5102064b83bccd2fdda53261cc', //账号ID
'ak'=> '1DYBXUNEPNCIEEQOGGAE',
'sk'=> '0VBI2xPlDB0NtqqVJv3hSFC8DY52G8OYPYNhncGK',
'area'=>'cn-south-1', //华南广州
'endpoint'=>'obs.cn-south-1.myhuaweicloud.com',
'bucketName'=>'hilu-ctms',
];
}
public function actionGetkey()
{
$params = $this->getconf();
$obs = new Hwobs($ak=$params['ak'], $sk=$params['sk'], $endpoint=$params['endpoint'], $t1=30, $t2=10);
}
public function actionGeturl()
{
$params = $this->getconf();
$obs = new TemporarySignature($ak=$params['ak'], $sk=$params['sk'], $endpoint=$params['endpoint'], $t1=30, $t2=10);
$res = $obs->UploadUrl($params['bucketName']);
// $res = $obs->getCors($params['bucketName']);
var_dump($res);
// $this->result('获取上传网址成功!', $res, 200);
}
public function actionGetform()
{
$params = $this->getconf();
$obs = new PostObject($ak=$params['ak'], $sk=$params['sk'], $endpoint=$params['endpoint'], $t1=30, $t2=10);
$obs->init('obs');
$res = $obs->claimPost('hilu-ctms', 'file.jpg');
$url = 'https://'.$params['bucketName'].".".$params['endpoint'];
$res['up_url'] = $url;
$this->result('获取OBS上传准备信息!', $res, 200);
}
}