master
LMR 1 year ago
parent 29218c5c9d
commit d3fc334525

@ -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 = ['/beijing/', '/yangshuo/']; $keys = ['/beijing/', '/shanghai/'];
// 容错 // 容错
if (empty($site) || empty($keys)) { if (empty($site) || empty($keys)) {
@ -33,9 +33,16 @@ class infofix extends CI_Controller
foreach ($keys as $key) { foreach ($keys as $key) {
$pos_url = stripos($info->ic_url, $key); $pos_url = stripos($info->ic_url, $key);
$sub_url = $info->ic_url == $key ? $info->ic_url : ''; $sub_url = $info->ic_url == $key ? $info->ic_url : '';
$pos_content = 0;
$pos_content = stripos($info->ic_content, $key); $pos_content = stripos($info->ic_content, $key);
$sub_content = '[...' . substr($info->ic_content, $pos_content - 20, strlen($key) + 20 * 2) . '...]'; $sub_content = array();
if ($pos_url !== false || $pos_content !== false) { while ($pos_content) {
array_push($sub_content, '[...' . substr($info->ic_content, $pos_content - 20, strlen($key) + 20 * 2) . '...]');
$pos_content = stripos($info->ic_content, $key, $pos_content + strlen($key));
}
if ($sub_url != '' || count($sub_content) != 0) {
array_push($keycount, array('key' => $key, 'sub_url' => $sub_url, 'sub_content' => $sub_content)); array_push($keycount, array('key' => $key, 'sub_url' => $sub_url, 'sub_content' => $sub_content));
} }
} }

@ -797,7 +797,7 @@ class Information_model extends CI_Model
} }
$search = ' AND (1=0 ' . $keysql . ')'; $search = ' AND (1=0 ' . $keysql . ')';
$sql = " $sql = "
SELECT TOP 10 ic_id, ic_url, ic_content SELECT ic_id, ic_url, ic_content
FROM infoStructures is1 FROM infoStructures is1
INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id
AND ic.ic_sitecode = is1.is_sitecode AND ic.ic_sitecode = is1.is_sitecode

Loading…
Cancel
Save