/**
  * Deletes an existing DcmdTaskTemplate model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id, $svr_id = 0)
 {
     ////只有管理员可操作
     if (Yii::$app->user->getIdentity()->admin != 1) {
         Yii::$app->getSession()->setFlash('success', NULL);
         Yii::$app->getSession()->setFlash('error', "对不起,你没有权限!");
         return $this->redirect(array('dcmd-task-template/index'));
     }
     DcmdTaskTemplateServicePool::deleteAll('task_tmpt_id = ' . $id);
     $model = $this->findModel($id);
     $this->oprlog(3, "delete task template:" . $model->task_tmpt_name);
     $model->delete();
     Yii::$app->getSession()->setFlash('success', '删除成功!');
     if ($svr_id == 0) {
         return $this->redirect(['index']);
     } else {
         return $this->redirect(array('dcmd-service/view', 'id' => $svr_id));
     }
 }