Procházet zdrojové kódy

通风主界面接口测试

q před 1 rokem
rodič
revize
606f5017e6

+ 9 - 7
Modules/OpcData/Http/Controllers/Api/zaoquan/ZQDcsFanController.php

@@ -76,7 +76,7 @@ class ZQDcsFanController  extends BaseController
     public function getInfoList() {
 
         $keys=[
-            "2008319841133569_2", "2008298772323329_1" // 东井
+            "2008319841133569_2", "2008319841389569_2" // 东井
             ,"2009735056108545_2", "2009735056749569_2" // 西井
             ,"2009721035631617_2", "2009721047067649_2" // 1314立井
             ,"2074993339513857_2", "2074993343917057_2" // 13207机巷
@@ -92,7 +92,7 @@ class ZQDcsFanController  extends BaseController
         ];
 
         // 获取点位数据
-        // $dataFromGetRequest = $this->apiService->postPointRealData($this->apiUrl, $keys);
+        $baseData = $this->apiService->postPointRealData($this->apiUrl, $keys);
 
         // 获取风门数据
         // 自动风门 http://7.250.4.5:1434/zqk/api/AutomaticAirDoors/AutomaticAirDoor
@@ -110,8 +110,9 @@ class ZQDcsFanController  extends BaseController
 
          // 获取饼图数据(数据库)
          // cq.wind.online_chart
-        $data = "{'analysisSign': 'JSecf85ff100843272', 'analysisTime': '2022-11-21 08:40:08', 'circutCount': 104, 'diagonalCount': 42, 'balanceRatio': 1, 'holeArea': 4.83, 'returnRatio': 0.13, 'returnHf': 20356, 'richFactor': 1, 'airEffcient': 0, 'needTotalQuantity': 16052, 'needQuantity': 15052, 'totalQuantity': 17908, 'vaildWindRate': 0.89635915, 'dsr': 1.0664364}";
-        $data = str_replace("'", '"', $data);
+//        $data = "{'analysisSign': 'JSecf85ff100843272', 'analysisTime': '2022-11-21 08:40:08', 'circutCount': 104, 'diagonalCount': 42, 'balanceRatio': 1, 'holeArea': 4.83, 'returnRatio': 0.13, 'returnHf': 20356, 'richFactor': 1, 'airEffcient': 0, 'needTotalQuantity': 16052, 'needQuantity': 15052, 'totalQuantity': 17908, 'vaildWindRate': 0.89635915, 'dsr': 1.0664364}";
+        $data = $this->getDBDataFrom('data_websocket', "sys_type='cq.wind.online_chart'");
+        $data = str_replace("'", '"', $data['data']);
         $windData = json_decode($data, true);
 
         $info = [
@@ -124,7 +125,7 @@ class ZQDcsFanController  extends BaseController
                         ],
                         [
                             "name"=>"无效风",
-                            "value"=>1-round($windData['vaildWindRate'], 1)
+                            "value"=>round(1-$windData['vaildWindRate'], 1)
                         ]
                     ]
                 ]
@@ -169,7 +170,7 @@ class ZQDcsFanController  extends BaseController
                         ],
                         [
                             "label"=>"2#风机",
-                            "state"=>$baseData['2008298772323329_1'] ?? 0,
+                            "state"=>$baseData['2008319841389569_2'] ?? 0,
                             "text"=>"运行"
                         ]
                     ]
@@ -2575,8 +2576,9 @@ class ZQDcsFanController  extends BaseController
 
     public function getDBDataFrom($tb_name, $where='') {
         // 构建 SQL 查询
-        $sqlStr = "select * from $tb_name";
+        $sqlStr = "select * from {$tb_name} where ({$where})";
         $res = $this->executeSql($sqlStr, 3);
+        return $res;
     }
 
     public function executeSql($sqlStr, $modelname = -1) {