You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
53 lines
1.6 KiB
<?php
|
|
|
|
namespace ali\alibabacloud\live;
|
|
|
|
|
|
use AlibabaCloud\Client\Exception\ClientException;
|
|
use AlibabaCloud\Client\Exception\ServerException;
|
|
use AlibabaCloud\Live\Live;
|
|
|
|
class Stream extends Base
|
|
{
|
|
|
|
/**
|
|
* 查询域名下所有流的在线人数信息
|
|
* @param string $query_time 查询某一时刻的在线人事
|
|
* @date 2022-05-20
|
|
*/
|
|
public function getDomainOnlineUserNumber($query_time = '')
|
|
{
|
|
$this->buildClient();
|
|
try {
|
|
$request = Live::v20161101()->describeLiveDomainOnlineUserNum();
|
|
$result = $request
|
|
->withDomainName($this->config['play_host'])
|
|
->debug(false) // Enable the debug will output detailed information
|
|
->connectTimeout(1) // Throw an exception when Connection timeout
|
|
->timeout(1) // Throw an exception when timeout
|
|
->request();
|
|
|
|
$result = $result->toArray();
|
|
// 记录日志
|
|
$uid = defined('UID') ? UID : '';
|
|
platformLog([
|
|
'query_time' => $query_time
|
|
], $result, 'aliyun_live_get_domain_online_user_number_uid_' . $uid);
|
|
|
|
return $result;
|
|
} catch (ClientException $exception) {
|
|
return [
|
|
'Message' => $exception->getMessage()
|
|
];
|
|
} catch (ServerException $exception) {
|
|
return [
|
|
'ErrorCode' => $exception->getErrorCode(),
|
|
'ErrorMessage' => $exception->getErrorMessage(),
|
|
'RequestId' => $exception->getRequestId(),
|
|
];
|
|
}
|
|
|
|
}
|
|
|
|
}
|