/**
  * 大屏滚动性能指标信息
  * @return string
  */
 public static function getLastPreDatas()
 {
     $ips = DeviceIpfilter::getIdsByType(ViewTemplate::TYPE_BUILD);
     $rows = (new Query())->from("device_task_summary a")->innerJoin("device_info b", "a.devId = b.id")->where(["b.ip" => $ips])->select(["id" => "a.devId", "label" => "b.label", "ip" => "b.ip", "key" => "a.taskName", "value" => "a.currentValue"])->groupBy("a.devId,a.taskId")->orderBy("a.devId asc,a.instId desc")->all();
     $data = [];
     foreach ($rows as $row) {
         $deviceId = $row["id"];
         if (!isset($data[$deviceId])) {
             $data[$deviceId] = [];
             $data[$deviceId][] = $row["label"] . '(' . $row["ip"] . ')';
         }
         $data[$deviceId][] = [$row["key"], $row["value"]];
     }
     $html = [];
     foreach ($data as $id => $item) {
         $table = [];
         $table[] = '<table>';
         $table[] = '<tr><th colspan="2">' . $item[0] . '</th></tr>';
         foreach ($item as $i => $d) {
             if ($i == 0) {
                 continue;
             }
             $table[] = '<tr><th>' . $d[0] . '</th><td>' . $d[1] . '</td></tr>';
         }
         $table[] = '</table>';
         $html[] = implode("\n", $table);
     }
     //return implode('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',$html);
     return '<li>' . implode('</li><li>', $html) . '</li>';
 }
 /**
  * Lists all DeviceInfo models.
  * @return mixed
  */
 public function actionIndex()
 {
     $ips = DeviceInfo::find()->where(["categoryId" => "1001"])->select("ip")->column();
     $ips = array_merge($ips, DeviceIpfilter::getIdsByType(DeviceIpfilter::TYPE_POLYMER));
     $searchModel = new DeviceInfoSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $ips);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
 public static function getDeviceList()
 {
     $result = [];
     $filterIps = DeviceIpfilter::getIdsByType(DeviceIpfilter::TYPE_WLAN);
     $rows = self::find()->with("category")->where(["ip" => $filterIps])->orderBy("ip asc")->asArray()->all();
     foreach ($rows as $row) {
         $type = $row["category"]["node_group"];
         if (!isset($result[$type])) {
             $result[$type] = [];
         }
         $result[$type][] = ["id" => $row["id"], "label" => $row["ip"]];
     }
     return $result;
 }