|
|
@ -410,8 +410,12 @@ class Information extends CI_Controller
|
|
|
|
} else if (strcasecmp($site_code, "ch") == 0 && !empty($auto_update_cache)) {
|
|
|
|
} else if (strcasecmp($site_code, "ch") == 0 && !empty($auto_update_cache)) {
|
|
|
|
//读取模板生成PC和移动优先文件
|
|
|
|
//读取模板生成PC和移动优先文件
|
|
|
|
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
|
|
|
|
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
|
|
|
|
$this->make_www_cache('mobile', $information_new);
|
|
|
|
$recommand_information = $this->recommand_information($information);
|
|
|
|
$this->make_www_cache('pc', $information_new);
|
|
|
|
//$this->benchmark->mark('111');
|
|
|
|
|
|
|
|
$this->make_www_cache('mobile', $information_new, $recommand_information);
|
|
|
|
|
|
|
|
//$this->benchmark->mark('222');
|
|
|
|
|
|
|
|
$this->make_www_cache('pc', $information_new, $recommand_information);
|
|
|
|
|
|
|
|
//echo $this->benchmark->elapsed_time('111', '222');
|
|
|
|
} else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) {
|
|
|
|
} else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) {
|
|
|
|
//读取模板生成PC和移动优先文件
|
|
|
|
//读取模板生成PC和移动优先文件
|
|
|
|
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
|
|
|
|
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
|
|
|
@ -565,7 +569,7 @@ class Information extends CI_Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//生成静态文件 $device='mobile' or 'pc'
|
|
|
|
//生成静态文件 $device='mobile' or 'pc'
|
|
|
|
function make_www_cache($device, $information)
|
|
|
|
function make_www_cache($device, $information, $recommand_information)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$data = array();
|
|
|
|
$data = array();
|
|
|
|
switch ($device) {
|
|
|
|
switch ($device) {
|
|
|
@ -591,7 +595,6 @@ class Information extends CI_Controller
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$breadcrumb_data = $this->Information_model->get_path_exclude_self($information->is_id, $information->is_path);
|
|
|
|
$breadcrumb_data = $this->Information_model->get_path_exclude_self($information->is_id, $information->is_path);
|
|
|
|
|
|
|
|
|
|
|
|
$breadcrumb_structured_data_content = $this->load->view(
|
|
|
|
$breadcrumb_structured_data_content = $this->load->view(
|
|
|
@ -603,7 +606,6 @@ class Information extends CI_Controller
|
|
|
|
$breadcrumb_structured_data_content,
|
|
|
|
$breadcrumb_structured_data_content,
|
|
|
|
$template);
|
|
|
|
$template);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//替换模板中的标签
|
|
|
|
//替换模板中的标签
|
|
|
|
$template = str_replace('<!--@TITLE@-->', $information->ic_seo_title, $template);
|
|
|
|
$template = str_replace('<!--@TITLE@-->', $information->ic_seo_title, $template);
|
|
|
|
$template = str_replace('<!--@DESCRIPTION@-->', $information->ic_seo_description, $template);
|
|
|
|
$template = str_replace('<!--@DESCRIPTION@-->', $information->ic_seo_description, $template);
|
|
|
@ -630,6 +632,7 @@ class Information extends CI_Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//火车票搜索框添加 -- zp
|
|
|
|
//火车票搜索框添加 -- zp
|
|
|
|
if ($information->is_parent_id == "278008234") {
|
|
|
|
if ($information->is_parent_id == "278008234") {
|
|
|
|
//本地测试的火车父类ID为:278035939 。网前为:278008234
|
|
|
|
//本地测试的火车父类ID为:278035939 。网前为:278008234
|
|
|
@ -637,7 +640,6 @@ class Information extends CI_Controller
|
|
|
|
$template = str_replace('<!--@TRAIN-SEARCH@-->', $template_TrainSearch, $template);
|
|
|
|
$template = str_replace('<!--@TRAIN-SEARCH@-->', $template_TrainSearch, $template);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//非产品页面
|
|
|
|
//非产品页面
|
|
|
|
$meta_product_code = get_meta($information->ic_id, 'meta_product_code');
|
|
|
|
$meta_product_code = get_meta($information->ic_id, 'meta_product_code');
|
|
|
|
if (empty($meta_product_code)) {
|
|
|
|
if (empty($meta_product_code)) {
|
|
|
@ -672,8 +674,6 @@ class Information extends CI_Controller
|
|
|
|
$information->ic_content = str_replace('<!--@BREADCRUMB-BLOCK@-->', $breadcrumb_content, $information->ic_content);
|
|
|
|
$information->ic_content = str_replace('<!--@BREADCRUMB-BLOCK@-->', $breadcrumb_content, $information->ic_content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---day tours--- 20210922 zp
|
|
|
|
//---day tours--- 20210922 zp
|
|
|
|
//本地 278035929
|
|
|
|
//本地 278035929
|
|
|
|
//网前 278008224
|
|
|
|
//网前 278008224
|
|
|
@ -741,8 +741,7 @@ class Information extends CI_Controller
|
|
|
|
$PAG_Scheme = $dataTrippest['PagDetail']->PAG_Scheme;
|
|
|
|
$PAG_Scheme = $dataTrippest['PagDetail']->PAG_Scheme;
|
|
|
|
$dataTrippest['PAG_Scheme'] = $PAG_Scheme;
|
|
|
|
$dataTrippest['PAG_Scheme'] = $PAG_Scheme;
|
|
|
|
//接送
|
|
|
|
//接送
|
|
|
|
if ($dataTrippest["t_Type"]=="transfer" || 1==1)
|
|
|
|
if ($dataTrippest["t_Type"] == "transfer" || 1 == 1) {
|
|
|
|
{
|
|
|
|
|
|
|
|
$PagList = $this->trippest_model->GetTransfer($dataTrippest['PagDetail']->PAG_SN);
|
|
|
|
$PagList = $this->trippest_model->GetTransfer($dataTrippest['PagDetail']->PAG_SN);
|
|
|
|
$dataTrippest["PagList"] = $PagList;
|
|
|
|
$dataTrippest["PagList"] = $PagList;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -774,9 +773,8 @@ class Information extends CI_Controller
|
|
|
|
|
|
|
|
|
|
|
|
//---day tours end ----
|
|
|
|
//---day tours end ----
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//信息推荐
|
|
|
|
//信息推荐
|
|
|
|
$template_recommand = $this->recommand_information($information);
|
|
|
|
$template_recommand = $recommand_information; //$this->recommand_information($information); 从外面传进来,pc和移动只需要查一次,减少数据库负担
|
|
|
|
$template = str_replace('<!--@ARTICLENEXT@-->', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), TRUE), $template);
|
|
|
|
$template = str_replace('<!--@ARTICLENEXT@-->', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), TRUE), $template);
|
|
|
|
// //广告,改叫tips,防止被插件屏蔽
|
|
|
|
// //广告,改叫tips,防止被插件屏蔽
|
|
|
|
if (!empty($template_recommand['Tips Right TOP'])) {
|
|
|
|
if (!empty($template_recommand['Tips Right TOP'])) {
|
|
|
@ -796,7 +794,6 @@ class Information extends CI_Controller
|
|
|
|
$information->ic_content = str_replace('<!--@Content-Recommends-Tour@-->', $this->load->view($template_path . '-recommends-tour', array('recommands' => $template_recommand), TRUE), $information->ic_content);
|
|
|
|
$information->ic_content = str_replace('<!--@Content-Recommends-Tour@-->', $this->load->view($template_path . '-recommends-tour', array('recommands' => $template_recommand), TRUE), $information->ic_content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//顶部全屏大图
|
|
|
|
//顶部全屏大图
|
|
|
|
if ($device == 'mobile') { //移动端读取移动大图
|
|
|
|
if ($device == 'mobile') { //移动端读取移动大图
|
|
|
|
$meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile');
|
|
|
|
$meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile');
|
|
|
@ -825,15 +822,21 @@ class Information extends CI_Controller
|
|
|
|
if (!empty($meta_news_video) && !empty($meta_video_picture)) {
|
|
|
|
if (!empty($meta_news_video) && !empty($meta_video_picture)) {
|
|
|
|
$template = str_replace('<!--@TOP-VIDEO@-->', '<div class="detailtopbanner"><video autoplay="" controls="controls" id="bgvid" poster="' . $meta_video_picture . '" src="' . $meta_news_video . '" style="position: inherit;"> </video></div>', $template);
|
|
|
|
$template = str_replace('<!--@TOP-VIDEO@-->', '<div class="detailtopbanner"><video autoplay="" controls="controls" id="bgvid" poster="' . $meta_video_picture . '" src="' . $meta_news_video . '" style="position: inherit;"> </video></div>', $template);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//主样式表,内联模式
|
|
|
|
|
|
|
|
|
|
|
|
if (is_file('D:/wwwroot/origin-data.chinahighlights.com/css/mobile-first.css')) {//主样式表,内联模式,优先读取本地,没有在从网络读取,为了加速
|
|
|
|
|
|
|
|
$main_css_string = compress_css(file_get_contents('D:/wwwroot/origin-data.chinahighlights.com/css/mobile-first.css'));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$main_css_string = compress_css(GET_HTTP('https://proxy-data.chinahighlights.com/css/mobile-first.css'));
|
|
|
|
$main_css_string = compress_css(GET_HTTP('https://proxy-data.chinahighlights.com/css/mobile-first.css'));
|
|
|
|
|
|
|
|
}
|
|
|
|
$template = str_replace('<!--@MAIN-CSS@-->', '<style type="text/css">' . $main_css_string . '</style>', $template);
|
|
|
|
$template = str_replace('<!--@MAIN-CSS@-->', '<style type="text/css">' . $main_css_string . '</style>', $template);
|
|
|
|
//额外样式
|
|
|
|
//额外样式
|
|
|
|
$meta_addon_css = get_meta($information->ic_id, 'meta_addon_css');
|
|
|
|
$meta_addon_css = get_meta($information->ic_id, 'meta_addon_css');
|
|
|
|
if (!empty($meta_addon_css)) {
|
|
|
|
if (!empty($meta_addon_css)) {
|
|
|
|
//引用方式 $template = str_replace('<!--@ADDON-CSS@-->', '<link href="' . $meta_addon_css . '" rel="stylesheet">', $template);
|
|
|
|
if ($meta_addon_css == 'https://proxy-data.chinahighlights.com/css/tour-detail-former.css' && is_file('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')) {
|
|
|
|
//内联方式
|
|
|
|
$meta_addon_css_string = compress_css(file_get_contents('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css'));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$meta_addon_css_string = compress_css(GET_HTTP($meta_addon_css));
|
|
|
|
$meta_addon_css_string = compress_css(GET_HTTP($meta_addon_css));
|
|
|
|
|
|
|
|
}
|
|
|
|
$template = str_replace('<!--@ADDON-CSS@-->', '<style type="text/css">' . $meta_addon_css_string . '</style>', $template);
|
|
|
|
$template = str_replace('<!--@ADDON-CSS@-->', '<style type="text/css">' . $meta_addon_css_string . '</style>', $template);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//额外js
|
|
|
|
//额外js
|
|
|
@ -864,8 +867,13 @@ class Information extends CI_Controller
|
|
|
|
$template = str_replace('<!--@OG:IMAGE@-->', '<meta property="og:image" content="' . $full_ic_photo . '"><meta property="og:image:secure_url" content="' . $full_ic_photo . '"><meta property="og:image:width" content="800"><meta property="og:image:height" content="450">', $template);
|
|
|
|
$template = str_replace('<!--@OG:IMAGE@-->', '<meta property="og:image" content="' . $full_ic_photo . '"><meta property="og:image:secure_url" content="' . $full_ic_photo . '"><meta property="og:image:width" content="800"><meta property="og:image:height" content="450">', $template);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//设置图片尺寸
|
|
|
|
//设置图片尺寸
|
|
|
|
|
|
|
|
if (is_dir('D:/wwwroot/origin-images.chinahighlights.com') && is_dir('D:/wwwroot/origin-www.chinahighlights.com')) {
|
|
|
|
|
|
|
|
$template = $this->html_optimize_lib->set_image_size_local($template, 'D:/wwwroot/origin-www.chinahighlights.com', 'D:/wwwroot/origin-images.chinahighlights.com');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$template = $this->html_optimize_lib->set_image_size($template);
|
|
|
|
$template = $this->html_optimize_lib->set_image_size($template);
|
|
|
|
|
|
|
|
}
|
|
|
|
// /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm
|
|
|
|
// /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm
|
|
|
|
|
|
|
|
$this->benchmark->mark('10');
|
|
|
|
$html_path = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $information->ic_url;
|
|
|
|
$html_path = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $information->ic_url;
|
|
|
|
$html_path = str_replace("\\", "/", $html_path);
|
|
|
|
$html_path = str_replace("\\", "/", $html_path);
|
|
|
|
if (substr($html_path, -1, 1) == '/') {
|
|
|
|
if (substr($html_path, -1, 1) == '/') {
|
|
|
@ -877,7 +885,8 @@ class Information extends CI_Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function make_www_cache_gh($information){
|
|
|
|
function make_www_cache_gh($information)
|
|
|
|
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
$data = array();
|
|
|
|
$data = array();
|
|
|
|
$data['information'] = $information;
|
|
|
|
$data['information'] = $information;
|
|
|
@ -1100,7 +1109,6 @@ class Information extends CI_Controller
|
|
|
|
// },$ic_content);
|
|
|
|
// },$ic_content);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//图片加延迟
|
|
|
|
//图片加延迟
|
|
|
|
$ic_content = $this->html_optimize_lib->set_lazy_loader($ic_content, 'https://data.chinatravel.com/images/mobile-first/grey.gif');
|
|
|
|
$ic_content = $this->html_optimize_lib->set_lazy_loader($ic_content, 'https://data.chinatravel.com/images/mobile-first/grey.gif');
|
|
|
|
|
|
|
|
|
|
|
|