Hkws.php
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace app\api\controller;
use app\common\controller\Api;
use think\Db;
use think\exception\PDOException;
/**
* 首页接口
*/
class Hkws extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* 首页
*
*/
public function index()
{
$this->success('请求成功');
}
public function command()
{
$direction = $this->request->param('direction');
if (!in_array($direction,['0',1,2,3,4,5,6,7,8,9,10,11])) {
$this->error('指令参数错误');
}
$url = 'https://open.ys7.com/api/lapp/device/ptz/start';
$data = [
'accessToken' => 'at.2209auyw505mjojoai0uc6q3dpn3sekk-1lankv9uq3-0yxxupl-yazzgmgdh',
'deviceSerial'=>'F77587632',
'channelNo' =>1,
'direction' => $direction,
'speed' => 1
];
$res = json_decode(\fast\Http::post($url,$data));
$this->success('',$res);
}
public function stopcommand()
{
$uri = 'https://open.ys7.com/api/lapp/device/ptz/stop';
$data = [
'accessToken' => 'at.2209auyw505mjojoai0uc6q3dpn3sekk-1lankv9uq3-0yxxupl-yazzgmgdh',
'deviceSerial'=>'F77587632',
'channelNo' =>1,
];
$res = \fast\Http::post($uri,$data);
//dump($res);
}
}