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.
72 lines
1.9 KiB
72 lines
1.9 KiB
<?php
|
|
|
|
namespace huanya;
|
|
|
|
class Open extends Base
|
|
{
|
|
|
|
/**
|
|
* 环亚设备 开门
|
|
* @param string $device_id 设备ID
|
|
* @param string $text 欢迎语
|
|
* @date 2022-11-23
|
|
*/
|
|
public function huanYaCommand($device_id, $text = '欢迎')
|
|
{
|
|
$result = http_data_post($this->url . 'api/v1/HuanYaSeven/open', [
|
|
'device_sn' => $device_id,
|
|
'text' => $text
|
|
]);
|
|
|
|
// 记录日志
|
|
$uid = defined('UID') ? UID : '';
|
|
platformLog([
|
|
'device_sn' => $device_id,
|
|
'text' => $text
|
|
], $result, 'huanya_command_uid_' . $uid);
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* 环亚设备返回(二维码 刷卡 人脸识别)
|
|
* @param $data 人脸传过来的值
|
|
* @param bool $open
|
|
* @param string $msg
|
|
* @return \think\response\Json
|
|
*/
|
|
function huanYaDeviceReturn($data, $open = true, $msg = '欢迎')
|
|
{
|
|
$result = [
|
|
'reply' => 'ACK',
|
|
'cmd' => 'face',
|
|
'code' => 0,
|
|
'sequence_no' => $data['sequence_no'],
|
|
'cap_time' => $data['cap_time'],
|
|
'gateway_ctrl' => $open ? [
|
|
'device_type' => 'gpio',
|
|
'device_no' => 1,
|
|
'long_card_id' => '',
|
|
'ctrl_mode' => 'force',
|
|
'person_id' => $data['match']['person_id'] ?? '',
|
|
] : [],
|
|
'tts' => [
|
|
'text' => $msg,
|
|
],
|
|
// 'text_display'=>[
|
|
// 'position'=>['x'=>0,'y'=>300],
|
|
// 'alive_time'=>1500,
|
|
// 'text'=>$msg,
|
|
// 'font_size'=>40,
|
|
// 'font_spacing'=>1,
|
|
// 'font_color'=>'0x00000000'
|
|
// ],
|
|
];
|
|
|
|
// 记录日志
|
|
$uid = defined('UID') ? UID : '';
|
|
platformLog($data, $result, 'huanya_device_return_uid_' . $uid);
|
|
|
|
return json($result);
|
|
}
|
|
} |