/** * 添加搜索热词 * @date: 2016-1-14 * @author: futao */ public function hotaddAction() { $this->setLeftNav("hotadd"); $req = $this->request; if (!$req->isPost()) { $this->view->pick('question/hotedit'); 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("title", null, ''); if ($title != '') { $hotModel = new QuestionHotWords(); $hotModel->title = $title; $hotModel->status = 1; if ($hotModel->save()) { $echo('添加成功!', true); } else { $echo("添加失败!"); } } else { $echo("添加失败!"); } }