diff --git a/application/third_party/recommend/controllers/index.php b/application/third_party/recommend/controllers/index.php index 1e522d1a..27c0e89b 100644 --- a/application/third_party/recommend/controllers/index.php +++ b/application/third_party/recommend/controllers/index.php @@ -35,6 +35,7 @@ class Index extends CI_Controller $data = array(); $data['groupList'] = $this->Information_model->group_list(); $data['tipsList'] = $this->infoTips_model->search($keywords, $byWhat); + $data['keywords'] = $keywords; $this->load->view('bootstrap3/header', $data); $this->load->view('welcome'); $this->load->view('bootstrap3/footer'); diff --git a/application/third_party/recommend/models/infoTips_model.php b/application/third_party/recommend/models/infoTips_model.php index 8e2b01fe..7e5c2e68 100644 --- a/application/third_party/recommend/models/infoTips_model.php +++ b/application/third_party/recommend/models/infoTips_model.php @@ -56,20 +56,20 @@ class infoTips_model extends CI_Model } } - // keyword 可以是标题或者 URL,使用空格分开 public function search($keywords, $byWhat) { + $whereCodition = ''; if ($byWhat == 'byTitle') { - $whereCodition .= " and it.it_title like '%" . $keyword . "%'"; + $whereCodition .= " and it.it_title like '%" . $keywords . "%'"; } else if ($byWhat == 'byLabel') { - $whereCodition .= " and it.it_code like '%" . $keyword . "%'"; + $whereCodition .= " and it.it_code like '%" . $keywords . "%'"; } else if ($byWhat == 'byContent') { - $whereCodition .= " and it.it_content like '%" . $keyword . "%'"; + $whereCodition .= " and it.it_content like '%" . $keywords . "%'"; } $searchText = "select it.it_id ,it.it_title,it.it_expires,it.it_code,it.it_content,it.it_sitecode,it.it_datetime from infoTips it where it.it_sitecode=?" - . $whereCodition . ") " + . $whereCodition . " order by it_expires ASC"; $query = $this->HT->query($searchText, array($this->config->item('site_code'))); return $query->result(); diff --git a/application/third_party/recommend/views/welcome.php b/application/third_party/recommend/views/welcome.php index 75c4f11e..2bdb8963 100644 --- a/application/third_party/recommend/views/welcome.php +++ b/application/third_party/recommend/views/welcome.php @@ -8,7 +8,7 @@