Пример #1
0
 /**
  * 添加敏感词
  * @date: 2016-1-14
  * @author: futao
  */
 public function keywordaddAction()
 {
     $this->setLeftNav("keywordadd");
     $req = $this->request;
     if (!$req->isPost()) {
         $this->view->pick('question/keywordedit');
         return;
     }
     $this->view->disable();
     $echo = function ($msg, $state = false) {
         echo '<script type="text/javascript">';
         echo 'parent.formResult("' . $msg . '", ' . ($state ? 1 : 0) . ')';
         echo '</script>';
     };
     $title = $req->getPost("keyword", null, '');
     if ($title != '') {
         $hotModel = new CosQKeyword();
         $hotModel->keyword = $title;
         if ($hotModel->save()) {
             $echo('添加成功!', true);
         } else {
             $echo("添加失败!");
         }
     } else {
         $echo("添加失败!");
     }
 }