diff --git a/application/controllers/information.php b/application/controllers/information.php
index 0bab43cd..429df583 100644
--- a/application/controllers/information.php
+++ b/application/controllers/information.php
@@ -423,8 +423,8 @@ class Information extends CI_Controller
}else if (strcasecmp($site_code, "chinatravel") == 0 && !empty($auto_update_cache)) {
//chinatravel读取模板生成PC和移动优先文件
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
- $this->make_www_cache_ct('mobile', $information_new);
- $this->make_www_cache_ct('pc', $information_new);
+ $this->make_www_cache_ct($information_new);
+ // $this->make_www_cache_ct('pc', $information_new);
} else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) {
$update_info_log = $this->update_cache($ic_url);
} else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) {
@@ -512,8 +512,8 @@ class Information extends CI_Controller
$this->make_www_cache_ah('pc', $information);
$this->make_www_cache_ah('mobile', $information);
} else if ($this->config->item('site_code') == 'chinatravel') {
- $this->make_www_cache_ct('pc', $information);
- $this->make_www_cache_ct('mobile', $information);
+ $this->make_www_cache_ct($information);
+ // $this->make_www_cache_ct('mobile', $information);
}
echo json_encode(array('name' => 'yes', 'data' => '更新成功!'));
@@ -1065,9 +1065,11 @@ class Information extends CI_Controller
* @return:
* @Date Changed:
*/
- function make_www_cache_ct($device, $information)
+ function make_www_cache_ct($information)
{
$data = array();
+
+ #region 公用数据
//$apiurl = "http://202.103.68.104:61/info.php"; //本地测试
$apiurl = "https://ct.mycht.cn/info.php"; //网前
@@ -1095,7 +1097,7 @@ class Information extends CI_Controller
// return '';;
// },$ic_content);
- //$ic_content = '
'.$ic_content.'
'; //兼容拷贝过来的内容样式
+
//图片加延迟
$ic_content = $this->html_optimize_lib->set_lazy_loader($ic_content, 'https://data.chinatravel.com/images/mobile-first/grey.gif');
@@ -1117,48 +1119,6 @@ class Information extends CI_Controller
$data["ISPRODUCT"] = "yes";
}
- //顶部全屏大图
- $data["TOPBANNER"] = "";
- $ImgText = ""; //图文字
- $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url');
- $meta_addon_picture_text = get_meta($information->ic_id, 'meta_addon_picture_text');
- if ($device == 'mobile') { //移动端读取移动大图
- $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile');
- $bannerImg = '
';
- if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) {
- $ImgText = '';
- } else if(!empty($meta_addon_picture_text)){
- $ImgText = '' . $meta_addon_picture_text . '
';
- }
- } else {
- $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture');
- $bannerImg = '
';
- if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text) ) {
- $ImgText = '';
- } else if(!empty($meta_addon_picture_text)) {
- $ImgText = '' . $meta_addon_picture_text . '
';
- }
- }
-
- // 搜索框
- $template_TrainSearch = "";
- if ($information->ic_url =="/china-trains/hometest" || $information->ic_url=="/china-trains"){
- //火车票首页
- $template_TrainSearch = $this->load->view($template_path . '-train-index', null, TRUE);
- $ImgText = "";
- }else if ($information->ic_url =="/china-flights"){
- //机票首页
- $template_TrainSearch = $this->load->view($template_path . '-flight-index', null, TRUE);
- $ImgText = "";
- }
-
- if (!empty($meta_addon_picture)) {
- if (!empty($meta_addon_picture_url)) {
- $data["TOPBANNER"] = '';
- } else {
- $data["TOPBANNER"] = '' . $bannerImg . $ImgText . $template_TrainSearch . '
';
- }
- }
//顶部视频
$data["TOPVIDEO"] = "";
@@ -1171,12 +1131,8 @@ class Information extends CI_Controller
//主样式表,内联模式
//$apiweb="http://202.103.68.104"; //本地测试
- $apiweb = "https://data.chinatravel.com";
- if ($device == "mobile") {
- $cssUrl = $apiweb . "/css/newcss3/base.css?v=" . time();
- } else {
- $cssUrl = $apiweb . "/css/newcss3/base.css?v=" . time();
- }
+ $apiweb = "https://data.chinatravel.com";
+ $cssUrl = $apiweb . "/css/newcss3/base.css?v=" . time();
$main_css_string = compress_css(GET_HTTP($cssUrl));
$data["MAINCSS"] = '';
@@ -1312,46 +1268,93 @@ class Information extends CI_Controller
$data["ADDONJS"] = $addonJs;
$data["passParam"] = $passParam;
- #region 移动端和PC端差别处理区域
-
#endregion
- //两种模板
- switch ($device) {
- case 'mobile':
- //获取移动优先的模板,如果有的话
- $template_path = 'mobile_first/' . $this->config->item('site_code');
- if (is_file(APPPATH . 'views/' . $template_path . EXT)) {
- $template = $this->load->view($template_path, $data, TRUE);
- $html_path_ext = '-mobile.htm';
- } else {
- return false;
+ #region 移动端和PC端差别处理区域
+ $arrDevice = array("mobile","pc");
+ foreach($arrDevice as $device){
+ //顶部全屏大图
+ $data["TOPBANNER"] = "";
+ $ImgText = ""; //图文字
+ $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url');
+ $meta_addon_picture_text = get_meta($information->ic_id, 'meta_addon_picture_text');
+ if ($device == 'mobile') { //移动端读取移动大图
+ $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile');
+ $bannerImg = '
';
+ if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) {
+ $ImgText = '';
+ } else if(!empty($meta_addon_picture_text)){
+ $ImgText = '' . $meta_addon_picture_text . '
';
}
- break;
- case 'pc':
- //获取PC的模板,如果有的话
- $template_path = 'mobile_first/' . $this->config->item('site_code');
- if (is_file(APPPATH . 'views/' . $template_path . '-pc' . EXT)) {
- $template = $this->load->view($template_path . '-pc', $data, TRUE);
- $html_path_ext = '-pc.htm';
+ } else {
+ $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture');
+ $bannerImg = '
';
+ if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text) ) {
+ $ImgText = '';
+ } else if(!empty($meta_addon_picture_text)) {
+ $ImgText = '' . $meta_addon_picture_text . '
';
+ }
+ }
+
+ // 搜索框
+ $template_TrainSearch = "";
+ if ($information->ic_url =="/china-trains/hometest" || $information->ic_url=="/china-trains"){
+ //火车票首页
+ $template_TrainSearch = $this->load->view($template_path . '-train-index', null, TRUE);
+ $ImgText = "";
+ }else if ($information->ic_url =="/china-flights"){
+ //机票首页
+ $template_TrainSearch = $this->load->view($template_path . '-flight-index', null, TRUE);
+ $ImgText = "";
+ }
+
+ if (!empty($meta_addon_picture)) {
+ if (!empty($meta_addon_picture_url)) {
+ $data["TOPBANNER"] = '';
} else {
- return false;
+ $data["TOPBANNER"] = '' . $bannerImg . $ImgText . $template_TrainSearch . '
';
}
- break;
- default:
- }
+ }
- //生成静态文件
- $html_path = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $information->ic_url;
- $html_path = str_replace("\\", "/", $html_path);
- if (substr($html_path, -1, 1) == '/') {
- $html_path = $html_path . 'index.htm';
- }
- $html_path .= $html_path_ext;
- create_folder_by_path(dirname($html_path));
- file_put_contents($html_path, $template, LOCK_EX);
+ //两种设备分别调用两种模板 ,静态化
+ switch ($device) {
+ case 'mobile':
+ //获取移动优先的模板,如果有的话
+ $template_path = 'mobile_first/' . $this->config->item('site_code');
+ if (is_file(APPPATH . 'views/' . $template_path . EXT)) {
+ $template = $this->load->view($template_path, $data, TRUE);
+ $html_path_ext = '-mobile.htm';
+ } else {
+ return false;
+ }
+ break;
+ case 'pc':
+ //获取PC的模板,如果有的话
+ $template_path = 'mobile_first/' . $this->config->item('site_code');
+ if (is_file(APPPATH . 'views/' . $template_path . '-pc' . EXT)) {
+ $template = $this->load->view($template_path . '-pc', $data, TRUE);
+ $html_path_ext = '-pc.htm';
+ } else {
+ return false;
+ }
+ break;
+ default:
+ }
+
+ //生成静态文件
+ $html_path = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $information->ic_url;
+ $html_path = str_replace("\\", "/", $html_path);
+ if (substr($html_path, -1, 1) == '/') {
+ $html_path = $html_path . 'index.htm';
+ }
+ $html_path .= $html_path_ext;
+ create_folder_by_path(dirname($html_path));
+ file_put_contents($html_path, $template, LOCK_EX);
+
+ }
+ #endregion
}
diff --git a/application/views/mobile_first/chinatravel-flight-index.php b/application/views/mobile_first/chinatravel-flight-index.php
index ad1b3139..c24c5499 100644
--- a/application/views/mobile_first/chinatravel-flight-index.php
+++ b/application/views/mobile_first/chinatravel-flight-index.php
@@ -22,7 +22,7 @@
-
+