/**
  * Creates a new DcmdServicePoolAttrDef model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     if (Yii::$app->user->getIdentity()->admin != 1) {
         Yii::$app->getSession()->setFlash('success', NULL);
         Yii::$app->getSession()->setFlash('error', "对不起, 你没有权限!");
         return $this->redirect(array('index'));
     }
     $model = new DcmdServicePoolAttrDef();
     if (Yii::$app->request->post()) {
         $model->ctime = date('Y-m-d H:i:s');
         $model->opr_uid = Yii::$app->user->getId();
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
             Yii::$app->getSession()->setFlash('success', "添加成功");
             return $this->redirect(['view', 'id' => $model->attr_id]);
         }
         Yii::$app->getSession()->setFlash('error', "添加失败");
     }
     return $this->render('create', ['model' => $model]);
 }