/**
  * Creates a new DcmdOprCmdArg model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new DcmdOprCmdArg();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new DcmdOprCmdArg model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($opr_cmd_id)
 {
     if (Yii::$app->user->getIdentity()->admin != 1) {
         Yii::$app->getSession()->setFlash('success', NULL);
         Yii::$app->getSession()->setFlash('error', "对不起,你没有权限!");
         return $this->redirect(['dcmd-opr-cmd/view', 'id' => $opr_cmd_id]);
     }
     $opr = DcmdOprCmd::findOne($opr_cmd_id);
     $model = new DcmdOprCmdArg();
     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();
         $model->opr_cmd_id = $opr_cmd_id;
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->getSession()->setFlash('success', '添加成功!');
         return $this->redirect(['dcmd-opr-cmd/view', 'id' => $opr_cmd_id]);
     } else {
         return $this->render('create', ['model' => $model, 'opr' => $opr]);
     }
 }