From addfb5118561793cff4fe6c136f0df93791d1450 Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Thu, 16 Nov 2023 15:06:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BF=9D=E7=95=99=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/recommend/controllers/index.php | 1 + .../third_party/recommend/models/infoTips_model.php | 10 +++++----- application/third_party/recommend/views/welcome.php | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) 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 @@