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.
44 lines
1.1 KiB
44 lines
1.1 KiB
12 months ago
|
<?php
|
||
|
|
||
|
namespace app\api\controller\v1\user;
|
||
|
|
||
|
use app\Request;
|
||
|
use app\services\user\IpcServices;
|
||
|
use crmeb\exceptions\AuthException;
|
||
|
|
||
|
class IpcController
|
||
|
{
|
||
|
protected $services = NUll;
|
||
|
public function __construct(IpcServices $services, Request $request)
|
||
|
{
|
||
|
$this->services = $services;
|
||
|
$user = $request->user()->toArray();
|
||
|
if ($user['is_ipc_view'] != 1) {
|
||
|
// return app('json')->fail('没有观看权限');
|
||
|
throw new AuthException('没有观看权限');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// 获取播放地址
|
||
|
public function QueryLiveStreaming(Request $request)
|
||
|
{
|
||
|
$data = $request->postMore([
|
||
|
['Scheme', 'rtmp'],
|
||
|
['IotId', '']
|
||
|
]);
|
||
|
|
||
|
if (empty($data['IotId'])) {
|
||
|
return app('json')->fail(100100);
|
||
|
}
|
||
|
|
||
|
$data = $this->services->QueryLiveStreaming($data['Scheme'], $data['IotId']);
|
||
|
return app('json')->success($data);
|
||
|
}
|
||
|
|
||
|
// 获取设备ID
|
||
|
private function getDeviceId($nickName)
|
||
|
{
|
||
|
return $this->services->getDeviceId($nickName);
|
||
|
}
|
||
|
}
|