From a7fc13c211191792733d1afbc2d38967d74cc3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Thu, 18 Mar 2021 15:18:04 +0800 Subject: [PATCH] =?UTF-8?q?CT=E7=A7=BB=E5=8A=A8=E4=BC=98=E5=85=88=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=9C=AC=E5=9C=B0=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=AE=8C=E6=88=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/config/config.php | 1 + application/controllers/information.php | 194 ++++++++++++------ .../views/bootstrap3/information_edit.php | 22 +- .../views/mobile_first/chinatravel-pc.php | 4 +- 4 files changed, 153 insertions(+), 68 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index 5490eca4..b939d5c1 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -713,6 +713,7 @@ $config['css_source_yz'] = 'https://www.yangtzeriver.org/css/css3/bootstrap/boot $config['css_source_ah'] = 'https://www.asiahighlights.com/min/?f=/css/global.min.css,/js/bootstrap-datepicker/css/bootstrap-datepicker3.standalone.css,/css/basic.css,/css/homepage.css,/css/contact.css,/css/tailor-make.css,/css/tour.css,/css/tour-detail.css,/css/inquiry-form.css,/css/missing.css'; $config['css_source_gh'] = 'https://www.globalhighlights.com/css/global.css'; $config['css_source_ct'] = 'https://data.chinatravel.com/css/min.php?f=/css/css3/bootstrap/bootstrap.css,/css/css3/style.css,/css/css3/destination-details.css'; +$config['css_source_chinatravel'] = 'http://202.103.68.104:100/css/newcss3/pc.css'; $config['css_source_ts'] = 'https://www.trainspread.com/css/bootstrap.min.css'; diff --git a/application/controllers/information.php b/application/controllers/information.php index af937176..946dbc09 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -349,6 +349,14 @@ class Information extends CI_Controller } } + //CT判断是否生成静态文件 + if ($this->config->item("site_code")=="chinatravel"){ + //查找是否有静态文件 + if ($this->html_file_helper('find', $data['information']->ic_url)) { + $data['has_html_file'] = true; + } + } + $this->load->view('bootstrap3/header', $data); $this->load->view('bootstrap3/information_edit'); @@ -587,9 +595,15 @@ class Information extends CI_Controller return false; } if ($this->html_file_helper('find', $information->ic_url)) { - //用于批量更新 - $this->make_www_cache('pc', $information); - $this->make_www_cache('mobile', $information); + //用于批量更新,CH和chinatravel分开 ,20210317 zp + if ($this->config->item('site_code') == 'ch'){ + $this->make_www_cache('pc', $information); + $this->make_www_cache('mobile', $information); + }else if ($this->config->item('site_code') == 'chinatravel'){ + $this->make_www_cache_ct('pc', $information); + $this->make_www_cache_ct('mobile', $information); + } + echo json_encode(array('name' => 'yes', 'data' => '更新成功!')); return true; } else { @@ -754,94 +768,127 @@ class Information extends CI_Controller */ function make_www_cache_ct($device,$information){ $data = array(); - 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, '', 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', '', TRUE); - $html_path_ext = '-pc.htm'; - } else { - return false; - } - break; - default: - } - - //替换模板中的标签 - $template = str_replace('', $information->ic_seo_title, $template); - $template = str_replace('', $information->ic_seo_description, $template); - $template = str_replace('', $information->ic_seo_keywords, $template); - $template = str_replace('', $this->config->item('site_url') . $information->ic_url, $template); - //非产品页面 - if (empty(get_meta($information->ic_id, 'meta_product_code'))) { + //先准备数据,CT采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。 + $data["TITLE"] = $information->ic_seo_title; + $data["DESCRIPTION"] = $information->ic_seo_description; + $data["KEYWORDS"] = $information->ic_seo_keywords; + $data["CANONICAL"] = $this->config->item('site_url') . $information->ic_url; + //详细内容 + $data["CUSTOMCONENT"]=$information->ic_content; + //非产品页面 + $data["PRODUCTJS"]=""; + if (empty(get_meta($information->ic_id, 'meta_product_code'))) { } else { - $template = str_replace('', '', $template); + $data["PRODUCTJS"] = ''; } + //顶部全屏大图 + $data["TOPBANNER"] =""; + $ImgText = ""; //图文字 + $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url'); if($device=='mobile'){//移动端读取移动大图 $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile'); + $bannerImg = '' . $information->ic_title . ''; }else{ $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); - } - $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url'); + $bannerImg = '' . $information->ic_title . ''; + $meta_addon_picture_text = get_meta($information->ic_id,'meta_addon_picture_text'); + if(!empty($meta_addon_picture_url)){ + $ImgText = ''; + }else{ + $ImgText = ''; + } + } if (!empty($meta_addon_picture)) { if(!empty($meta_addon_picture_url)){ - $template = str_replace('', '
' . $information->ic_title . '
', $template); + $data["TOPBANNER"] = ''; }else{ - $template = str_replace('', '
' . $information->ic_title . '
', $template); + $data["TOPBANNER"] = ''; } } - //顶部视频 + + //顶部视频 + $data["TOPVIDEO"]=""; $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); $meta_video_picture = get_meta($information->ic_id, 'meta_video_picture'); if (!empty($meta_news_video) && !empty($meta_video_picture)) { - $template = str_replace('', '
', $template); + $data["TOPVIDEO"]=''; } + + //主样式表,内联模式 - $main_css_string=compress_css(GET_HTTP('https://proxy-data.chinahighlights.com/css/mobile-first.css')); - $template = str_replace('', '', $template); - //额外样式 - $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (!empty($meta_addon_css)) { - //引用方式 $template = str_replace('', '', $template); - //内联方式 - $meta_addon_css_string=compress_css(GET_HTTP($meta_addon_css)); - $template = str_replace('', '', $template); + if ($device=="mobile"){ + $cssUrl = "http://202.103.68.104/css/newcss3/mobile.css"; + }else{ + $cssUrl="http://202.103.68.104/css/newcss3/pc.css"; } + $main_css_string=compress_css(GET_HTTP($cssUrl)); + $data["MAINCSS"] = ''; + + //额外样式 + $data["ADDONCSS"]=""; + $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); + if (!empty($meta_addon_css)) { + //引用方式 + //$data["ADDONCSS"]= ''; + //内联方式 + $meta_addon_css_string=compress_css(GET_HTTP($meta_addon_css)); + $data["ADDONCSS"]=''; + + } + //额外js + $data["ADDONJS"]=""; $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); if (!empty($meta_addon_js)) { - $template = str_replace('', '', $template); - } - $template = str_replace('', $information->ic_content, $template); - //Google广告代码 - if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) { - $template = str_replace('', '', $template); - } - if (!empty(get_meta($information->ic_id, 'meta_google_ad_article'))) { - $in_article_google=$this->load->view($template_path.'-google-ad', false,true); - $template = str_replace('', $in_article_google, $template); + $data["ADDONJS"]=''; } + //社媒分享图片 + $data["OGIMAGE"]=""; if (!empty($information->ic_photo)) { $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo; - $template = str_replace('', '', $template); + $data["OGIMAGE"]= ''; } - //设置图片尺寸 - $template=$this->html_optimize_lib->set_image_size($template); - // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm + + //结构化标签 + $data["ConstructionCode"]=""; + $meta_construction_code = get_meta($information->ic_id,'meta_construction_code'); + if (!empty($meta_construction_code)){ + $data["ConstructionCode"]=$meta_construction_code; + } + + + + + //两种模板 + 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) == '/') { @@ -850,6 +897,25 @@ class Information extends CI_Controller $html_path .= $html_path_ext; create_folder_by_path(dirname($html_path)); file_put_contents($html_path, $template, LOCK_EX); + + + + + + // //Google广告代码 + // if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) { + // $template = str_replace('', '', $template); + // } + // if (!empty(get_meta($information->ic_id, 'meta_google_ad_article'))) { + // $in_article_google=$this->load->view($template_path.'-google-ad', false,true); + // $template = str_replace('', $in_article_google, $template); + // } + + // //设置图片尺寸 + // //$template=$this->html_optimize_lib->set_image_size($template); + // // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm + + } function call_mobile_template_H1($mobile_first_template_path, $is_path, $ic_author, $ic_title, $ic_photo) diff --git a/application/views/bootstrap3/information_edit.php b/application/views/bootstrap3/information_edit.php index 1b507c81..ea0ded2c 100644 --- a/application/views/bootstrap3/information_edit.php +++ b/application/views/bootstrap3/information_edit.php @@ -876,6 +876,26 @@ value="ic_id, 'meta_addon_picture_url'); ?>"/> + ic_sitecode == 'chinatravel') { + ?> +
+
+ + +
+
+ @@ -2201,7 +2221,7 @@ diff --git a/application/views/mobile_first/chinatravel-pc.php b/application/views/mobile_first/chinatravel-pc.php index 628f7a55..9549088c 100644 --- a/application/views/mobile_first/chinatravel-pc.php +++ b/application/views/mobile_first/chinatravel-pc.php @@ -20,8 +20,6 @@ - - @@ -187,7 +185,7 @@ eval(function(p,a,c,k,e,d){e=function(c){return(c