master
LMR 11 months ago
parent 70863b5191
commit e426e417de

@ -34,7 +34,7 @@ class infofix extends CI_Controller {
empty($keys) ||
mb_stripos($keys, '/') === false
) {
echo json_encode(array());
echo json_encode([]);
return false;
}
@ -43,7 +43,7 @@ class infofix extends CI_Controller {
// 调整数据
foreach ($rs as $info) {
$key_with_content = array();
$key_with_content = [];
foreach ($key_arr as $key) {
// 链接
@ -53,11 +53,18 @@ class infofix extends CI_Controller {
$sub_url = explode('@@@', $sub_url);
}
// 图片
$sub_ic_photo = mb_stripos($info->ic_photo, $key) !== false ? $info->ic_photo : '';
if ($sub_ic_photo) {
$sub_ic_photo = str_replace($key, '@@@' . $key . '@@@', $sub_ic_photo);
$sub_ic_photo = explode('@@@', $sub_ic_photo);
}
$limitStr = 100;
// 信息内容
$pos_content = 0;
$pos_content = mb_stripos($info->ic_content, $key);
$sub_content = array();
$sub_content = [];
while ($pos_content) {
$_str = '[...' . mb_substr($info->ic_content, $pos_content - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
$_str = str_replace($key, '@@@' . $key . '@@@', $_str);
@ -67,43 +74,44 @@ class infofix extends CI_Controller {
}
// amp_json
$sub_content2 = array();
if ($info->amp_json) {
$pos_content2 = 0;
$pos_content2 = mb_stripos($info->amp_json, $key);
while ($pos_content2) {
$_str = '[...' . mb_substr($info->amp_json, $pos_content2 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
$_str = str_replace($key, '@@@' . $key . '@@@', $_str);
$_str = explode('@@@', $_str);
array_push($sub_content2, $_str);
$pos_content2 = mb_stripos($info->amp_json, $key, $pos_content2 + mb_strlen($key));
}
}
$sub_content2 = [];
// if ($info->amp_json) {
// $pos_content2 = 0;
// $pos_content2 = mb_stripos($info->amp_json, $key);
// while ($pos_content2) {
// $_str = '[...' . mb_substr($info->amp_json, $pos_content2 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
// $_str = str_replace($key, '@@@' . $key . '@@@', $_str);
// $_str = explode('@@@', $_str);
// array_push($sub_content2, $_str);
// $pos_content2 = mb_stripos($info->amp_json, $key, $pos_content2 + mb_strlen($key));
// }
// }
// amp_body
$sub_content3 = array();
if ($info->amp_body) {
$pos_content3 = 0;
$pos_content3 = mb_stripos($info->amp_body, $key);
while ($pos_content3) {
$_str = '[...' . mb_substr($info->amp_body, $pos_content3 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
$_str = str_replace($key, '@@@' . $key . '@@@', $_str);
$_str = explode('@@@', $_str);
array_push($sub_content3, $_str);
$pos_content3 = mb_stripos($info->amp_body, $key, $pos_content3 + mb_strlen($key));
}
}
$sub_content3 = [];
// if ($info->amp_body) {
// $pos_content3 = 0;
// $pos_content3 = mb_stripos($info->amp_body, $key);
// while ($pos_content3) {
// $_str = '[...' . mb_substr($info->amp_body, $pos_content3 - $limitStr, mb_strlen($key) + $limitStr * 2) . '...]';
// $_str = str_replace($key, '@@@' . $key . '@@@', $_str);
// $_str = explode('@@@', $_str);
// array_push($sub_content3, $_str);
// $pos_content3 = mb_stripos($info->amp_body, $key, $pos_content3 + mb_strlen($key));
// }
// }
if ($sub_url != '' || count($sub_content) != 0 || count($sub_content2) != 0 || count($sub_content3) != 0) {
array_push(
$key_with_content,
array(
[
'key' => $key,
'sub_url' => $sub_url,
'sub_ic_photo' => $sub_ic_photo,
'sub_content' => $sub_content,
'sub_json' => $sub_content2,
'sub_body' => $sub_content3,
)
]
);
}
}
@ -138,7 +146,7 @@ class infofix extends CI_Controller {
mb_stripos($keys, '@@') !== false ||
mb_stripos($keys, '@ @') !== false
) {
echo json_encode(array('err' => '容错1'));
echo json_encode(['err' => '容错1']);
return false;
}
@ -157,7 +165,7 @@ class infofix extends CI_Controller {
mb_stripos($newStr, '/') === false ||
mb_stripos($oldStr, '/') === false
) {
echo json_encode(array('err' => '容错2'));
echo json_encode(['err' => '容错2']);
return false;
}
@ -198,21 +206,21 @@ class infofix extends CI_Controller {
$use = $this->infoMetas_model->get($ic_id, 'AMP_BODY_PC_STATUS');
if ($ic) {
echo json_encode(
array(
[
'state' => 0,
'ic_url' => $ic->ic_url,
'ic_sitecode' => $ic->ic_sitecode,
'ic_content' => $ic->ic_content,
'pc_use' => $use,
'json' => array(), //$json,
)
'json' => [], //$json,
]
);
} else {
echo json_encode(
array(
[
'state' => -1,
'msg' => 'not content by ' . $ic_id,
)
]
);
}
}
@ -233,7 +241,7 @@ class infofix extends CI_Controller {
}
$rs = $this->infoContents_model->force_update($ic_id, $ic_content);
echo json_encode(array('status' => 1));
echo json_encode(['status' => 1]);
}
/**
@ -244,9 +252,9 @@ class infofix extends CI_Controller {
$is = $this->infoContents_model->get_isid_by_icid($ic_id);
if (isset($is->is_id)) {
echo json_encode(array('status' => 1, 'isid' => $is->is_id));
echo json_encode(['status' => 1, 'isid' => $is->is_id]);
} else {
echo json_encode(array('status' => 0, 'isid' => $is->$ic_id));
echo json_encode(['status' => 0, 'isid' => $is->$ic_id]);
}
}
@ -259,13 +267,13 @@ class infofix extends CI_Controller {
$api = $this->input->get('api');
$rs = $this->infoContents_model->list_use_hb($site);
if ($api) {
$_rs = array();
$_rs = [];
foreach ($rs as $value) {
array_push($_rs, array(
array_push($_rs, [
'id' => $value->ic_id,
'data' => $value->ic_url,
'status' => 0,
));
]);
}
$rs = $_rs;
}
@ -308,7 +316,7 @@ class infofix extends CI_Controller {
$this->logs_model->backup($is->is_id, $ic->ic_content);
}
// 移除外部包裹标签
$curl_rs = str_replace(array('<my_lmr_tpl>', '</my_lmr_tpl>'), '', $curl_rs);
$curl_rs = str_replace(['<my_lmr_tpl>', '</my_lmr_tpl>'], '', $curl_rs);
//cdn域名替换res
$curl_rs = str_replace('//cdn.chinahighlights.ru', '//res.chinahighlights.ru', $curl_rs);
$curl_rs = str_replace('//cdn.arachina.com', '//res.arachina.com', $curl_rs);
@ -319,12 +327,12 @@ class infofix extends CI_Controller {
// 强制更新信息内容
$this->infoContents_model->force_update($ic_id, $curl_rs);
echo json_encode(array('status' => 1));
echo json_encode(['status' => 1]);
} else {
echo json_encode(array('status' => -1, 'msg' => 'err1'));
echo json_encode(['status' => -1, 'msg' => 'err1']);
}
} else {
echo json_encode(array('status' => -1, 'msg' => 'err2'));
echo json_encode(['status' => -1, 'msg' => 'err2']);
}
}

@ -1,7 +1,6 @@
<?php
class Information_model extends CI_Model
{
class Information_model extends CI_Model {
var $topNum = false;
var $orderBy = false;
@ -18,15 +17,13 @@ class Information_model extends CI_Model
var $ic_type = false;
var $ic_id = false;
function __construct()
{
function __construct() {
parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE);
$this->HT229 = $this->load->database('HT', TRUE);
}
function init()
{
function init() {
$this->topNum = false;
$this->orderBy = " ORDER BY ic_datetime DESC ";
$this->search_title = false;
@ -42,15 +39,13 @@ class Information_model extends CI_Model
$this->ic_id = false;
}
function get_last_edit_list($topNum = 24)
{
function get_last_edit_list($topNum = 24) {
$this->init();
$this->topNum = $topNum;
return $this->GetList();
}
function search($keyword)
{
function search($keyword) {
$this->init();
$this->topNum = 48;
if (is_numeric($keyword)) {
@ -62,8 +57,7 @@ class Information_model extends CI_Model
return $this->GetList();
}
function search_all_text($keyword, $topnum = 24)
{
function search_all_text($keyword, $topnum = 24) {
$this->init();
$this->topNum = $topnum;
$sql_keyword = '%' . $this->HT->escape_like_str($keyword) . '%';
@ -75,8 +69,7 @@ class Information_model extends CI_Model
}
//根据关键词来搜索内容
function search_by_words($url, array $words, $exclude_ids)
{
function search_by_words($url, array $words, $exclude_ids) {
$this->init();
$this->topNum = 1;
$sql_keyword = ' AND ( 1=1 ';
@ -90,8 +83,7 @@ class Information_model extends CI_Model
}
//在当前节点下搜索关键词
function search_by_words_2($path, array $words, $exclude_ids)
{
function search_by_words_2($path, array $words, $exclude_ids) {
$this->init();
$this->topNum = 1;
$sql_keyword = ' AND ( 1=1 ';
@ -106,8 +98,7 @@ class Information_model extends CI_Model
}
//在同级别下随机获取N条数据并且排除某些id
function random($topnum, $is_path, array $exclude_ids)
{
function random($topnum, $is_path, array $exclude_ids) {
$this->init();
$this->topNum = $topnum;
$this->search = " AND is1.is_path LIKE '$is_path%' ";
@ -119,8 +110,7 @@ class Information_model extends CI_Model
}
//在urls列表里面随机获取N条数据并且排除某些id
function random_range($topnum, array $url_array, array $exclude_ids)
{
function random_range($topnum, array $url_array, array $exclude_ids) {
$this->init();
$this->topNum = $topnum;
$this->search = ' AND ( 1=2 ';
@ -135,8 +125,7 @@ class Information_model extends CI_Model
}
//根据url搜索信息
function search_url($url)
{
function search_url($url) {
$this->init();
$this->topNum = 24;
$this->search_url = ' AND ic_url= ' . $this->HT->escape($url);
@ -144,8 +133,7 @@ class Information_model extends CI_Model
}
//根据根节点路径获取子节点列表
function get_list_by_path($path, $level = false, $site_code = false, $filed = false)
{
function get_list_by_path($path, $level = false, $site_code = false, $filed = false) {
$this->init();
if ($level !== false) {
$this->level = " AND is1.is_level= '$level' ";
@ -156,8 +144,7 @@ class Information_model extends CI_Model
}
//根据根节点路径获取子节点列表
function get_list_by_path_gm($path, $level = false, $site_code = false, $filed = false)
{
function get_list_by_path_gm($path, $level = false, $site_code = false, $filed = false) {
$this->init();
if ($level !== false) {
$this->level = " AND is1.is_level= '$level' ";
@ -170,37 +157,36 @@ class Information_model extends CI_Model
/**
* 获取当前页面的面包屑,不包括当前节点
*/
function get_path_exclude_self($is_id, $path)
{
function get_path_exclude_self($is_id, $path) {
$site_code = $this->config->item('site_code');
$path_query = $this->HT->query("select
ic_id, is_id, ic_url,ic_url_title,ic_title,is_path,is_level,ic_status
from infoStructures a inner join infoContents b on a.is_ic_id=b.ic_id
where is_id in ($path 0) and is_id <> ? and is_siteCode = ? order by is_level asc", array($is_id, $site_code));
where is_id in ($path 0) and is_id <> ? and is_siteCode = ? order by is_level asc", [$is_id, $site_code]);
$path_result = $path_query->result();
$path_list = [];
$group_map = [
278008010 => [
'ic_url' => '/travelguide/culture/',
'ic_url_title' => 'Chinese Culture'
'ic_url_title' => 'Chinese Culture',
],
278008011 => [
'ic_url' => '/travelguide/',
'ic_url_title' => 'Travel Guide'
'ic_url_title' => 'Travel Guide',
],
278008012 => [
'ic_url' => '/aboutus/',
'ic_url_title' => 'About Us'
'ic_url_title' => 'About Us',
],
278008013 => [
'ic_url' => '/citytour/',
'ic_url_title' => 'City Tours'
'ic_url_title' => 'City Tours',
],
278008014 => [
'ic_url' => '/tour/',
'ic_url_title' => 'China Tours'
]
'ic_url_title' => 'China Tours',
],
];
foreach ($path_result as $path_row) {
@ -216,7 +202,7 @@ class Information_model extends CI_Model
'is_id' => $path_row->is_id,
'ic_title' => $path_row->ic_title,
'ic_url' => $top_group['ic_url'],
'ic_url_title' => $top_group['ic_url_title']
'ic_url_title' => $top_group['ic_url_title'],
];
$path_list[] = $path_array;
}
@ -227,7 +213,7 @@ class Information_model extends CI_Model
'is_id' => $path_row->is_id,
'ic_title' => $path_row->ic_title,
'ic_url' => $path_row->ic_url,
'ic_url_title' => $path_row->ic_url_title
'ic_url_title' => $path_row->ic_url_title,
];
$path_list[] = $path_array;
}
@ -239,12 +225,11 @@ class Information_model extends CI_Model
/**
* 获取当前页面的面包屑,不包括当前节点
*/
function get_breadcrumb_data($is_id, $path, $group_map)
{
function get_breadcrumb_data($is_id, $path, $group_map) {
$path_query = $this->HT->query("select
ic_id, is_id, ic_url,ic_url_title,ic_title,is_path,is_level,ic_status
from infoStructures a inner join infoContents b on a.is_ic_id=b.ic_id
where is_id in ($path 0) and is_id <> ? order by is_level asc", array($is_id));
where is_id in ($path 0) and is_id <> ? order by is_level asc", [$is_id]);
$path_result = $path_query->result();
$path_list = [];
@ -261,7 +246,7 @@ class Information_model extends CI_Model
'is_id' => $path_row->is_id,
'ic_title' => $path_row->ic_title,
'ic_url' => $top_group['ic_url'],
'ic_url_title' => $top_group['ic_url_title']
'ic_url_title' => $top_group['ic_url_title'],
];
$path_list[] = $path_array;
}
@ -272,7 +257,7 @@ class Information_model extends CI_Model
'is_id' => $path_row->is_id,
'ic_title' => $path_row->ic_title,
'ic_url' => $path_row->ic_url,
'ic_url_title' => $path_row->ic_url_title
'ic_url_title' => $path_row->ic_url_title,
];
$path_list[] = $path_array;
}
@ -282,8 +267,7 @@ class Information_model extends CI_Model
}
//根据路径获取某一级别节点详细页
function get_detail_by_path($path, $level)
{
function get_detail_by_path($path, $level) {
$this->init();
$this->topNum = 1;
$this->level = " AND is1.is_level= '$level' ";
@ -292,8 +276,7 @@ class Information_model extends CI_Model
return $this->GetList();
}
//根据节点ID列表获取信息
function get_detail_by_ids($is_ids)
{
function get_detail_by_ids($is_ids) {
$this->init();
$this->is_id_array = " AND is1.is_id IN ($is_ids) ";
$this->orderBy = ' ORDER BY is1.is_level ASC, is1.is_sort ASC,is1.is_path ASC ';
@ -301,8 +284,7 @@ class Information_model extends CI_Model
}
//根据根节点ID获取子节点列表
function get_list_by_id($is_parent_id, $level = false)
{
function get_list_by_id($is_parent_id, $level = false) {
$this->init();
if ($level !== false) {
$this->level = " AND is1.is_level= '$level' ";
@ -312,9 +294,7 @@ class Information_model extends CI_Model
return $this->GetList('is1.is_id, ic.ic_id, ic.ic_url, ic.ic_url_title, ic.ic_title, ic.ic_datetime, ic.ic_author');
}
function Detail($ic_url_is_id, $filed = '', $site_code = '')
{
function Detail($ic_url_is_id, $filed = '', $site_code = '') {
if (empty($ic_url_is_id)) {
return false;
}
@ -328,8 +308,7 @@ class Information_model extends CI_Model
return $this->GetList($filed, $site_code);
}
function detail_by_ic_id($ic_id)
{
function detail_by_ic_id($ic_id) {
if (empty($ic_id)) {
return false;
}
@ -339,8 +318,7 @@ class Information_model extends CI_Model
return $this->GetList();
}
function GetList($filed = "", $site_code = "")
{
function GetList($filed = "", $site_code = "") {
$this->topNum ? $sql = "SELECT TOP " . $this->topNum : $sql = "SELECT ";
if (empty($filed)) {
$sql .= " is1.is_id, \n"
@ -405,7 +383,7 @@ class Information_model extends CI_Model
$this->orderBy ? $sql .= $this->orderBy : false;
$query = $this->HT->query($sql, array($site_code ? $site_code : $this->config->item('site_code')));
$query = $this->HT->query($sql, [$site_code ? $site_code : $this->config->item('site_code')]);
//print_r($this->HT->queries);
if ($this->topNum === 1) {
if ($query->num_rows() > 0) {
@ -419,8 +397,7 @@ class Information_model extends CI_Model
}
}
function GetList_gm($filed = "", $site_code = "")
{
function GetList_gm($filed = "", $site_code = "") {
$this->topNum ? $sql = "SELECT TOP " . $this->topNum : $sql = "SELECT ";
if (empty($filed)) {
$sql .= " is1.is_id, \n"
@ -485,7 +462,7 @@ class Information_model extends CI_Model
$this->orderBy ? $sql .= $this->orderBy : false;
$query = $this->HT->query($sql, array($site_code ? $site_code : $this->config->item('site_code')));
$query = $this->HT->query($sql, [$site_code ? $site_code : $this->config->item('site_code')]);
//print_r($this->HT->queries);
if ($this->topNum === 1) {
if ($query->num_rows() > 0) {
@ -500,8 +477,7 @@ class Information_model extends CI_Model
}
//根据区域信息获取根节点
function GetRoot($ic_ht_area_type, $ic_ht_area_id)
{
function GetRoot($ic_ht_area_type, $ic_ht_area_id) {
$sql = "SELECT TOP 1 is1.is_id, \n"
. " is1.is_parent_id, \n"
. " is1.is_path, \n"
@ -517,7 +493,7 @@ class Information_model extends CI_Model
. " is1.is_level ASC, \n"
. " is1.is_sort ASC, \n"
. " is1.is_path ASC \n";
$query = $this->HT->query($sql, array($this->config->item('site_code'), $ic_ht_area_type, $ic_ht_area_id));
$query = $this->HT->query($sql, [$this->config->item('site_code'), $ic_ht_area_type, $ic_ht_area_id]);
if ($query->result()) {
$row = $query->row();
return $row;
@ -527,14 +503,13 @@ class Information_model extends CI_Model
}
//根据信息树id获取省份代号
public function get_province_by_isid($is_id)
{
public function get_province_by_isid($is_id) {
$sql = " SELECT top 1 CII_PRI_SN
FROM infoStructures is1
INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id
INNER JOIN CItyInfo ON ic.ic_ht_area_id=CII_SN
WHERE is1.is_id=?";
$query = $this->HT->query($sql, array($is_id));
$query = $this->HT->query($sql, [$is_id]);
$result = $query->result();
if (! empty($result)) {
return $result[0]->CII_PRI_SN;
@ -544,8 +519,7 @@ class Information_model extends CI_Model
}
//获取结构列表
function StructureList($is_id)
{
function StructureList($is_id) {
$sql = "SELECT is1.is_id AS id, \n"
. " is1.is_parent_id AS pId, \n"
. " ISNULL(ic.ic_url_title,'New Information') AS name , \n"
@ -560,21 +534,20 @@ class Information_model extends CI_Model
. " is1.is_level ASC, \n"
. " is1.is_sort ASC, \n"
. " is1.is_path ASC \n";
$query = $this->HT->query($sql, array($is_id));
$query = $this->HT->query($sql, [$is_id]);
//print_r($this->HT->queries);
return $query->result();
}
//检测链接是否重复
function URLcheck($is_id, $ic_url)
{
function URLcheck($is_id, $ic_url) {
$sql = "SELECT TOP 1 is1.is_id \n"
. "FROM infoStructures is1 \n"
. " INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id \n"
. "WHERE is1.is_id <> ? \n "
. " AND ic.ic_url = ? \n"
. " AND ic.ic_sitecode=? ";
$query = $this->HT->query($sql, array($is_id, $ic_url, $this->config->item('site_code')));
$query = $this->HT->query($sql, [$is_id, $ic_url, $this->config->item('site_code')]);
//print_r($this->HT->queries);
if ($query->num_rows() > 0) {
return false;
@ -584,8 +557,7 @@ class Information_model extends CI_Model
}
//获取没有绑定的景点列表
function get_unlink_landscape_list($city_id)
{
function get_unlink_landscape_list($city_id) {
$sql = "SELECT TOP 8 lsi.LSI_SN, \n"
. " lsi.LSI_City, \n"
. " lsi2.LSI2_Name, \n"
@ -606,13 +578,12 @@ class Information_model extends CI_Model
. " ) \n"
. "ORDER BY \n"
. " lsi2.LSI2_SN DESC";
$query = $this->HT229->query($sql, array($this->config->item('site_lgc'), $this->config->item('site_lgc'), $city_id));
$query = $this->HT229->query($sql, [$this->config->item('site_lgc'), $this->config->item('site_lgc'), $city_id]);
return $query->result();
}
//获取根节点列表
function root_type_list()
{
function root_type_list() {
$this->init();
$this->orderBy = " ORDER BY ic.ic_url_title ASC ";
$this->level = " AND is1.is_level=1 ";
@ -622,8 +593,7 @@ class Information_model extends CI_Model
}
//获取某个信息类型详情
function get_type_detail($type_name, $area_type, $area_id)
{
function get_type_detail($type_name, $area_type, $area_id) {
$this->init();
$this->topNum = 1;
$this->orderBy = " ORDER BY is1.is_level ASC ";
@ -634,8 +604,7 @@ class Information_model extends CI_Model
}
//获取3年未更新的信息
function get_oldest_info($yeardiff = 3, $has_no_pub = true, $empty_info = true)
{
function get_oldest_info($yeardiff = 3, $has_no_pub = true, $empty_info = true) {
$has_no_pub ? $sql_no_pub = '' : $sql_no_pub = "AND ic_status = 1";
$empty_info ? $sql_empty_info = '' : $sql_empty_info = "AND datalength(ic_content) > 0";
//sql
@ -659,14 +628,12 @@ class Information_model extends CI_Model
" . $sql_empty_info . "
AND ic_url <> ''
ORDER BY ic_datetime desc";
$query = $this->HT->query($sql, array($yeardiff, $this->config->item('site_code')));
$query = $this->HT->query($sql, [$yeardiff, $this->config->item('site_code')]);
return $query->result();
}
//ct
function ct_get_by_url($ic_url, $webcode)
{
function ct_get_by_url($ic_url, $webcode) {
$this->ic_url_is_id = " AND ic.ic_url = N" . $this->HT->escape($ic_url);
$sql = "SELECT is1.is_id, \n"
. " is1.is_parent_id, \n"
@ -713,8 +680,7 @@ class Information_model extends CI_Model
}
//获取分组列表
function group_list()
{
function group_list() {
$this->init();
$this->search = ' AND is_level<=1 ';
$this->orderBy = ' ORDER BY is1.is_level ASC, is1.is_sort ASC,ic.ic_title ASC,is1.is_path ASC ';
@ -724,37 +690,36 @@ class Information_model extends CI_Model
/**
* CT 获取当前页面的面包屑,不包括当前节点,去除链接为空及不发布的节点
*/
function get_path_exclude_ct($is_id, $path)
{
function get_path_exclude_ct($is_id, $path) {
$site_code = $this->config->item('site_code');
$path_query = $this->HT->query("select
ic_id, is_id, ic_url,ic_url_title,ic_title,is_path,is_level,ic_status
from infoStructures a inner join infoContents b on a.is_ic_id=b.ic_id
where is_id in ($path 0) and is_id <> ? and is_siteCode = ? order by is_level asc", array($is_id, $site_code));
where is_id in ($path 0) and is_id <> ? and is_siteCode = ? order by is_level asc", [$is_id, $site_code]);
$path_result = $path_query->result();
$path_list = [];
$group_map = [
278013869 => [
'ic_url' => '/tour',
'ic_url_title' => 'China Tours'
'ic_url_title' => 'China Tours',
],
278014282 => [
'ic_url' => '/citytour',
'ic_url_title' => 'China City Tours'
'ic_url_title' => 'China City Tours',
],
278013862 => [
'ic_url' => '/daytrip',
'ic_url_title' => 'China Day Trip'
'ic_url_title' => 'China Day Trip',
],
278014609 => [
'ic_url' => '/china-trains',
'ic_url_title' => 'China Trains'
'ic_url_title' => 'China Trains',
],
278014608 => [
'ic_url' => '/china-flights',
'ic_url_title' => 'China Flights'
]
'ic_url_title' => 'China Flights',
],
];
foreach ($path_result as $path_row) {
@ -766,7 +731,7 @@ class Information_model extends CI_Model
'is_id' => $path_row->is_id,
'ic_title' => $path_row->ic_title,
'ic_url' => $top_group['ic_url'],
'ic_url_title' => $top_group['ic_url_title']
'ic_url_title' => $top_group['ic_url_title'],
];
$path_list[] = $path_array;
} else if ($path_row->ic_status === 1) {
@ -775,7 +740,7 @@ class Information_model extends CI_Model
'is_id' => $path_row->is_id,
'ic_title' => $path_row->ic_title,
'ic_url' => $path_row->ic_url,
'ic_url_title' => $path_row->ic_url_title
'ic_url_title' => $path_row->ic_url_title,
];
$path_list[] = $path_array;
}
@ -787,8 +752,7 @@ class Information_model extends CI_Model
/**
* intl 根据keywords获取信息。
*/
function list_by_keywords($site, $keywords)
{
function list_by_keywords($site, $keywords) {
$this->init();
$keysql = '';
foreach ($keywords as $key) {
@ -799,7 +763,7 @@ class Information_model extends CI_Model
}
$search = ' AND (1=0 ' . $keysql . ')';
$sql = "
SELECT is_id, ic_id, ic_url, ic_content, m1.im_value AS amp_json, m2.im_value AS amp_body
SELECT is_id, ic_id, ic_url, ic_content, ic_photo, m1.im_value AS amp_json, m2.im_value AS amp_body
FROM infoStructures is1
INNER JOIN infoContents ic
ON ic.ic_id = is1.is_ic_id
@ -816,7 +780,7 @@ class Information_model extends CI_Model
" . $search . "
ORDER BY ic_datetime DESC
";
$query = $this->HT->query($sql, array($site));
$query = $this->HT->query($sql, [$site]);
// print_r($this->HT->queries);
return $query->result();
}

Loading…
Cancel
Save