/** * 有线网络新的状态更新服务 * * * @return [String] json string */ public function actionAjaxWlanRefresh() { $nodes = TopologyConfig::getWlanLinkStatus(); $links = TopologyConfig::getWlanNodeStatus(); $data = array_merge($nodes, $links); return json_encode($data); }
/** * 有线拓扑 根据nodeId 获取设备TIP */ public function actionAjaxNodeTip() { $nodeId = Yii::$app->request->get("id"); $row = TopologyConfig::find()->where(["id" => $nodeId])->select("device1,device2,type_id")->one(); switch ($row["type_id"]) { case 1: $id = DeviceInfo::find()->where(["ip" => $row["device1"]])->select("id")->scalar(); return $this->getTip($id); case 2: $ids = DeviceInfo::find()->where(["ip" => [$row["device1"], $row["device2"]]])->select("id")->column(); if (count($ids) == 2) { return $this->getLinkTip($ids[0], $ids[1]); } default: return '参数错误'; } }