12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * 腾讯云-点播
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2019/10/26
- * Time: 6:07 PM
- */
- namespace Util\TencentCloud;
- use Mall\Framework\Core\ResultWrapper;
- use Mall\Framework\Core\ErrorCode;
- class Vod
- {
- /**
- * 腾讯云安全凭证
- * @var string $secret_id
- */
- private $secret_id;
- /**
- * 腾讯云安全凭证
- * @var string $secret_key
- */
- private $secret_key;
- public function __construct($secret_id='', $secret_key='')
- {
- $this->secret_id = $secret_id;
- $this->secret_key = $secret_key;
- }
- /**
- * 客户端上传签名
- * 官网文档地址:https://cloud.tencent.com/document/product/266/9221
- * @return string
- */
- public function getUploadSign()
- {
- // 向参数列表填入参数
- $arg_list = [
- "secretId" => $this->secret_id,
- "currentTimeStamp" => time(),
- "expireTime" => time() + 86400, // 签名有效期:1天
- "random" => rand()
- ];
- // 计算签名
- $orignal = http_build_query($arg_list);
- $signature = base64_encode(hash_hmac('SHA1', $orignal, $this->secret_key, true).$orignal);
- return ResultWrapper::success($signature);
- }
- }
|