|
|
@ -16,7 +16,7 @@ class infofix extends CI_Controller
|
|
|
|
function list_info_by_keys($site = '', $keys = [])
|
|
|
|
function list_info_by_keys($site = '', $keys = [])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$site = 'cht';
|
|
|
|
$site = 'cht';
|
|
|
|
$keys = ['test', 'china-hi'];
|
|
|
|
$keys = ['/beijing/', '/yangshuo/'];
|
|
|
|
|
|
|
|
|
|
|
|
// 容错
|
|
|
|
// 容错
|
|
|
|
if (empty($site) || empty($keys)) {
|
|
|
|
if (empty($site) || empty($keys)) {
|
|
|
@ -27,8 +27,18 @@ class infofix extends CI_Controller
|
|
|
|
);
|
|
|
|
);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$rs = $this->Information_model->list_by_keywords($site, $keys);
|
|
|
|
|
|
|
|
foreach ($rs as $info) {
|
|
|
|
|
|
|
|
$keycount = array();
|
|
|
|
|
|
|
|
foreach ($keys as $key) {
|
|
|
|
|
|
|
|
$pos1 = stripos($info->ic_url, $key);
|
|
|
|
|
|
|
|
$pos2 = stripos($info->ic_content, $key);
|
|
|
|
|
|
|
|
array_push($keycount, array('key' => $key, 'pos1' => $pos1, 'pos2' => $pos2));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$info->ic_content = $keycount;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
echo json_encode($this->Information_model->list_by_keywords($site, $keys));
|
|
|
|
echo json_encode($rs);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|