wang jun 1 year ago
parent
commit
bb18784f59

+ 9 - 4
application/api/logic/Shouhuanlogic.php

@@ -66,15 +66,20 @@ class Shouhuanlogic
      * @return void
      * @author wj
      * @date 2023-08-29
+     * lsset_type 灵敏度类型 1高 2中 3低
      */
     public function createfalldowncommand($facility_id, $device_id_code, $param, $sys_user_id)
     {
-        if (!isset($param['is_open'])) {
+        if (!isset($param['is_open']) || !isset($param['lsset_type'])) {
             throw new \Exception("参数错误");
         }
-        $is_open = empty($param['is_open']) ? 0 : 1;
+        $lsset_type = [1, 2, 3];
+        if (!in_array($param['lsset_type'], $lsset_type)) {
+            $param['lsset_type'] = 1;
+        }
+        $param['is_open'] = empty($param['is_open']) ? 0 : 1;
         $s_sc = new ShouhuanCommand();
-        $s_sc->createfalldowncommand($facility_id, $device_id_code, $is_open, $sys_user_id);
+        $s_sc->createfalldowncommand($facility_id, $device_id_code, $param, $sys_user_id);
         return backarr(1, "操作成功");
     }
     //['starttime'=>'21:00','endtime'=>'6:00'];
@@ -113,7 +118,7 @@ class Shouhuanlogic
      */
     public function createsoscommand($facility_id, $device_id_code, $data, $sys_user_id)
     {
-        if (!isset($param['tels'])) {
+        if (!isset($data['tels'])) {
             throw new \Exception("参数错误");
         }
         $param = $data['tels'];

+ 4 - 2
application/common/middleware/checkfacility.php

@@ -4,6 +4,7 @@ namespace app\common\middleware;
 
 use app\common\model\FacilityModel;
 use app\common\model\Sysusermodel;
+use think\facade\Log;
 
 class checkfacility
 {
@@ -13,9 +14,10 @@ class checkfacility
             return backjson3(500, "请求错误");
         }
         $param = $request->post();
-        $token = request()->header('token');
-
+        $token = request()->header('authorization');
+        Log::info($token);
         $suinfo = $this->checktoken($token);
+        Log::info($suinfo);
         if (empty($suinfo)) {
             return backjson3(401, "认证失败,无法访问系统资源");
         }

+ 18 - 3
application/common/server/ShouhuanCommand.php

@@ -80,7 +80,7 @@ class ShouhuanCommand
         if ('send' == $config['kind']) {
             $content = $config['content'];
             $useconmmand = $content['command'];
-            $content_custom = isset($config['content_custom']) ? $config['content_custom'] : false;
+            $content_custom = isset($content['content_custom']) ? $content['content_custom'] : false;
             $need_back = $config['need_back'];
             if ($content_custom) {
                 $functionname = 'get' . $command . "Commandinfo";
@@ -675,10 +675,25 @@ class ShouhuanCommand
         $this->createsendmsg($facility_id, $device_id_code, $command, [], $sys_user_id);
     }
     //设置 跌倒报警开关
-    public function createfalldowncommand($facility_id, $device_id_code, $is_open, $sys_user_id)
+    public function createfalldowncommand($facility_id, $device_id_code, $param, $sys_user_id)
     {
-        $command = ['command' => 'FALLDOWN', 'content_arr' => ['command' => 'FALLDOWN', 'is_open' => $is_open]];
+        $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);
+
     }
     /**
      * 睡眠时间段设置