public function index()
 {
     $db = M("CensorWord");
     if (IS_POST) {
         $delete = $_POST['delete'];
         //敏感词
         $find = $_POST['find'];
         //不良词语类型
         $replacement = $_POST['replacement'];
         //分类
         $type = $_POST['type'];
         //替换内容
         $replacontent = $_POST['replacontent'];
         if (is_array($delete)) {
             foreach ($delete as $id) {
                 $db->where(array("id" => $id))->delete();
                 unset($find[$id], $replacement[$id], $type[$id], $replacontent[$id]);
             }
         }
         if (is_array($find)) {
             foreach ($find as $id => $ti) {
                 $data = array();
                 if ($replacement[$id] == '{REPLACE}') {
                     $data['replacement'] = $replacontent[$id];
                 } else {
                     $data['replacement'] = $replacement[$id];
                 }
                 $data['type'] = $type[$id];
                 $data['find'] = $find[$id];
                 $db->where(array("id" => $id))->data($data)->save();
             }
         }
         //缓存更新
         import('Cacheapi');
         $Cache = new Cacheapi();
         $Cache->censorword_cache();
         $this->success("操作成功!");
     } else {
         $where = array();
         if (isset($_GET['search'])) {
             $type = (int) $this->_get("type");
             if ($type) {
                 $where['type'] = array("EQ", $type);
             }
             $keyword = $this->_get("keyword");
             if ($keyword) {
                 $where['find'] = array("LIKE", "%{$keyword}%");
                 $this->assign("keyword", $keyword);
             }
         }
         $count = $db->where($where)->count();
         $page = $this->page($count, 20);
         $data = $db->where($where)->limit($page->firstRow . ',' . $page->listRows)->order(array("id" => "DESC"))->select();
         $this->assign("Page", $page->show('Admin'));
         $this->assign("data", $data);
         $this->display();
     }
 }