/**
  * Displays a single DcmdService model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     ///$query = DcmdServicePool::find()->andWhere(['svr_id'=>$id]);
     $searchModel = new DcmdServicePoolSearch();
     $con = array();
     $con['DcmdServicePoolSearch'] = array('svr_id' => $id);
     if (array_key_exists('DcmdServicePoolSearch', Yii::$app->request->queryParams)) {
         $con = array_merge($con, Yii::$app->request->queryParams);
     }
     $con['DcmdServicePoolSearch']['svr_id'] = $id;
     $dataProvider = $searchModel->search($con);
     ///处理图片
     $service = DcmdService::findOne($id);
     $base_path = dirname(__DIR__) . "/web/app_image/";
     $query = DcmdServiceArchDiagram::find()->andWhere(['svr_id' => $id, 'app_id' => $service->app_id])->asArray()->all();
     foreach ($query as $item) {
         $img_path = $base_path . "svr_" . $item['arch_name'] . '_' . $item['svr_id'] . '.jpg';
         if (file_exists($img_path)) {
             continue;
         }
         $fp = fopen($img_path, 'wb') or die("Open file {$img_path} fail!");
         fwrite($fp, stripslashes($item['diagram']));
         fclose($fp);
     }
     $imageSearch = new DcmdServiceArchDiagramSearch();
     $imageProvider = $imageSearch->search(array('DcmdServiceArchDiagramSearch' => array('app_id' => $service->app_id, 'svr_id' => $id)));
     ///获取任务模版列表
     $tmpt_searchModel = new DcmdTaskTemplateSearch();
     $params["DcmdTaskTemplateSearch"]["svr_id"] = $id;
     $taskTemptDataProvider = $tmpt_searchModel->search($params, 1000);
     return $this->render('view', ['model' => $this->findModel($id), 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'imageProvider' => $imageProvider, 'taskTemptDataProvider' => $taskTemptDataProvider]);
 }
 /**
  * Lists all DcmdServiceArchDiagram models.
  * @return mixed
  */
 private function actionIndex()
 {
     $searchModel = new DcmdServiceArchDiagramSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }