assign('list', SearchModel::getAll()); return $this->fetch(); } public function save($name = '') { if (!$name) return Json::fail('请输入热词名称'); if ($res = SearchModel::saveSearch($name)) return Json::successful('添加成功', $res); else return Json::fail(SearchModel::getErrorInfo('添加失败')); } public function del_search($id = 0) { if (!$id) return Json::fail('缺少参数'); if (SearchModel::del($id)) return Json::successful('删除成功'); else return Json::fail('删除失败'); } }