|
|
@ -56,20 +56,20 @@ class infoTips_model extends CI_Model
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// keyword 可以是标题或者 URL,使用空格分开
|
|
|
|
|
|
|
|
public function search($keywords, $byWhat) {
|
|
|
|
public function search($keywords, $byWhat) {
|
|
|
|
|
|
|
|
$whereCodition = '';
|
|
|
|
if ($byWhat == 'byTitle') {
|
|
|
|
if ($byWhat == 'byTitle') {
|
|
|
|
$whereCodition .= " and it.it_title like '%" . $keyword . "%'";
|
|
|
|
$whereCodition .= " and it.it_title like '%" . $keywords . "%'";
|
|
|
|
} else if ($byWhat == 'byLabel') {
|
|
|
|
} else if ($byWhat == 'byLabel') {
|
|
|
|
$whereCodition .= " and it.it_code like '%" . $keyword . "%'";
|
|
|
|
$whereCodition .= " and it.it_code like '%" . $keywords . "%'";
|
|
|
|
} else if ($byWhat == 'byContent') {
|
|
|
|
} else if ($byWhat == 'byContent') {
|
|
|
|
$whereCodition .= " and it.it_content like '%" . $keyword . "%'";
|
|
|
|
$whereCodition .= " and it.it_content like '%" . $keywords . "%'";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$searchText =
|
|
|
|
$searchText =
|
|
|
|
"select it.it_id ,it.it_title,it.it_expires,it.it_code,it.it_content,it.it_sitecode,it.it_datetime
|
|
|
|
"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
|
|
|
|
from infoTips it
|
|
|
|
where it.it_sitecode=?"
|
|
|
|
where it.it_sitecode=?"
|
|
|
|
. $whereCodition . ") "
|
|
|
|
. $whereCodition
|
|
|
|
. " order by it_expires ASC";
|
|
|
|
. " order by it_expires ASC";
|
|
|
|
$query = $this->HT->query($searchText, array($this->config->item('site_code')));
|
|
|
|
$query = $this->HT->query($searchText, array($this->config->item('site_code')));
|
|
|
|
return $query->result();
|
|
|
|
return $query->result();
|
|
|
|