diff --git a/application/controllers/information.php b/application/controllers/information.php index df7adbcf..d6c009b0 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($information->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) { @@ -812,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); @@ -877,15 +929,18 @@ 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=''; if (!empty($information->ic_photo)) { $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo; + }else{ + $full_ic_photo = get_meta($information->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 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 @@