123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900 |
- <?php
- namespace app\common\server;
- use app\common\model\FacilityModel;
- use app\common\model\ShsendlistModel;
- use app\common\model\ShsendqueueModel;
- //use app\common\server\SouhuanAnalysis;
- //use think\facade\Log;
- /**
- * 手环命令创建
- *
- * @author wj
- * @date 2023-09-01
- */
- class ShouhuanCommand
- {
- /**
- * 获取设备信息
- *
- * @param [type] $facility_id
- * @param [type] $device_id_code
- * @return void
- * @author wj
- * @date 2023-09-01
- */
- private function getfacilityinfo($facility_id, $device_id_code)
- {
- $m_f = new FacilityModel();
- $fwhere = [
- 'id' => $facility_id,
- 'code' => $device_id_code,
- 'kind' => 1,
- 'status' => 1,
- ];
- $finfo = $m_f->getInfo($fwhere);
- if (!$finfo) {
- throw new \Exception("无对应信息:" . $facility_id . "-" . $device_id_code);
- }
- return $finfo;
- }
- /**
- * 创建发送信息
- *
- * @param [type] $data
- * @param [type] $command
- * @return void
- * @author wj
- * @date 2023-08-14
- * $data =['command'=>'','content_arr'=>[],]
- */
- public function createsendmsg($facility_id, $device_id_code, $data, $param = [], $sys_user_id = 0)
- {
- $command = $data['command'];
- $infoarr = $this->getsendcommandinfo($command);
- if (!$infoarr) {
- // Log::write("无对应命令数据1:" . $command, 'shouhuan');
- // Log::write($data, 'shouhuan');
- return false;
- }
- $content_arr = $data['content_arr'];
- $config = $infoarr;
- $m_ssl = new ShsendlistModel();
- $commandxy = "3G";
- //仅创建
- if ($command == 'AL') {
- $msg_type = 1;
- } else {
- $msg_type = 0;
- }
- if ('back' == $config['kind']) {
- $content = $config['content'];
- $content = implode(',', $content);
- $send_type = 0;
- $is_success = 1;
- }
- if ('send' == $config['kind']) {
- $content = $config['content'];
- $useconmmand = $content['command'];
- $content_custom = isset($content['content_custom']) ? $content['content_custom'] : false;
- $need_back = $config['need_back'];
- if ($content_custom) {
- $functionname = 'get' . $command . "Commandinfo";
- if (method_exists($this, $functionname)) {
- $content = $useconmmand . "," . $this->$functionname($param);
- } else {
- throw new \Exception($command . "自定义方法不存在");
- }
- } else {
- $content = implode(',', $content_arr);
- }
- $send_type = 1;
- if ($need_back) {
- $is_success = 0;
- } else {
- $is_success = 1;
- }
- }
- $weight = $this->getsendweight($command);
- $msgdata = [
- 0 => $commandxy,
- 'device_id_code' => $device_id_code,
- 'len' => str_pad(strtoupper(dechex(mb_strlen($content))), 4, "0", STR_PAD_LEFT),
- 'content' => $content,
- ];
- $msg = '[' . implode('*', $msgdata) . ']';
- $sslInsertData = [
- 'facility_id' => $facility_id,
- 'device_id_code' => $device_id_code,
- 'command' => $command,
- 'send_msg' => $msg,
- 'send_weight' => $weight,
- 'send_time' => date('Y-m-d H:i:s'),
- 'is_success' => $is_success,
- 'send_type' => $send_type,
- 'sys_user_id' => $sys_user_id,
- ];
- $sslid = $m_ssl->insertData($sslInsertData);
- if (empty($sslid)) {
- throw new \Exception("发送数据添加失败");
- }
- $data = [
- 'msg' => $msg,
- 'weight' => $weight,
- 'createtime' => date('Y-m-d H:i:s'),
- 'facility_id' => $facility_id,
- 'device_id_code' => $device_id_code,
- 'send_list_id' => $sslid,
- 'msg_type' => $msg_type,
- ];
- $m_ssq = new ShsendqueueModel();
- $id = $m_ssq->insertData($data);
- if (empty($id)) {
- throw new \Exception("发送队列数据添加失败");
- }
- return true;
- }
- /**
- * 获取回复权重
- *
- * @param [type] $command
- * @return void
- * @author wj
- * @date 2023-08-11
- */
- public function getsendweight($command)
- {
- $weight = -1;
- switch ($command) {
- case 'POWEROFF':
- //关机
- $weight = 99;
- break;
- case 'RESET':
- //重启
- $weight = 98; //硬件未测试
- break;
- //平台回复命令
- case 'AL':
- case 'KA':
- case 'LK':
- case 'PING':
- case 'BPHRT':
- case 'TEMP':
- case 'HEART':
- case 'BLOOD':
- case 'OXYGEN':
- $weight = 1;
- break;
- //平台发送命令
- case 'ZONE':
- case 'UPLOAD':
- case 'CR':
- case 'SLEEPTIME':
- case 'FALLDOWN':
- case 'FACTORY':
- case 'SOS':
- case 'VERNO':
- case 'LOWBAT':
- case 'POWEROFF':
- case 'LSSET':
- case 'PEDO':
- case 'PHL':
- case 'REMIND':
- case 'SILENCETIME2':
- case 'BOOTOFF':
- case 'REMOVE':
- $weight = 0;
- break;
- default:
- $weight = -1;
- break;
- }
- if ($weight < 0) {
- //不需设置 发送信息
- return false;
- }
- return $weight;
- }
- /**
- * 获取平台发送命令信息
- *
- * @param [type] $command
- * @return void
- * @author wj
- * @date 2023-08-11
- */
- public function getsendcommandinfo($command)
- {
- $command = strtoupper($command);
- $data = [
- //平台发送
- //时区
- 'ZONE' => [
- 'content' => [
- 'command' => 'ZONE',
- 'zone' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- //位置发送间隔
- 'UPLOAD' => [
- 'content' => [
- 'command' => 'UPLOAD',
- 'interval' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- //心率上传间隔
- 'HRTSTART' => [
- 'content' => [
- 'command' => 'hrtstart',
- 'interval' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- //体温上传间隔
- 'WDSTART' => [
- 'content' => [
- 'command' => 'wdstart',
- 'interval' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- //血压上传频率
- 'BLDSTART' => [
- 'content' => [
- 'command' => 'bldstart',
- 'interval' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- //血氧上传频率
- 'OXSTART' => [
- 'content' => [
- 'command' => 'oxstart',
- 'interval' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- //立即定位
- 'CR' => [
- 'content' => [
- 'command' => 'CR',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- 'SLEEPTIME' => [
- 'content' => [
- 'command' => 'CR',
- ],
- 'kind' => 'send',
- 'content_custom' => true,
- 'need_back' => 1,
- ],
- 'FALLDOWN' => [
- 'content' => [
- 'command' => 'FALLDOWN',
- 'is_open' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- 'FACTORY' => [
- 'content' => [
- 'command' => 'FACTORY',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- 'SOS' => [
- 'content' => [
- 'command' => 'SOS',
- ],
- 'kind' => 'send',
- 'content_custom' => true,
- 'need_back' => 1,
- ],
- 'VERNO' => [
- 'content' => [
- 'command' => 'VERNO',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- 'LOWBAT' => [
- 'content' => [
- 'command' => 'LOWBAT',
- 'is_open' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- 'POWEROFF' => [
- 'content' => [
- 'command' => 'POWEROFF',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- 'LSSET' => [
- 'content' => [
- 'command' => 'LSSET',
- 'content_custom' => true,
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- 'PEDO' => [
- 'content' => [
- 'command' => 'PEDO',
- 'is_open' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- 'PHL' => [
- 'content' => [
- 'command' => 'PEDO',
- ],
- 'kind' => 'send',
- 'content_custom' => true,
- 'need_back' => 1,
- ],
- 'REMIND' => [
- 'content' => [
- 'command' => 'REMIND',
- ],
- 'kind' => 'send',
- 'content_custom' => true,
- 'need_back' => 1,
- ],
- 'SILENCETIME2' => [
- 'content' => [
- 'command' => 'SILENCETIME2',
- ],
- 'kind' => 'send',
- 'content_custom' => true,
- 'need_back' => 1,
- ],
- 'BOOTOFF' => [
- 'content' => [
- 'command' => 'BOOTOFF',
- 'is_open' => '',
- 'bootup_time' => '',
- 'shutdown_time' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- 'REMOVE' => [
- 'content' => [
- 'command' => 'REMOVE',
- 'is_open' => '',
- ],
- 'kind' => 'send',
- 'need_back' => 1,
- ],
- //平台回复
- 'LK' => [
- 'content' => [
- 'command' => 'LK',
- ],
- 'kind' => 'back',
- ],
- 'PING' => [
- 'content' => [
- 'command' => 'PING',
- 'isbind' => 1,
- ],
- 'kind' => 'back',
- ],
- 'KA' => [
- 'content' => [
- 'command' => 'KA',
- ],
- 'kind' => 'back',
- ],
- 'TEMP' => [
- 'content' => [
- 'command' => 'temp',
- ],
- 'kind' => 'back',
- ],
- 'BPHRT' => [
- 'content' => [
- 'command' => 'bphrt',
- ],
- 'kind' => 'back',
- ],
- 'HEART' => [
- 'content' => [
- 'command' => 'heart',
- ],
- 'kind' => 'back',
- ],
- 'BLOOD' => [
- 'content' => [
- 'command' => 'blood',
- ],
- 'kind' => 'back',
- ],
- 'OXYGEN' => [
- 'content' => [
- 'command' => 'oxygen',
- ],
- 'kind' => 'back',
- ],
- 'AL' => [
- 'content' => [
- 'command' => 'AL',
- ],
- 'kind' => 'back',
- ],
- ];
- if (!isset($data[$command])) {
- return false;
- }
- return $data[$command];
- }
- /**
- * 创建sos电话设置命令
- * 最多三个电话
- *
- * @return void
- * @author wj
- * @date 2023-08-21
- */
- public function getSOSCommandinfo($param)
- {
- if (count($param) <= 0) {
- throw new \Exception("未设置电话");
- }
- if (count($param) > 3) {
- throw new \Exception("设置电话数量过多");
- }
- foreach ($param as $key => $value) {
- //判断是否为手机号
- //暂不处理
- }
- $info = implode(",", $param);
- return $info;
- }
- /**
- * 设置跌倒灵敏度命令
- * [3G*358800006072996*0009*LSSET,3+6]
- *
- * @return void
- * @author wj
- * @date 2023-08-21
- */
- public function getLSSETCommandinfo($param)
- {
- if (2 != count($param)) {
- throw new \Exception("LSSET参数错误");
- }
- foreach ($param as $key => $value) {
- if (!is_numeric($value)) {
- throw new \Exception("LSSET参数错误:" . $value);
- }
- }
- $info = $param[0] . "+" . $param[1];
- return $info;
- }
- /**
- * 设置电话本
- * 最多10条
- *[{telno=>'',name=>''}]
- * @param [type] $param
- * @return void
- * @author wj
- * @date 2023-08-21
- */
- public function getPHLCommandinfo($param)
- {
- if (50 < count($param)) {
- throw new \Exception("PHL参数错误");
- }
- if (0 != count($param) % 2) {
- throw new \Exception("PHL参数长度错误");
- }
- $usedata = [];
- foreach ($param as $key => $value) {
- $telno = $value['telno'];
- $name = $value['name'];
- //电话号码
- if (20 < mb_strlen($telno)) {
- throw new \Exception("PHL电话号码错误:" . $telno);
- }
- $name = $this->srtingToUnicode($name);
- $usedata[] = $telno;
- $usedata[] = $name;
- }
- $info = implode(",", $usedata);
- return $info;
- }
- /**
- * 设置电话本
- * 最多10条
- *{[time=>'',isopen=>'','type'=>'','weeks'=>[]]}
- * weeks 数组 每个1到7 周日到周六
- * 最多设置三个
- * @param [type] $param
- * @return void
- * @author wj
- * @date 2023-08-21
- */
- /*
- 08:10-1-1:闹钟时间 8:10,打开,响铃一次
- 08:10-1-2:闹钟时间 8:10,打开,每天响铃
- 08:10-1-3-0111110:闹钟时间 8:10,打开,自定义周一至周五打开
- 最左边是周日,最右边是周六,即 0111110 的顺序是:周日,周一,周二,周三,周四,周五,周
- 六(1 为打开,0 为关闭),其中周一至周五打开闹钟
- */
- public function getREMINDCommandinfo($param)
- {
- if (empty($param)) {
- throw new \Exception("REMINDC参数错误");
- }
- $usedata = [];
- foreach ($param as $key => $value) {
- if (3 > count($value)) {
- throw new \Exception("REMINDC参数错误");
- }
- $useweeks = ["0", "0", "0", "0", "0", "0", "0"];
- $time = $this->formattime($value['time'], 'H:i');
- $isopen = $value['isopen'];
- $type = $value['type'];
- $weeks = $value['weeks'];
- if (3 == $type) {
- foreach ($weeks as $wkey => $wvalue) {
- if ($wvalue >= 1 && $wvalue <= 7) {
- $useweeks[$wvalue - 1] = '1';
- }
- }
- $useweeks = implode("", $useweeks);
- $type = $useweeks;
- }
- $usedata[] = $time . "-" . $isopen . "-" . $type;
- }
- $usedata = implode(",", $usedata);
- return $usedata;
- }
- /**
- * 静默时间段测试
- *{[starttime=>'',endtime=>'',isopen=>'',weeks=>[]]}
- * weeks 数组 每个1到7 周日到周六
- * 最多设置三个
- *
- * @return void
- * @author wj
- * @date 2023-08-21
- */
- /*
- [DW*334588000000156*0038*SILENCETIME2,7:30-21:10-1-0111110,7:30-21:10-1-0111110,7:
- 30-21:10-0-0111110]
- 设置上课禁用时间段范围,拦截终端的任何来电。格式为“起始时间-结束时间-自定义星期几”, 比
- 如上面的 7:30-21:00-0111110,则表示周一到周五 7:30 到 21:00 之间上课禁用生效,起始时间
- 默认大于结束时间。
- 总开关:0 为关,1 为开
- 关于自定义星期几的规则:最左边是周日,最右边是周六,即 0111110 的顺序是:周日,周一,周
- 二,周三,周四,周五,周六(1 为打开,0 为关闭),所以上面的意思是周一至周五打开上课禁
- 用。
- */
- public function getSILENCETIME2Commandinfo($param)
- {
- if (empty($param)) {
- throw new \Exception("SILENCETIME2参数错误");
- }
- $usedata = [];
- foreach ($param as $key => $value) {
- if (4 > count($value)) {
- throw new \Exception("SILENCETIME2参数错误");
- }
- $useweeks = ["0", "0", "0", "0", "0", "0", "0"];
- //未比较时间大小
- $starttime = $this->formattime($value['starttime'], 'H:i');
- $endtime = $this->formattime($value['endtime'], 'H:i');
- $isopen = $value['isopen'];
- $weeks = $value['weeks'];
- foreach ($weeks as $wkey => $wvalue) {
- if ($wvalue >= 1 && $wvalue <= 7) {
- $useweeks[$wvalue - 1] = '1';
- }
- }
- $useweeks = implode("", $useweeks);
- $usedata[] = $starttime . "-" . $endtime . "-" . $isopen . "-" . $useweeks;
- }
- $usedata = implode(",", $usedata);
- return $usedata;
- }
- /**
- * 睡眠时间段设置
- *{starttime=>'',endtime=>''}
- *
- * @return void
- * @author wj
- * @date 2023-08-21
- */
- public function getSLEEPTIMECommandinfo($param)
- {
- if (2 > count($param)) {
- throw new \Exception("SLEEPTIME参数错误");
- }
- $starttime = $this->formattime($param['starttime'], 'H:i');
- $endtime = $this->formattime($param['endtime'], 'H:i');
- $usedata = $starttime . "-" . $endtime;
- return $usedata;
- }
- public function formattime($time, $format)
- {
- $time = strtotime($time);
- $time = date($format, $time);
- return $time;
- }
- /**
- * unicode 编码
- *
- * @param [type] $str
- * @return void
- * @author wj
- * @date 2023-08-21
- */
- public function srtingToUnicode($str)
- {
- $unicode = '';
- $arr = mb_str_split($str); //适配中文
- foreach ($arr as $key => $value) {
- $char = bin2hex(iconv('UTF-8', 'UCS-2BE', $value));
- $char = str_pad($char, 4, '0', STR_PAD_LEFT);
- $arr[$key] = $char;
- }
- $unicode = implode("", $arr);
- return $unicode;
- }
- //设置 低电报警开关
- public function createlowbatcommand($facility_id, $device_id_code, $is_open, $sys_user_id)
- {
- $command = ['command' => 'LOWBAT', 'content_arr' => ['command' => 'LOWBAT', 'is_open' => $is_open]];
- $this->createsendmsg($facility_id, $device_id_code, $command, [], $sys_user_id);
- }
- //设置 跌倒报警开关
- public function createfalldowncommand($facility_id, $device_id_code, $param, $sys_user_id)
- {
- $command = ['command' => 'FALLDOWN', 'content_arr' => ['command' => 'FALLDOWN', 'is_open' => $param['is_open']]];
- $this->createsendmsg($facility_id, $device_id_code, $command, [], $sys_user_id);
- $lssetparam = [];
- switch ($param['lsset_type']) {
- case '1':
- $lssetparam = [3, 6];
- break;
- case '2':
- $lssetparam = [6, 9];
- break;
- case '3':
- $lssetparam = [9, 12];
- break;
- }
- $command = ['command' => 'LSSET', 'content_arr' => ['command' => 'LSSET']];
- $this->createsendmsg($facility_id, $device_id_code, $command, $lssetparam, $sys_user_id);
- }
- /**
- * 睡眠时间段设置
- *
- * @return void
- * @author wj
- * @date 2023-08-29
- */
- public function createsleeptimecommand($facility_id, $device_id_code, $param, $sys_user_id)
- {
- $command = ['command' => 'SLEEPTIME', 'content_arr' => ['command' => 'SLEEPTIME']];
- $this->createsendmsg($facility_id, $device_id_code, $command, $param, $sys_user_id);
- }
- /**
- * 立即定位
- *
- * @return void
- * @author wj
- * @date 2023-08-29
- */
- public function createcrcommand($facility_id, $device_id_code, $sys_user_id)
- {
- $command = ['command' => 'CR', 'content_arr' => ['command' => 'CR']];
- $this->createsendmsg($facility_id, $device_id_code, $command, [], $sys_user_id);
- }
- /**
- * 设置警报电话
- *
- * @param [type] $facility_id
- * @param [type] $device_id_code
- * @param [type] $param
- * @return void
- * @author wj
- * @date 2023-08-29
- */
- public function createsoscommand($facility_id, $device_id_code, $param, $sys_user_id)
- {
- $command = ['command' => 'SOS', 'content_arr' => ['command' => 'SOS']];
- $this->createsendmsg($facility_id, $device_id_code, $command, $param, $sys_user_id);
- }
- /**
- * 设置电话本
- *
- * @param [type] $arr
- * @return void
- * @author wj
- * @date 2023-08-29
- */
- public function createphlcommand($facility_id, $device_id_code, $param, $sys_user_id)
- {
- $command = ['command' => 'PHL', 'content_arr' => ['command' => 'PHL']];
- $this->createsendmsg($facility_id, $device_id_code, $command, $param, $sys_user_id);
- }
- //设备初始化
- public function facilityinit($facility_id, $device_id_code, $param, $sys_user_id)
- {
- $zone = $param['zone'];
- $upload_interval = $param['upload_interval'];
- $fd_is_open = $param['fd_is_open'];
- $lowbat_is_open = $param['lowbat_is_open'];
- $pedo_is_open = $param['pedo_is_open'];
- $remove_is_open = $param['remove_is_open'];
- $commandlist = [
- ['command' => 'ZONE', 'content_arr' => ['command' => 'ZONE', 'zone' => $zone]],
- ['command' => 'UPLOAD', 'content_arr' => ['command' => 'UPLOAD', 'interval' => $upload_interval]],
- ['command' => 'CR', 'content_arr' => ['command' => 'CR']],
- ['command' => 'FALLDOWN', 'content_arr' => ['command' => 'FALLDOWN', 'is_open' => $fd_is_open]],
- ['command' => 'VERNO', 'content_arr' => ['command' => 'VERNO']],
- ['command' => 'LOWBAT', 'content_arr' => ['command' => 'LOWBAT', 'is_open' => $lowbat_is_open]],
- ['command' => 'PEDO', 'content_arr' => ['command' => 'PEDO', 'is_open' => $pedo_is_open]],
- ['command' => 'REMOVE', 'content_arr' => ['command' => 'REMOVE', 'is_open' => $remove_is_open]],
- ];
- foreach ($commandlist as $key => $value) {
- $this->createsendmsg($facility_id, $device_id_code, $value, [], $sys_user_id);
- }
- }
- /**
- * 数据间隔设置
- * 位置 心率 体温 血压 血氧
- *
- * @return void
- * @author wj
- * @date 2023-09-01
- */
- public function setdatainterval($facility_id, $device_id_code, $param = [], $sys_user_id)
- {
- $cr_interval = $param['cr_interval'];
- $hrt_interval = $param['hrt_interval'];
- $wd_interval = $param['wd_interval'];
- $bld_interval = $param['bld_interval'];
- $ox_interval = $param['ox_interval'];
- $commandlist = [
- ['command' => 'UPLOAD', 'content_arr' => ['command' => 'UPLOAD', 'interval' => $cr_interval]],
- ['command' => 'HRTSTART', 'content_arr' => ['command' => 'HRTSTART', 'interval' => $hrt_interval]],
- ['command' => 'WDSTART', 'content_arr' => ['command' => 'WDSTART', 'interval' => $wd_interval]],
- ['command' => 'BLDSTART', 'content_arr' => ['command' => 'BLDSTART', 'interval' => $bld_interval]],
- ['command' => 'OXSTART', 'content_arr' => ['command' => 'OXSTART', 'interval' => $ox_interval]],
- ];
- foreach ($commandlist as $key => $value) {
- $this->createsendmsg($facility_id, $device_id_code, $value, $sys_user_id);
- }
- }
- /**
- * 关机
- *
- * @param [type] $facility_id
- * @param [type] $device_id_code
- * @param [type] $sys_user_id
- * @return void
- * @author wj
- * @date 2023-09-05
- */
- public function createpoweroffcommand($facility_id, $device_id_code, $sys_user_id)
- {
- $command = ['command' => 'POWEROFF', 'content_arr' => ['command' => 'POWEROFF']];
- $this->createsendmsg($facility_id, $device_id_code, $command, [], $sys_user_id);
- }
- /**
- * 计步开关
- *
- * @param [type] $facility_id
- * @param [type] $device_id_code
- * @param [type] $sys_user_id
- * @return void
- * @author wj
- * @date 2023-09-05
- */
- public function createpedocommand($facility_id, $device_id_code, $is_open, $sys_user_id)
- {
- $command = ['command' => 'PEDO', 'content_arr' => ['command' => 'PEDO', 'is_open' => $is_open]];
- $this->createsendmsg($facility_id, $device_id_code, $command, [], $sys_user_id);
- }
- /**
- * 闹钟
- *
- * @param [type] $facility_id
- * @param [type] $device_id_code
- * @param [type] $param
- * @param [type] $sys_user_id
- * @return void
- * @author wj
- * @date 2023-09-05
- */
- public function createremindcommand($facility_id, $device_id_code, $param, $sys_user_id)
- {
- $command = ['command' => 'REMIND', 'content_arr' => ['command' => 'REMIND']];
- $this->createsendmsg($facility_id, $device_id_code, $command, $param, $sys_user_id);
- }
- /**
- * 静默时间
- *
- * @param [type] $facility_id
- * @param [type] $device_id_code
- * @param [type] $param
- * @param [type] $sys_user_id
- * @return void
- * @author wj
- * @date 2023-09-05
- */
- public function createsilencetime2command($facility_id, $device_id_code, $param, $sys_user_id)
- {
- $command = ['command' => 'SILENCETIME2', 'content_arr' => ['command' => 'SILENCETIME2']];
- $this->createsendmsg($facility_id, $device_id_code, $command, $param, $sys_user_id);
- }
- /**
- * 开机关机时间
- *
- * @param [type] $facility_id
- * @param [type] $device_id_code
- * @param [type] $param
- * @param [type] $sys_user_id
- * @return void
- * @author wj
- * @date 2023-09-05
- */
- public function createbootoffcommand($facility_id, $device_id_code, $param, $sys_user_id)
- {
- $is_open = $param['is_open'];
- $bootup_time = $param['bootup_time'];
- $shutdown_time = $param['shutdown_time'];
- $command = [
- 'command' => 'BOOTOFF',
- 'content_arr' => ['command' => 'BOOTOFF', 'is_open' => $is_open, 'bootup_time' => $bootup_time, 'shutdown_time' => $shutdown_time],
- ];
- $this->createsendmsg($facility_id, $device_id_code, $command, [], $sys_user_id);
- }
- /**
- * 佩戴提醒
- *
- * @param [type] $facility_id
- * @param [type] $device_id_code
- * @param [type] $param
- * @param [type] $sys_user_id
- * @return void
- * @author wj
- * @date 2023-09-05
- */
- public function createremovecommand($facility_id, $device_id_code, $is_open, $sys_user_id)
- {
- $command = ['command' => 'REMOVE', 'content_arr' => ['command' => 'REMOVE', 'is_open' => $is_open]];
- $this->createsendmsg($facility_id, $device_id_code, $command, [], $sys_user_id);
- }
- }
|