diff --git a/application/config/config.php b/application/config/config.php index dfdb653d..94b6c5c4 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -396,6 +396,7 @@ $config['site'] = [ 'ah' => ['site_code' => 'ah', 'site_id' => 141, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.asiahighlights.com', 'site_url' => 'https://www.asiahighlights.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']], 'jh' => ['site_code' => 'jh', 'site_id' => 186, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.japanhighlights.com', 'site_url' => 'https://www.japanhighlights.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']], 'htravel' => ['site_code' => 'htravel', 'site_id' => 187, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.highlightstravel.com', 'site_url' => 'https://www.highlightstravel.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']], + 'thailand' => ['site_code' => 'thailand', 'site_id' => 188, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.thailandhighlights.com', 'site_url' => 'https://www.thailandhighlights.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']], 'gh' => ['site_code' => 'gh', 'site_id' => 163, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.globalhighlights.com', 'site_url' => 'https://www.globalhighlights.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']], 'gm' => ['site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'https://www.chinahighlightstravel.de', 'site_image_url' => '//images.chinahighlightstravel.de', 'site_authors' => ['DX', 'X', 'K', 'Lan', 'lmr', 'zyh', 'ZYHL', 'TDJ'], 'site_user' => ',ycc,lmr,B,zyh,DX,X,K,htc,zm,bhn,Lan,Tony,zyh,J,v,ZYHL,TDJ,LYY,shw,'], 'gh_gm' => ['site_code' => 'gh_gm', 'site_id' => 178, 'site_lgc' => '4', 'site_url' => 'https://www.globalhighlights.de', 'site_image_url' => '//www.globalhighlights.de', 'site_authors' => ['DX', 'X', 'K', 'Lan', 'lmr', 'zyh', 'ZYHL', 'TDJ'], 'site_user' => ',ycc,lmr,B,zyh,DX,X,K,htc,zm,bhn,Lan,Tony,zyh,J,v,ZYHL,TDJ,LYY,shw,'], @@ -551,6 +552,7 @@ $config['css_source_yz'] = 'https://www.yangtzeriver.org/css/css3/bootstrap/boot $config['css_source_ah'] = 'https://data.asiahighlights.com/css/mobile-first.css'; $config['css_source_jh'] = 'https://data.japanhighlights.com/css/mobile-first.css'; $config['css_source_htravel'] = 'https://data.highlightstravel.com/css/mobile-first.css'; +$config['css_source_thailand'] = 'https://data.thailandhighlights.comcss/mobile-first.css'; $config['css_source_gh'] = 'https://data.globalhighlights.com/css/gh-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'] = 'https://data.chinatravel.com/css/newcss3/base.css'; @@ -567,6 +569,7 @@ $config['cache']['ah']['cache_path'] = 'D:\wwwcache\asiahighlights.com'; $config['cache']['jh']['cache_path'] = 'D:\wwwcache\japanhighlights.com'; $config['cache']['gh']['cache_path'] = 'D:\wwwcache\globalhighlights.com'; $config['cache']['htravel']['cache_path'] = 'D:\wwwcache\highlightstravel.com'; +$config['cache']['thailand']['cache_path'] = 'D:\wwwcache\thailandhighlights.com'; $config['cache']['chinatravel']['cache_path'] = 'D:\wwwcache\mobile-first\chinatravel.com'; $config['cache']['shanghai']['cache_path'] = 'D:\wwwcache\mobile-first\shanghaihighlights.com'; $config['cache']['beijing']['cache_path'] = 'D:\wwwcache\mobile-first\mybeijingchina.com'; diff --git a/application/controllers/information.php b/application/controllers/information.php index 6741b7b2..5b745cfb 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -763,6 +763,11 @@ class Information extends CI_Controller { $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_jh('mobile', $information_new, $recommand_information); $this->make_www_cache_jh('pc', $information_new, $recommand_information); + } else if (strcasecmp($site_code, "thailand") == 0 && ! empty($auto_update_cache)) { + $recommand_information = $this->recommand_information($information); + $information_new = $this->Information_model->Detail($this->input->post('is_id')); + $this->make_www_cache_thailand('mobile', $information_new, $recommand_information); + $this->make_www_cache_thailand('pc', $information_new, $recommand_information); } else if (strcasecmp($site_code, "chinatravel") == 0 && ! empty($auto_update_cache)) { //chinatravel读取模板生成PC和移动优先文件 $information_new = $this->Information_model->Detail($this->input->post('is_id')); @@ -873,6 +878,9 @@ class Information extends CI_Controller { } else if ($this->config->item('site_code') == 'jh') { $this->make_www_cache_jh('pc', $information, $recommand_information); $this->make_www_cache_jh('mobile', $information, $recommand_information); + }else if ($this->config->item('site_code') == 'thailand') { + $this->make_www_cache_thailand('pc', $information, $recommand_information); + $this->make_www_cache_thailand('mobile', $information, $recommand_information); } else if ($this->config->item('site_code') == 'chinatravel') { $this->make_www_cache_ct($information); // $this->make_www_cache_ct('mobile', $information); @@ -2654,6 +2662,358 @@ class Information extends CI_Controller { file_put_contents($html_path, $template, LOCK_EX); } + + public function make_www_cache_thailand($device, $information, $recommand_information) { + + $data = []; + $data['information'] = $information; + $recommand_template = ''; + $meta_show_advertise = get_meta($information->ic_id, 'meta_show_advertise'); + $data['meta_show_advertise'] = $meta_show_advertise; + 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; + } + $recommand_template = 'mobile_first/thailand-next-mobile'; + 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; + } + $recommand_template = 'mobile_first/thailand-next'; + 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); + + //顶部视频 + $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'); + } + + // AH Home 下层节点名称和链接映射 + $group_map = [ + 278011836 => [ + 'ic_url' => '/about-us', + 'ic_url_title' => 'About Us', + ], + ]; + + $breadcrumb_data = $this->Information_model->get_breadcrumb_data($information->is_id, $information->is_path, $group_map); + $ads_by_google = ! empty(get_meta($information->ic_id, 'meta_google_ad_article')); + $data['meta_news_createdate'] = $this->get_publish_date_in_6_month($information); + $data['ads_by_google'] = $ads_by_google; + $data['author_name'] = ''; //获取作者信息 + $author = $this->Operator_model->get_author_nikename($information->ic_author); + $data['author_info'] = ['url' => '', 'avatar' => '', 'expertise' => '']; + + if (!empty($author)) { + $data['author_name'] = $author->OPI_FirstName; + $data['OPI_Code'] = $author->OPI_Code; + + $author_info = $this->get_author_info('thailandhighlights.com', $author->OPI_Code); + $data['author_info'] = $author_info; + } else { + $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 + if (!empty($author_web)) { + $data['author_name'] = $author_web->a_name; + $author_info = ['url' => '', 'avatar' => '', 'expertise' => '']; + } + } + $data['breadcrumb_data'] = $breadcrumb_data; + $template_H1 = $this->load->view($template_path . '-h1', $data, true); + $template = str_replace('', $template_H1, $template); + // 结构化标签:Article + $article_structured_data_content = $this->load->view( + $template_path . '-structured-data-article', + ['information' => $information, 'author_name' => $data['author_name'], 'author_url' => $author_info['url']], + true + ); + $template = str_replace('', $article_structured_data_content, $template); + // 结构化标签:BreadcrumbList + $breadcrumb_structured_data_content = $this->load->view( + $template_path . '-structured-data-breadcrumb', + ['breadcrumb_data' => $breadcrumb_data, 'information' => $information], + true + ); + $template = str_replace( + '', + $breadcrumb_structured_data_content, + $template + ); + + //推荐信息或者产品 + $template_recommand = $recommand_information; + $template = str_replace('', $this->load->view($recommand_template, ['recommands' => $template_recommand], true), $template); + //广告,改叫tips,防止被插件屏蔽 + if (! empty($template_recommand['Tips Right']) && ($meta_show_advertise == 'yes' || empty($meta_show_advertise))) { + $template = str_replace('', "