From 52ad64ee9da66345e2d84b5f027c294d31c29087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Tue, 7 Sep 2021 14:14:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=A4=BE=E5=AA=92=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=88=86=E4=BA=AB=EF=BC=8C=E4=BC=98=E5=85=88=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=9B=BE=E7=89=87=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=88=99=E8=AF=BB=E5=8F=96=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 59 ++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index df7adbcf..28f5fbc0 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -416,7 +416,10 @@ class Information extends CI_Controller $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_ah('mobile', $information_new); $this->make_www_cache_ah('pc', $information_new); - } else if (strcasecmp($site_code, "chinatravel") == 0 && !empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "gh") == 0 && !empty($auto_update_cache)) { + $information_new = $this->Information_model->Detail($this->input->post('is_id')); + $this->make_www_cache_gh($information_new); + }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); @@ -746,8 +749,13 @@ class Information extends CI_Controller $template = str_replace('', '', $template); //} //社媒分享图片 + $full_ic_photo=''; if (!empty($information->ic_photo)) { $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo; + }else{ + $full_ic_photo = get_meta($data->ic_id, 'meta_addon_picture_mobile'); + } + if(!empty($full_ic_photo)){ $template = str_replace('', '', $template); } //设置图片尺寸 @@ -763,6 +771,48 @@ class Information extends CI_Controller file_put_contents($html_path, $template, LOCK_EX); } + + function make_www_cache_gh($information){ + return false; + $data = array(); + $data['information'] = $information; + //获取移动优先的模板,如果有的话 + $template_path = 'mobile_first/' . $this->config->item('site_code'); + $template_mobile = $this->load->view($template_path, '', TRUE); + $template_pc = $this->load->view($template_path . '-pc', '', TRUE); + + //替换模板中的标签 + $template_mobile = str_replace('', $information->ic_seo_title, $template_mobile); + $template_pc = str_replace('', $information->ic_seo_title, $template_pc); + $template_mobile = str_replace('', $information->ic_seo_description, $template_mobile); + $template_pc = str_replace('', $information->ic_seo_description, $template_pc); + $template_mobile = str_replace('', $information->ic_seo_keywords, $template_mobile); + $template_pc = str_replace('', $information->ic_seo_keywords, $template_pc); + $template_mobile = str_replace('', $this->config->item('site_url') . $information->ic_url, $template_mobile); + $template_pc = str_replace('', $this->config->item('site_url') . $information->ic_url, $template_pc); + + + //顶部视频 + $data['meta_news_video'] = get_meta($information->ic_id, 'meta_news_video'); + $data['meta_video_picture'] = get_meta($information->ic_id, 'meta_video_picture'); + if (empty($data['meta_news_video']) && empty($data['meta_video_picture'])) { + //没有顶部视频时候才读取全屏大图 + //顶部全屏大图 + if ($device == 'mobile') { //移动端读取移动大图 + $data['meta_addon_picture'] = get_meta($information->ic_id, 'meta_addon_picture_mobile'); + } else { + $data['meta_addon_picture'] = get_meta($information->ic_id, 'meta_addon_picture'); + } + $data['meta_addon_picture_url'] = get_meta($information->ic_id, 'meta_addon_picture_url'); + } + + $data['author'] = $this->Operator_model->get_author_nikename($information->ic_author); //获取作者信息 + $template_H1 = $this->load->view($template_path . '-h1', $data, TRUE); + $template_mobile = str_replace('', $template_H1, $template_mobile); + $template_pc = str_replace('', $template_H1, $template_pc); + + } + function make_www_cache_ah($device, $information) { @@ -882,10 +932,17 @@ class Information extends CI_Controller $template = str_replace('', $in_article_google, $template); } //社媒分享图片 + + $full_ic_photo=''; if (!empty($information->ic_photo)) { $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo; + }else{ + $full_ic_photo = get_meta($data->ic_id, 'meta_addon_picture_mobile'); + } + if(!empty($full_ic_photo)){ $template = str_replace('', '', $template); } + //设置图片尺寸 $template = $this->html_optimize_lib->set_image_size($template); // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm From 9b786e1b3d5e5f6649f808846821d00dd7443ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Tue, 7 Sep 2021 14:47:34 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=A4=BE=E5=AA=92=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=88=86=E4=BA=AB=EF=BC=8C=E4=BC=98=E5=85=88=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=9B=BE=E7=89=87=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=88=99=E8=AF=BB=E5=8F=96=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index 28f5fbc0..f57afd0c 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -753,7 +753,7 @@ class Information extends CI_Controller if (!empty($information->ic_photo)) { $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo; }else{ - $full_ic_photo = get_meta($data->ic_id, 'meta_addon_picture_mobile'); + $full_ic_photo = get_meta($information->ic_id, 'meta_addon_picture_mobile'); } if(!empty($full_ic_photo)){ $template = str_replace('', '', $template); @@ -937,7 +937,7 @@ class Information extends CI_Controller if (!empty($information->ic_photo)) { $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo; }else{ - $full_ic_photo = get_meta($data->ic_id, 'meta_addon_picture_mobile'); + $full_ic_photo = get_meta($information->ic_id, 'meta_addon_picture_mobile'); } if(!empty($full_ic_photo)){ $template = str_replace('', '', $template); From 23897c587510e69c6cbc347693f3b64094da3902 Mon Sep 17 00:00:00 2001 From: LiaoYijun Date: Thu, 9 Sep 2021 15:04:32 +0800 Subject: [PATCH 3/3] =?UTF-8?q?AH=20=E5=A2=9E=E5=8A=A0=E5=8D=95=E5=85=83?= =?UTF-8?q?=E5=B9=BF=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 6 ++---- application/views/mobile_first/ah-h1.php | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index f57afd0c..d6c009b0 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -862,6 +862,8 @@ class Information extends CI_Controller $data['meta_addon_picture_url'] = get_meta($information->ic_id, 'meta_addon_picture_url'); } + $ads_by_google = !empty(get_meta($information->ic_id, 'meta_google_ad_article')); + $data['ads_by_google'] = $ads_by_google; $data['author'] = $this->Operator_model->get_author_nikename($information->ic_author); //获取作者信息 $template_H1 = $this->load->view($template_path . '-h1', $data, TRUE); $template = str_replace('', $template_H1, $template); @@ -927,10 +929,6 @@ class Information extends CI_Controller //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); - } //社媒分享图片 $full_ic_photo=''; diff --git a/application/views/mobile_first/ah-h1.php b/application/views/mobile_first/ah-h1.php index 006e095d..d95917c3 100644 --- a/application/views/mobile_first/ah-h1.php +++ b/application/views/mobile_first/ah-h1.php @@ -1,14 +1,11 @@
-
- <?php echo !empty($information->ic_title)?$information->ic_title:'H1 title asiahighlights mobile first template'; ?> -

ic_title)?$information->ic_title:'H1 title asiahighlights mobile first template'; ?>

@@ -16,6 +13,23 @@
- -
+ + + + + + \ No newline at end of file