[更新]ComposerUpdate

This commit is contained in:
Cxphp 2018-05-10 09:33:34 +08:00 committed by Anyon
parent 1666d59e57
commit aa1d5ced16
14 changed files with 396 additions and 23 deletions

View File

@ -16,13 +16,13 @@ return [
// 数据库类型 // 数据库类型
'type' => 'mysql', 'type' => 'mysql',
// 服务器地址 // 服务器地址
'hostname' => '127.0.0.1', 'hostname' => 'server.cuci.cc',
// 数据库名 // 数据库名
'database' => 'admin_v3', 'database' => 'admin_v3',
// 用户名 // 用户名
'username' => 'admin_v3', 'username' => 'root',
// 密码 // 密码
'password' => 'FbYBHcWKr2', 'password' => 'Test12345',
// 端口 // 端口
'hostport' => '3306', 'hostport' => '3306',
// 连接dsn // 连接dsn

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit7ecf5ded1a6830a1c375fe7293886da9::getLoader(); return ComposerAutoloaderInit1fdfee53212f11ec783007c682345a6b::getLoader();

View File

@ -96,6 +96,7 @@ return array(
'Qiniu\\Processing\\ImageUrlBuilder' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php', 'Qiniu\\Processing\\ImageUrlBuilder' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php',
'Qiniu\\Processing\\Operation' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/Operation.php', 'Qiniu\\Processing\\Operation' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/Operation.php',
'Qiniu\\Processing\\PersistentFop' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php', 'Qiniu\\Processing\\PersistentFop' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php',
'Qiniu\\Rtc\\AppClient' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php',
'Qiniu\\Storage\\BucketManager' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php', 'Qiniu\\Storage\\BucketManager' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php',
'Qiniu\\Storage\\FormUploader' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php', 'Qiniu\\Storage\\FormUploader' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php',
'Qiniu\\Storage\\ResumeUploader' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php', 'Qiniu\\Storage\\ResumeUploader' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit7ecf5ded1a6830a1c375fe7293886da9 class ComposerAutoloaderInit1fdfee53212f11ec783007c682345a6b
{ {
private static $loader; private static $loader;
@ -19,15 +19,15 @@ class ComposerAutoloaderInit7ecf5ded1a6830a1c375fe7293886da9
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInit7ecf5ded1a6830a1c375fe7293886da9', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit1fdfee53212f11ec783007c682345a6b', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit7ecf5ded1a6830a1c375fe7293886da9', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit1fdfee53212f11ec783007c682345a6b', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) { if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php'; require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit1fdfee53212f11ec783007c682345a6b::getInitializer($loader));
} else { } else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
@ -48,19 +48,19 @@ class ComposerAutoloaderInit7ecf5ded1a6830a1c375fe7293886da9
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9::$files; $includeFiles = Composer\Autoload\ComposerStaticInit1fdfee53212f11ec783007c682345a6b::$files;
} else { } else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
} }
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire7ecf5ded1a6830a1c375fe7293886da9($fileIdentifier, $file); composerRequire1fdfee53212f11ec783007c682345a6b($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequire7ecf5ded1a6830a1c375fe7293886da9($fileIdentifier, $file) function composerRequire1fdfee53212f11ec783007c682345a6b($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file; require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9 class ComposerStaticInit1fdfee53212f11ec783007c682345a6b
{ {
public static $files = array ( public static $files = array (
'1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php',
@ -179,6 +179,7 @@ class ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9
'Qiniu\\Processing\\ImageUrlBuilder' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php', 'Qiniu\\Processing\\ImageUrlBuilder' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php',
'Qiniu\\Processing\\Operation' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/Operation.php', 'Qiniu\\Processing\\Operation' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/Operation.php',
'Qiniu\\Processing\\PersistentFop' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php', 'Qiniu\\Processing\\PersistentFop' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php',
'Qiniu\\Rtc\\AppClient' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php',
'Qiniu\\Storage\\BucketManager' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php', 'Qiniu\\Storage\\BucketManager' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php',
'Qiniu\\Storage\\FormUploader' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php', 'Qiniu\\Storage\\FormUploader' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php',
'Qiniu\\Storage\\ResumeUploader' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php', 'Qiniu\\Storage\\ResumeUploader' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php',
@ -275,9 +276,9 @@ class ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit1fdfee53212f11ec783007c682345a6b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit1fdfee53212f11ec783007c682345a6b::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit7ecf5ded1a6830a1c375fe7293886da9::$classMap; $loader->classMap = ComposerStaticInit1fdfee53212f11ec783007c682345a6b::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -431,17 +431,17 @@
}, },
{ {
"name": "qiniu/php-sdk", "name": "qiniu/php-sdk",
"version": "v7.2.3", "version": "v7.2.4",
"version_normalized": "7.2.3.0", "version_normalized": "7.2.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/qiniu/php-sdk.git", "url": "https://github.com/qiniu/php-sdk.git",
"reference": "67852ba9cdd7f48e0e080961abebafee134fb329" "reference": "e5605b20aa4cab7d7ad38c2a510e7086d0d85534"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/qiniu/php-sdk/67852ba9cdd7f48e0e080961abebafee134fb329.zip", "url": "https://files.phpcomposer.com/files/qiniu/php-sdk/e5605b20aa4cab7d7ad38c2a510e7086d0d85534.zip",
"reference": "67852ba9cdd7f48e0e080961abebafee134fb329", "reference": "e5605b20aa4cab7d7ad38c2a510e7086d0d85534",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -451,7 +451,7 @@
"phpunit/phpunit": "~4.0", "phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.3" "squizlabs/php_codesniffer": "~2.3"
}, },
"time": "2018-02-20T13:59:54+00:00", "time": "2018-05-09T08:33:46+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
## 7.2.4 (2018-05-09)
### 增加
* 连麦功能
## 7.2.3 (2018-01-20) ## 7.2.3 (2018-01-20)
### 增加 ### 增加
* 新加坡机房 * 新加坡机房

71
vendor/qiniu/php-sdk/docs/rtc/README.md vendored Normal file
View File

@ -0,0 +1,71 @@
# Rtc Streaming Cloud Server-Side Library For PHP
## Features
- Appclient
- [x] 创建房间: client->createApp()
- [x] 查看房间: client->getApp()
- [x] 删除房间: client->deleteApp()
- [x] 生成房间token: client->appToken()
## Contents
- [Installation](#installation)
- [Usage](#usage)
- [Configuration](#configuration)
- [App](#app)
- [Create a app](#create-a-app)
- [Get a app](#get-a-app)
- [Delete a app](#delete-a-app)
- [Generate a app token](#generate-a-app-token)
## Usage
### App
#### Create a app
```php
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
$sk = "xxxx";
$auth = new Auth($ak, $sk);
$client = new Qiniu\Rtc\AppClient($auth);
$resp=$client->createApp("901","testApp");
print_r($resp);
```
#### Get an app
```php
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
$sk = "xxxx";
$auth = new Auth($ak, $sk);
$client = new Qiniu\Rtc\AppClient($auth);
$resp=$client->getApp("deq02uhb6");
print_r($resp);
```
#### Delete an app
```php
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
$sk = "xxxx";
$auth = new Auth($ak, $sk);
$client = new Qiniu\Rtc\AppClient($auth);
$resp=$client->deleteApp("deq02uhb6");
print_r($resp);
```
#### Generate an app token
```php
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
$sk = "xxxx";
$auth = new Auth($ak, $sk);
$client = new Qiniu\Rtc\AppClient($auth);
$resp=$client->appToken("deq02uhb6", "lfx", '1111', (time()+3600), 'user');
print_r($resp);
```

View File

@ -0,0 +1,42 @@
<?php
require_once("../../autoload.php");
use \Qiniu\Auth;
$ak = 'gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5';
$sk = 'xxxx';
$auth = new Auth($ak, $sk);
$client = new Qiniu\Rtc\AppClient($auth);
$hub = 'lfxlive';
$title = 'lfxl';
try {
//创建app
$resp = $client->createApp($hub, $title, $maxUsers);
print_r($resp);
// 获取app状态
$resp = $client->getApp('dgdl5ge8y');
print_r($resp);
//修改app状态
$mergePublishRtmp = null;
$mergePublishRtmp['enable'] = true;
$resp = $client->updateApp('dgdl5ge8y', $hub, $title, $maxUsers, $mergePublishRtmp);
print_r($resp);
//删除app
$resp = $client->deleteApp('dgdl5ge8y');
print_r($resp);
//获取房间连麦的成员
$resp=$client->listUser("dgbfvvzid", 'lfxl');
print_r($resp);
//剔除房间的连麦成员
$resp=$client->kickUser("dgbfvvzid", 'lfx', "qiniu-f6e07b78-4dc8-45fb-a701-a9e158abb8e6");
print_r($resp);
// 列举房间
$resp=$client->listActiveRooms("dgbfvvzid", 'lfx', null, null);
print_r($resp);
//鉴权的有效时间: 1个小时.
$resp = $client->appToken("dgd4vecde", "lfxl", '1111', (time()+3600), 'user');
print_r($resp);
} catch (\Exception $e) {
echo "Error:", $e, "\n";
}

View File

@ -0,0 +1,20 @@
<?php
require_once __DIR__ . '/../autoload.php';
use \Qiniu\Auth;
$accessKey = getenv('QINIU_ACCESS_KEY');
$secretKey = getenv('QINIU_SECRET_KEY');
$bucket = getenv('QINIU_TEST_BUCKET');
$key = "qiniu.jpg";
$auth = new Auth($accessKey, $secretKey);
$config = new \Qiniu\Config();
$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config);
$status = 1;//0表示启用1表示禁用
$err = $bucketManager->changeStatus($bucket, $key, $status);
if ($err) {
print_r($err);
}

View File

@ -3,7 +3,7 @@ namespace Qiniu;
final class Config final class Config
{ {
const SDK_VER = '7.2.3'; const SDK_VER = '7.2.4';
const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改 const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改
@ -11,6 +11,8 @@ final class Config
const API_HOST = 'api.qiniu.com'; const API_HOST = 'api.qiniu.com';
const RS_HOST = 'rs.qiniu.com'; //RS Host const RS_HOST = 'rs.qiniu.com'; //RS Host
const UC_HOST = 'https://api.qiniu.com'; //UC Host const UC_HOST = 'https://api.qiniu.com'; //UC Host
const RTCAPI_HOST = 'http://rtc.qiniuapi.com';
const RTCAPI_VERSION = 'v3';
// Zone 空间对应的机房 // Zone 空间对应的机房
public $zone; public $zone;

View File

@ -13,6 +13,12 @@ final class Client
return self::sendRequest($request); return self::sendRequest($request);
} }
public static function delete($url, array $headers = array())
{
$request = new Request('DELETE', $url, $headers);
return self::sendRequest($request);
}
public static function post($url, $body, array $headers = array()) public static function post($url, $body, array $headers = array())
{ {
$request = new Request('POST', $url, $headers, $body); $request = new Request('POST', $url, $headers, $body);
@ -129,7 +135,7 @@ final class Client
$headerLine = trim($line); $headerLine = trim($line);
$kv = explode(':', $headerLine); $kv = explode(':', $headerLine);
if (count($kv) > 1) { if (count($kv) > 1) {
$kv[0] = ucwords($kv[0], '-'); $kv[0] =self::ucwordsHyphen($kv[0]);
$headers[$kv[0]] = trim($kv[1]); $headers[$kv[0]] = trim($kv[1]);
} }
} }
@ -142,4 +148,9 @@ final class Client
$replace = array("\\\\", "\\\""); $replace = array("\\\\", "\\\"");
return str_replace($find, $replace, $str); return str_replace($find, $replace, $str);
} }
private static function ucwordsHyphen($str)
{
return str_replace('- ', '-', ucwords(str_replace('-', '- ', $str)));
}
} }

View File

@ -0,0 +1,204 @@
<?php
namespace Qiniu\Rtc;
use Qiniu\Http\Client;
use Qiniu\Http\Error;
use Qiniu\Config;
use Qiniu\Auth;
class AppClient
{
private $auth;
private $baseURL;
public function __construct(Auth $auth)
{
$this->auth = $auth;
$this->baseURL = sprintf("%s/%s/apps", Config::RTCAPI_HOST, Config::RTCAPI_VERSION);
}
/*
* hub: 直播空间名
* title: app 的名称 注意Title 不是唯一标识,重复 create 动作将生成多个 app
* maxUsers人数限制
* NoAutoKickUser: bool 类型,可选,禁止自动踢人(抢流)。默认为 false
即同一个身份的 client (app/room/user) ,新的连麦请求可以成功,旧连接被关闭。
*/
public function createApp($hub, $title, $maxUsers = null, $noAutoKickUser = null)
{
$params['hub'] = $hub;
$params['title'] = $title;
if (!empty($maxUsers)) {
$params['maxUsers'] = $maxUsers;
}
if (!empty($noAutoKickUser)) {
$params['noAutoKickUser'] = $noAutoKickUser;
}
$body = json_encode($params);
$ret = $this->post($this->baseURL, $body);
return $ret;
}
/*
* appId: app 的唯一标识,创建的时候由系统生成。
* Title: app 的名称, 可选。
* Hub: 绑定的直播 hub可选用于合流后 rtmp 推流。
* MaxUsers: int 类型,可选,连麦房间支持的最大在线人数。
* NoAutoKickUser: bool 类型,可选,禁止自动踢人。
* MergePublishRtmp: 连麦合流转推 RTMP 的配置,可选择。其详细配置包括如下
Enable: 布尔类型,用于开启和关闭所有房间的合流功能。
AudioOnly: 布尔类型,可选,指定是否只合成音频。
Height, Width: int64可选指定合流输出的高和宽默认为 640 x 480
OutputFps: int64可选指定合流输出的帧率默认为 25 fps
OutputKbps: int64可选指定合流输出的码率默认为 1000
URL: 合流后转推旁路直播的地址,可选,支持魔法变量配置按照连麦房间号生成不同的推流地址。如果是转推到七牛直播云,不建议使用该配置。
StreamTitle: 转推七牛直播云的流名,可选,支持魔法变量配置按照连麦房间号生成不同的流名。例如,配置 Hub qn-zhibo ,配置 StreamTitle $(roomName) ,则房间 meeting-001 的合流将会被转推到 rtmp://pili-publish.qn-zhibo.***.com/qn-zhibo/meeting-001地址。详细配置细则,请咨询七牛技术支持。
*/
public function updateApp($appId, $hub, $title, $maxUsers = null, $mergePublishRtmp = null, $noAutoKickUser = null)
{
$url = $this->baseURL . '/' . $appId;
$params['hub'] = $hub;
$params['title'] = $title;
if (!empty($maxUsers)) {
$params['maxUsers'] = $maxUsers;
}
if (!empty($noAutoKickUser)) {
$params['noAutoKickUser'] = $noAutoKickUser;
}
if (!empty($mergePublishRtmp)) {
$params['mergePublishRtmp'] = $mergePublishRtmp;
}
$body = json_encode($params);
$ret = $this->post($url, $body);
return $ret;
}
/*
* appId: app 的唯一标识,创建的时候由系统生成。
*/
public function getApp($appId)
{
$url = $this->baseURL . '/' . $appId;
$ret = $this->get($url);
return $ret;
}
/*
* appId: app 的唯一标识,创建的时候由系统生成
*/
public function deleteApp($appId)
{
$url = $this->baseURL . '/' . $appId;
list(, $err) = $this->delete($url);
return $err;
}
/*
* 获取房间的人数
* appId: app 的唯一标识,创建的时候由系统生成。
* roomName: 操作所查询的连麦房间。
*/
public function listUser($appId, $roomName)
{
$url = sprintf("%s/%s/rooms/%s/users", $this->baseURL, $appId, $roomName);
$ret = $this->get($url);
return $ret;
}
/*
* 踢出玩家
* appId: app 的唯一标识,创建的时候由系统生成。
* roomName: 连麦房间
* userId: 请求加入房间的用户ID
*/
public function kickUser($appId, $roomName, $userId)
{
$url = sprintf("%s/%s/rooms/%s/users/%s", $this->baseURL, $appId, $roomName, $userId);
list(, $err) = $this->delete($url);
return $err;
}
/*
* 获取房间的人数
* appId: app 的唯一标识,创建的时候由系统生成。
* prefix: 所查询房间名的前缀索引,可以为空。
* offset: int 类型,分页查询的位移标记。
* limit: int 类型,此次查询的最大长度。
* GET /v3/apps/<AppID>/rooms?prefix=<RoomNamePrefix>&offset=<Offset>&limit=<Limit>
*/
public function listActiveRooms($appId, $prefix = null, $offset = null, $limit = null)
{
if (isset($prefix)) {
$query['prefix'] = $prefix;
}
if (isset($offset)) {
$query['offset'] = $offset;
}
if (isset($limit)) {
$query['limit'] = $limit;
}
if (isset($query) && !empty($query)) {
$query = '?' . http_build_query($query);
$url = sprintf("%s/%s/rooms%s", $this->baseURL, $appId, $query);
} else {
$url = sprintf("%s/%s/rooms", $this->baseURL, $appId);
}
$ret = $this->get($url);
return $ret;
}
/*
* appId: app 的唯一标识,创建的时候由系统生成。
* roomName: 房间名称,需满足规格 ^[a-zA-Z0-9_-]{3,64}$
* userId: 请求加入房间的用户 ID需满足规格 ^[a-zA-Z0-9_-]{3,50}$
* expireAt: int64 类型鉴权的有效时间传入以秒为单位的64位Unix
绝对时间token 将在该时间后失效。
* permission: 该用户的房间管理权限,"admin" "user",默认为 "user"
当权限角色为 "admin" 时,拥有将其他用户移除出房间等特权.
*/
public function appToken($appId, $roomName, $userId, $expireAt, $permission)
{
$params['appId'] = $appId;
$params['userId'] = $userId;
$params['roomName'] = $roomName;
$params['permission'] = $permission;
$params['expireAt'] = $expireAt;
$appAccessString = json_encode($params);
return $this->auth->signWithData($appAccessString);
}
private function get($url, $cType = null)
{
$rtcToken = $this->auth->authorizationV2($url, "GET", null, $cType);
$rtcToken['Content-Type'] = $cType;
$ret = Client::get($url, $rtcToken);
if (!$ret->ok()) {
return array(null, new Error($url, $ret));
}
return array($ret->json(), null);
}
private function delete($url, $contentType = 'application/json')
{
$rtcToken = $this->auth->authorizationV2($url, "DELETE", null, $contentType);
$rtcToken['Content-Type'] = $contentType;
$ret = Client::delete($url, $rtcToken);
if (!$ret->ok()) {
return array(null, new Error($url, $ret));
}
return array($ret->json(), null);
}
private function post($url, $body, $contentType = 'application/json')
{
$rtcToken = $this->auth->authorizationV2($url, "POST", $body, $contentType);
$rtcToken['Content-Type'] = $contentType;
$ret = Client::post($url, $body, $rtcToken);
if (!$ret->ok()) {
return array(null, new Error($url, $ret));
}
$r = ($ret->body === null) ? array() : $ret->json();
return array($r, null);
}
}

View File

@ -225,6 +225,23 @@ final class BucketManager
return $error; return $error;
} }
/**
* 修改文件的存储状态,即禁用状态和启用状态间的的互相转换
*
* @param $bucket 待操作资源所在空间
* @param $key 待操作资源文件名
* @param $status 待操作文件目标文件类型
*
* @return mixed 成功返回NULL失败返回对象Qiniu\Http\Error
* @link https://developer.qiniu.com/kodo/api/4173/modify-the-file-status
*/
public function changeStatus($bucket, $key, $status)
{
$resource = \Qiniu\entry($bucket, $key);
$path = '/chstatus/' . $resource . '/status/' . $status;
list(, $error) = $this->rsPost($path);
return $error;
}
/** /**
* 从指定URL抓取资源并将该资源存储到指定空间中 * 从指定URL抓取资源并将该资源存储到指定空间中