/**
  * Creates a new DcmdGroup 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->user->getIdentity()->sa != 1) {
         Yii::$app->getSession()->setFlash('success', NULL);
         Yii::$app->getSession()->setFlash('error', "Sorry, You don't have priority!");
         return $this->redirect(array('index'));
     }
     $model = new DcmdGroup();
     if (Yii::$app->request->post()) {
         $model->utime = date('Y-m-d H:i:s');
         $model->ctime = $model->utime;
         $model->opr_uid = Yii::$app->user->getId();
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
             $this->oprlog(1, "insert group:" . $model->gname);
             Yii::$app->getSession()->setFlash('success', '添加成功!');
             return $this->redirect(['view', 'id' => $model->gid]);
         }
         $err_str = "";
         foreach ($model->getErrors() as $k => $v) {
             $err_str .= $k . ":" . $v[0] . "<br>";
         }
         Yii::$app->getSession()->setFlash('error', "添加失败:" . $err_str);
     }
     return $this->render('create', ['model' => $model]);
 }