/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = DeviceTaskSummary::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'taskId' => $this->taskId, 'devId' => $this->devId, 'instId' => $this->instId]); $query->andFilterWhere(['like', 'taskName', $this->taskName])->andFilterWhere(['like', 'objIndex', $this->objIndex])->andFilterWhere(['like', 'objIndexDesc', $this->objIndexDesc])->andFilterWhere(['like', 'averageValue', $this->averageValue])->andFilterWhere(['like', 'maximumValue', $this->maximumValue])->andFilterWhere(['like', 'minimumValue', $this->minimumValue])->andFilterWhere(['like', 'currentValue', $this->currentValue])->andFilterWhere(['like', 'summaryValue', $this->summaryValue]); return $dataProvider; }
public function getRightOutSpeed() { $data = DeviceTaskSummary::find()->where(["devId" => $this->rightDevice, "taskId" => 5])->orderBy("instId desc")->select("currentValue")->asArray()->scalar(); return $this->bpsToKbps($data); }
/** * 设备提示信息 * @param $deviceId * @return string */ protected function getTip($deviceId) { $this->layout = false; $device = DeviceInfo::find()->with(["type", "model"])->where(["id" => $deviceId])->one(); if (!$device) { return "设备未找到"; } $deviceConfig = ArrayHelper::map(InfoConfig::getTipConfig(1), "key", "value"); $perfConfig = ArrayHelper::map(InfoConfig::getTipConfig(2), "key", "value"); $perfData = DeviceTaskSummary::find()->where(["taskId" => array_values($perfConfig), "devId" => $deviceId])->select(["taskId", "currentValue"])->groupBy("taskId")->asArray()->all(); $perfData = ArrayHelper::map($perfData, "taskId", "currentValue"); return $this->render("tip", ["model" => $device, "deviceConfig" => $deviceConfig, "perfConfig" => $perfConfig, "perfData" => $perfData]); }
/** * 大厦滚动性能信息 */ public function actionGetMarqueeData() { return DeviceTaskSummary::getLastPreDatas(); }