From 302fbaa7ab16a393e8605f4128917ed58bc2527c Mon Sep 17 00:00:00 2001 From: LMR <59361885@qq.com> Date: Thu, 15 Jan 2026 08:21:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8A=82=E7=82=B9=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E5=88=A0=E9=99=A4=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 3463 ++++++++++++----------- 1 file changed, 1755 insertions(+), 1708 deletions(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index 281ebd77..7a68daae 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -1,12 +1,14 @@ permission->is_admin(); //$this->output->enable_profiler(TRUE); @@ -32,19 +34,21 @@ class Information extends CI_Controller { } - public function index() { + public function index() + { echo '信息首页'; } - public function add($is_parent_id) { + public function add($is_parent_id) + { //添加空内容. $this->InfoContents_model->Add('', 'New Information', '', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', 0, '', 0, '', ''); $infocontent = $this->InfoContents_model->get_ic_contents($this->InfoContents_model->insert_id); - if (! empty($infocontent) && $this->InfoStructures_model->Add($is_parent_id, $this->InfoContents_model->insert_id)) { - $is_id = $this->InfoStructures_model->insert_id; - $InfoStructures = $this->InfoStructures_model->Detail($is_id); + if (!empty($infocontent) && $this->InfoStructures_model->Add($is_parent_id, $this->InfoContents_model->insert_id)) { + $is_id = $this->InfoStructures_model->insert_id; + $InfoStructures = $this->InfoStructures_model->Detail($is_id); $InfoStructures->is_id = $is_id; - $data[] = ['name' => 'ok', 'value' => $InfoStructures]; + $data[] = ['name' => 'ok', 'value' => $InfoStructures]; $this->Logs_model->add($this->InfoStructures_model->insert_id); } else { $data[] = ['name' => 'no', 'value' => $this->lang->line('form_info_error')]; @@ -54,11 +58,12 @@ class Information extends CI_Controller { } //移动结构顺序 - public function move() { + public function move() + { //网站会提交一个同级节点id列表字符串,按照这个去排序 $parent_id = $this->input->post('pid'); - $idsStr = $this->input->post('ids'); - $idsArray = explode(',', $idsStr); + $idsStr = $this->input->post('ids'); + $idsArray = explode(',', $idsStr); foreach ($idsArray as $key => $value) { if ($value) { //设置排序 @@ -75,9 +80,10 @@ class Information extends CI_Controller { //把文章移动到任意板块文章下 //is_id 信息结构ID,is_parent_id即将转移到的信息结构id - public function move_by_is_id() { - $data = []; - $is_id = $this->input->post('is_id'); + public function move_by_is_id() + { + $data = []; + $is_id = $this->input->post('is_id'); $is_parent_id = $this->input->post('is_parent_id'); if ($is_id == $is_parent_id || empty($is_id) || empty($is_parent_id)) { return false; @@ -102,7 +108,8 @@ class Information extends CI_Controller { //[国际->国际]复制节点结构到任意站点的节点下面。-- lmr //is_id 信息结构ID, - public function copy_by_is_id($src_is_id, $dest_is_id) { + public function copy_by_is_id($src_is_id, $dest_is_id) + { if (empty($src_is_id) || empty($src_is_id)) { echo 'need 2 is_id v1'; return false; @@ -114,7 +121,7 @@ class Information extends CI_Controller { return false; } // 源节点 - $src = $this->InfoStructures_model->Detail($src_is_id); + $src = $this->InfoStructures_model->Detail($src_is_id); $src_path = $this->Information_model->get_list_by_path($src->is_path, false, $src->is_sitecode); // 源子节点 foreach ($src_path as $n => $item) { @@ -123,7 +130,7 @@ class Information extends CI_Controller { } } // 目标节点结构 - $dest = $this->InfoStructures_model->Detail($dest_is_id); + $dest = $this->InfoStructures_model->Detail($dest_is_id); $dest_path = $this->Information_model->get_list_by_path($dest->is_path, false, $dest->is_sitecode); // 目标子节点 foreach ($dest_path as $n => $item) { @@ -173,70 +180,70 @@ class Information extends CI_Controller { ); // info_meta - $item_meta_amp = $this->InfoMetas_model->get($item->is_ic_id, 'AMP'); - $item_meta_ampbody = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_BODY'); - $item_meta_ampcss = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_CSS'); + $item_meta_amp = $this->InfoMetas_model->get($item->is_ic_id, 'AMP'); + $item_meta_ampbody = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_BODY'); + $item_meta_ampcss = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_CSS'); $item_meta_ampscript = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_SCRIPT'); - $item_meta_ampjson = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_JSON'); + $item_meta_ampjson = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_JSON'); $item_meta_ampstatus = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_STATUS'); - $item_meta_pcstatus = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_BODY_PC_STATUS'); - $item_meta_pcbody = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_BODY_PC'); - $item_meta_pccss = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_CSS_PC'); - $item_meta_pcschema = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_SCHEMA'); + $item_meta_pcstatus = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_BODY_PC_STATUS'); + $item_meta_pcbody = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_BODY_PC'); + $item_meta_pccss = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_CSS_PC'); + $item_meta_pcschema = $this->InfoMetas_model->get($item->is_ic_id, 'AMP_SCHEMA'); - if (! empty($item_meta_amp)) { + if (!empty($item_meta_amp)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP', $item_meta_amp); } - if (! empty($item_meta_ampbody)) { + if (!empty($item_meta_ampbody)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY', $item_meta_ampbody); } - if (! empty($item_meta_ampcss)) { + if (!empty($item_meta_ampcss)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_CSS', $item_meta_ampcss); } - if (! empty($item_meta_ampscript)) { + if (!empty($item_meta_ampscript)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_SCRIPT', $item_meta_ampscript); } - if (! empty($item_meta_ampjson)) { + if (!empty($item_meta_ampjson)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_JSON', $item_meta_ampjson); } - if (! empty($item_meta_ampstatus)) { + if (!empty($item_meta_ampstatus)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_STATUS', $item_meta_ampstatus); } - if (! empty($item_meta_pcstatus)) { + if (!empty($item_meta_pcstatus)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY_PC_STATUS', $item_meta_pcstatus); } - if (! empty($item_meta_pcbody)) { + if (!empty($item_meta_pcbody)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY_PC', $item_meta_pcbody); } - if (! empty($item_meta_pccss)) { + if (!empty($item_meta_pccss)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_CSS_PC', $item_meta_pccss); } - if (! empty($item_meta_pcschema)) { + if (!empty($item_meta_pcschema)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_SCHEMA', $item_meta_pcschema); } // gm 补充meta $item_meta_addon_css = $this->InfoMetas_model->get($item->is_ic_id, 'meta_addon_css'); - if (! empty($item_meta_addon_css)) { + if (!empty($item_meta_addon_css)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_addon_css', $item_meta_addon_css); } $item_meta_addon_js = $this->InfoMetas_model->get($item->is_ic_id, 'meta_addon_js'); - if (! empty($item_meta_addon_js)) { + if (!empty($item_meta_addon_js)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_addon_js', $item_meta_addon_js); } $item_meta_use_list_picture = $this->InfoMetas_model->get($item->is_ic_id, 'meta_use_list_picture'); - if (! empty($item_meta_use_list_picture)) { + if (!empty($item_meta_use_list_picture)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_use_list_picture', $item_meta_use_list_picture); } @@ -260,7 +267,8 @@ class Information extends CI_Controller { //[国际<-德语][在int.mycht.cn上执行]复制节点结构到任意站点的节点下面。-- lmr //is_id 信息结构ID, - public function copy_by_is_id_gm($src_is_id, $dest_is_id) { + public function copy_by_is_id_gm($src_is_id, $dest_is_id) + { if (empty($src_is_id) || empty($src_is_id)) { echo 'need 2 is_id v1'; return false; @@ -273,7 +281,7 @@ class Information extends CI_Controller { } // 源节点 - $src = $this->InfoStructures_model->Detail_gm($src_is_id); + $src = $this->InfoStructures_model->Detail_gm($src_is_id); $src_path = $this->Information_model->get_list_by_path_gm($src->is_path, false, $src->is_sitecode); // 源子节点 foreach ($src_path as $n => $item) { @@ -283,7 +291,7 @@ class Information extends CI_Controller { } // 目标节点结构 - $dest = $this->InfoStructures_model->Detail($dest_is_id); + $dest = $this->InfoStructures_model->Detail($dest_is_id); $dest_path = $this->Information_model->get_list_by_path($dest->is_path, false, $dest->is_sitecode); // 目标子节点 foreach ($dest_path as $n => $item) { @@ -333,75 +341,75 @@ class Information extends CI_Controller { ); // info_meta - $item_meta_amp = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP'); - $item_meta_ampbody = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_BODY'); - $item_meta_ampcss = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_CSS'); + $item_meta_amp = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP'); + $item_meta_ampbody = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_BODY'); + $item_meta_ampcss = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_CSS'); $item_meta_ampscript = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_SCRIPT'); - $item_meta_ampjson = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_JSON'); + $item_meta_ampjson = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_JSON'); $item_meta_ampstatus = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_STATUS'); - $item_meta_pcstatus = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_BODY_PC_STATUS'); - $item_meta_pcbody = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_BODY_PC'); - $item_meta_pccss = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_CSS_PC'); - $item_meta_pcschema = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_SCHEMA'); + $item_meta_pcstatus = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_BODY_PC_STATUS'); + $item_meta_pcbody = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_BODY_PC'); + $item_meta_pccss = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_CSS_PC'); + $item_meta_pcschema = $this->InfoMetas_model->get_gm($item->is_ic_id, 'AMP_SCHEMA'); - if (! empty($item_meta_amp)) { + if (!empty($item_meta_amp)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP', $item_meta_amp); } - if (! empty($item_meta_ampbody)) { + if (!empty($item_meta_ampbody)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY', $item_meta_ampbody); } - if (! empty($item_meta_ampcss)) { + if (!empty($item_meta_ampcss)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_CSS', $item_meta_ampcss); } - if (! empty($item_meta_ampscript)) { + if (!empty($item_meta_ampscript)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_SCRIPT', $item_meta_ampscript); } - if (! empty($item_meta_ampjson)) { + if (!empty($item_meta_ampjson)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_JSON', $item_meta_ampjson); } - if (! empty($item_meta_ampstatus)) { + if (!empty($item_meta_ampstatus)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_STATUS', $item_meta_ampstatus); } - if (! empty($item_meta_pcstatus)) { + if (!empty($item_meta_pcstatus)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY_PC_STATUS', $item_meta_pcstatus); } - if (! empty($item_meta_pcbody)) { + if (!empty($item_meta_pcbody)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_BODY_PC', $item_meta_pcbody); } - if (! empty($item_meta_pccss)) { + if (!empty($item_meta_pccss)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_CSS_PC', $item_meta_pccss); } - if (! empty($item_meta_pcschema)) { + if (!empty($item_meta_pcschema)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'AMP_SCHEMA', $item_meta_pcschema); } // gm 补充meta $item_meta_addon_css = $this->InfoMetas_model->get_gm($item->is_ic_id, 'meta_addon_css'); - if (! empty($item_meta_addon_css)) { + if (!empty($item_meta_addon_css)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_addon_css', $item_meta_addon_css); } $item_meta_addon_js = $this->InfoMetas_model->get_gm($item->is_ic_id, 'meta_addon_js'); - if (! empty($item_meta_addon_js)) { + if (!empty($item_meta_addon_js)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_addon_js', $item_meta_addon_js); } $item_meta_use_list_picture = $this->InfoMetas_model->get_gm($item->is_ic_id, 'meta_use_list_picture'); - if (! empty($item_meta_use_list_picture)) { + if (!empty($item_meta_use_list_picture)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_use_list_picture', $item_meta_use_list_picture); } $item_meta_product_code = $this->InfoMetas_model->get_gm($item->is_ic_id, 'meta_product_code'); - if (! empty($item_meta_product_code)) { + if (!empty($item_meta_product_code)) { $this->InfoMetas_model->Add($this->InfoContents_model->insert_id, 'meta_product_code', $item_meta_product_code); } @@ -423,7 +431,8 @@ class Information extends CI_Controller { return true; } - public function delete($is_id) { + public function delete($is_id, $force = false) + { //查询结构信息 $Structure = $this->InfoStructures_model->Detail($is_id); if ($Structure == false) { @@ -431,21 +440,14 @@ class Information extends CI_Controller { echo json_encode($data); return false; } - if ($this->InfoStructures_model->HasChild($Structure->is_id)) { + if ($force || $this->InfoStructures_model->HasChild($Structure->is_id)) { $data[] = ['name' => 'no', 'value' => $this->lang->line('structures_error_haschild')]; echo json_encode($data); return false; } else { $info_detail = $this->Information_model->Detail($is_id); - - //删除前,备份amp的meta标签-isid。 - //$meta_value = $this->InfoMetas_model->get($info_detail->ic_id, 'AMP_JSON'); - //if ($meta_value) { - // $this->Logs_model->backup_meta($info_detail->ic_id, $meta_value, 'AMP_JSON_' . $is_id); - //} - $this->Logs_model->delete($is_id, $info_detail->ic_content); - if (! empty($info_detail->ic_summary)) { + if (!empty($info_detail->ic_summary)) { $this->Logs_model->backup_summary($is_id, $info_detail->ic_summary); } $this->InfoStructures_model->Delete($Structure->is_id); @@ -466,7 +468,8 @@ class Information extends CI_Controller { } } - public function edit($is_id) { + public function edit($is_id) + { set_time_limit(30); //$this->output->enable_profiler(true); //查询结构信息 @@ -541,47 +544,47 @@ class Information extends CI_Controller { $data['infoTypeList'] = $this->config->item('InfoType_htravel'); } else { switch ($data['rootInformation']->ic_ht_area_type) { - case 'c': //城市 - $data['infoTypeList'] = $this->config->item('InfoType_city'); - $data['unlink_landscape_list'] = $this->Information_model->get_unlink_landscape_list($data['rootInformation']->ic_ht_area_id); - break; - case 'p': //省份 - $data['infoTypeList'] = $this->config->item('InfoType_province'); - break; - case 'n': //国家 - $data['infoTypeList'] = $this->config->item('InfoType_country'); - break; - case 't': //特殊区域 - $data['infoTypeList'] = $this->config->item('InfoType_special'); - break; - case 'e': //大洲 - $data['infoTypeList'] = []; - break; - case 'z': //公民游 - $data['infoTypeList'] = $this->config->item('InfoType_citizen'); - break; - case 'v': //视频 - $data['infoTypeList'] = $this->config->item('InfoType_video'); - break; - case 'f': //节庆 - $data['infoTypeList'] = $this->config->item('InfoType_festival'); - break; - case 'pd': //产品管理 - $data['infoTypeList'] = $this->config->item('InfoType_product'); - //LMR 2016-7-14 - if (in_array($this->config->item('site_code'), ['vac', 'vc', 'jp', 'ru', 'it'])) { - $this->config->set_item('templates', $this->config->item('templates_product_i')); - } else if ($this->config->item('site_code') === 'gm') { - $this->config->set_item('templates', $this->config->item('templates_product_gm')); - $data['infoTypeList'] = $this->config->item('InfoType_product_gm'); - } else { - $this->config->set_item('templates', $this->config->item('templates_product')); - } + case 'c': //城市 + $data['infoTypeList'] = $this->config->item('InfoType_city'); + $data['unlink_landscape_list'] = $this->Information_model->get_unlink_landscape_list($data['rootInformation']->ic_ht_area_id); + break; + case 'p': //省份 + $data['infoTypeList'] = $this->config->item('InfoType_province'); + break; + case 'n': //国家 + $data['infoTypeList'] = $this->config->item('InfoType_country'); + break; + case 't': //特殊区域 + $data['infoTypeList'] = $this->config->item('InfoType_special'); + break; + case 'e': //大洲 + $data['infoTypeList'] = []; + break; + case 'z': //公民游 + $data['infoTypeList'] = $this->config->item('InfoType_citizen'); + break; + case 'v': //视频 + $data['infoTypeList'] = $this->config->item('InfoType_video'); + break; + case 'f': //节庆 + $data['infoTypeList'] = $this->config->item('InfoType_festival'); + break; + case 'pd': //产品管理 + $data['infoTypeList'] = $this->config->item('InfoType_product'); + //LMR 2016-7-14 + if (in_array($this->config->item('site_code'), ['vac', 'vc', 'jp', 'ru', 'it'])) { + $this->config->set_item('templates', $this->config->item('templates_product_i')); + } else if ($this->config->item('site_code') === 'gm') { + $this->config->set_item('templates', $this->config->item('templates_product_gm')); + $data['infoTypeList'] = $this->config->item('InfoType_product_gm'); + } else { + $this->config->set_item('templates', $this->config->item('templates_product')); + } - break; - default: - $data['infoTypeList'] = ['不设置' => 'none', '首页' => 'root', '线路' => 'pd_tour']; - break; + break; + default: + $data['infoTypeList'] = ['不设置' => 'none', '首页' => 'root', '线路' => 'pd_tour']; + break; } } @@ -590,18 +593,18 @@ class Information extends CI_Controller { $data['productTypeList'] = $this->config->item('ProductType_HT'); //获取绑定的产品名称 switch ($data['information']->ic_ht_product_type) { - case 't': - $data['product_title'] = $this->Landscape_model->get_landscape_title($data['information']->ic_ht_product_id); - break; - default: - $data['product_title'] = ''; - break; + case 't': + $data['product_title'] = $this->Landscape_model->get_landscape_title($data['information']->ic_ht_product_id); + break; + default: + $data['product_title'] = ''; + break; } //获取最后更新者信息 $data['last_edit_info'] = $this->Logs_model->get_last_edit($is_id); //编辑列表 - $sites = $this->config->item('site'); + $sites = $this->config->item('site'); $data['editor_list'] = $this->Operator_model->get_site_user($this->config->item('site_code')); //获取作者列表 $data['author_list'] = $this->Infoauthors_model->get_site_user($this->config->item('site_code')); @@ -612,7 +615,7 @@ class Information extends CI_Controller { //所属导航栏目 $data['setting_website_nav'] = $this->InfoMetas_model->get_list(0, 'setting_website_nav_' . strtolower($this->config->item('site_code'))); - $data['my_tags'] = []; + $data['my_tags'] = []; $data['all_tags'] = []; if (is_series_site()) { //信息标签 @@ -666,7 +669,8 @@ class Information extends CI_Controller { $this->load->view('bootstrap3/footer'); } - public function edit_save() { + public function edit_save() + { header('Cache-Control: no-cache'); $information = $this->Information_model->Detail($this->input->post('is_id')); if ($information === false) { @@ -704,13 +708,13 @@ class Information extends CI_Controller { //AMP更新和生成 beign $auto_update_amp = $this->input->get_post('auto_update_amp'); - if (! empty($auto_update_amp) && $auto_update_amp == 'true' && $this->input->post('ic_status') == 1) { + if (!empty($auto_update_amp) && $auto_update_amp == 'true' && $this->input->post('ic_status') == 1) { $amp_result = $this->amplib->auto_create($information->ic_id); - if (! empty($amp_result)) { + if (!empty($amp_result)) { $amp_result = json_decode($amp_result); if ($amp_result->result == 'ok') { $amp_save_result = $this->amplib->edit_save($information->ic_id, $amp_result->data->amp, '1'); - if (! empty($amp_save_result)) { + if (!empty($amp_save_result)) { $amp_save_result = json_decode($amp_save_result); if ($amp_save_result->name == 'no') { echo json_encode(['name' => 'no', 'value' => 'AMP转换语法错误,请重新进入AMP编辑器检查']); @@ -732,13 +736,13 @@ class Information extends CI_Controller { } //德语站FAQ版块需要删除原来的文件才能更新静态 - $site_code = $this->config->item('site_code'); - $ic_url = $this->input->post('ic_url'); + $site_code = $this->config->item('site_code'); + $ic_url = $this->input->post('ic_url'); $auto_update_cache = $this->input->get_post('auto_update_cache_checkbox'); - if (strcasecmp($site_code, "gm") == 0 && ! empty($auto_update_cache)) { + if (strcasecmp($site_code, "gm") == 0 && !empty($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url, true); - } else if (strcasecmp($site_code, "ch") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "ch") == 0 && !empty($auto_update_cache)) { //读取模板生成PC和移动优先文件 $information_new = $this->Information_model->Detail($this->input->post('is_id')); //$this->benchmark->mark('000'); @@ -747,53 +751,53 @@ class Information extends CI_Controller { $this->make_www_cache('mobile', $information_new, $recommand_information); $this->make_www_cache('pc', $information_new, $recommand_information); //echo ' |000~111: '.$this->benchmark->elapsed_time('000', '111'); - } else if (strcasecmp($site_code, "htravel") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "htravel") == 0 && !empty($auto_update_cache)) { //读取模板生成PC和移动优先文件 $recommand_information = $this->recommand_information($information); - $information_new = $this->Information_model->Detail($this->input->post('is_id')); + $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_htravel('mobile', $information_new, $recommand_information); $this->make_www_cache_htravel('pc', $information_new, $recommand_information); - } else if (strcasecmp($site_code, "gh") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "gh") == 0 && !empty($auto_update_cache)) { $recommand_information = $this->recommand_information($information); - $information_new = $this->Information_model->Detail($this->input->post('is_id')); + $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_gh('mobile', $information_new, $recommand_information); $this->make_www_cache_gh('pc', $information_new, $recommand_information); - } else if (strcasecmp($site_code, "jh") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "jh") == 0 && !empty($auto_update_cache)) { $recommand_information = $this->recommand_information($information); - $information_new = $this->Information_model->Detail($this->input->post('is_id')); + $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, "chinatravel") == 0 && ! empty($auto_update_cache)) { + } 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($information_new); // $this->make_www_cache_ct('pc', $information_new); - } else if (strcasecmp($site_code, "shanghai") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "shanghai") == 0 && !empty($auto_update_cache)) { $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_sh($information_new); - } else if (strcasecmp($site_code, "beijing") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "beijing") == 0 && !empty($auto_update_cache)) { $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_bj($information_new); - } else if (strcasecmp($site_code, "trainspread") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "trainspread") == 0 && !empty($auto_update_cache)) { $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_ts($information_new); - } else if (strcasecmp($site_code, "guilin") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "guilin") == 0 && !empty($auto_update_cache)) { $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_gl($information_new); - } else if (strcasecmp($site_code, "hly") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "hly") == 0 && !empty($auto_update_cache)) { $information_new = $this->Information_model->Detail($this->input->post('is_id')); $this->make_www_cache_hly($information_new); - } else if (strcasecmp($site_code, "cht") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url); - } else if (strcasecmp($site_code, "htravel") == 0 && ! empty($auto_update_cache)) { - //$update_info_log = $this->update_cache($ic_url); + } else if (strcasecmp($site_code, "htravel") == 0 && !empty($auto_update_cache)) { + //$update_info_log = $this->update_cache($ic_url); } else if (strcasecmp($site_code, "cht") != 0 && strcasecmp($site_code, "gm") != 0 && strcasecmp($site_code, "htravel") != 0) { //非cht站点并且非GM并且非AH $update_info_log = $this->update_cache($ic_url); - } else if (strcasecmp($site_code, "ct") == 0 && ! empty($auto_update_cache)) { + } else if (strcasecmp($site_code, "ct") == 0 && !empty($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url); } - if (empty($update_info_log) || count($update_info_log) == 0 || ! isset($update_info_log[0]['url'])) { + if (empty($update_info_log) || count($update_info_log) == 0 || !isset($update_info_log[0]['url'])) { $update_info_log = 'not found update info log'; } @@ -804,10 +808,10 @@ class Information extends CI_Controller { //作者个人页面更新 if ($this->config->item('site_code') == 'cht') { $author_pages = [ - 'zzy' => 'http://www.chinahighlights.com/author/ruru-zhou/', - 'Gavin' => 'http://www.chinahighlights.com/author/gavin-van-hinsbergh/', - 'WBL' => 'http://www.chinahighlights.com/author/annie-wu/', - 'PKL' => 'http://www.chinahighlights.com/author/kelly/', + 'zzy' => 'http://www.chinahighlights.com/author/ruru-zhou/', + 'Gavin' => 'http://www.chinahighlights.com/author/gavin-van-hinsbergh/', + 'WBL' => 'http://www.chinahighlights.com/author/annie-wu/', + 'PKL' => 'http://www.chinahighlights.com/author/kelly/', '210000017' => 'http://www.chinahighlights.com/author/lynne-buddin/', '202000027' => 'http://www.chinahighlights.com/author/margaux/', '202000019' => 'http://www.chinahighlights.com/author/anusuya-mitra/', @@ -831,7 +835,8 @@ class Information extends CI_Controller { } //URL不重复检查 - public function ic_url_check() { + public function ic_url_check() + { if ($this->input->post('ignore_url_check')) { return true; } @@ -845,14 +850,16 @@ class Information extends CI_Controller { } //URL格式检查,不能包含大小写、空格等特殊字符 - public function ic_url_format($url) { + public function ic_url_format($url) + { if ($url != mb_strtolower($url) || strpos($url, ' ') !== false || strpos($url, '--') !== false || strpos($url, ')') !== false || strpos($url, '(') !== false || strpos($url, '//') !== false || strpos($url, '\\') !== false) { return false; } return true; } - public function update_www_cache($ic_id) { + public function update_www_cache($ic_id) + { $information = $this->Information_model->detail_by_ic_id($ic_id); if (empty($information)) { echo json_encode(['name' => 'no', 'data' => '找不到这个页面']); @@ -897,7 +904,8 @@ class Information extends CI_Controller { } //静态文件操作 - public function html_file_helper($active = 'find', $ic_url = false) { + public function html_file_helper($active = 'find', $ic_url = false) + { if (empty($ic_url)) { $ic_url = $this->input->get_post('ic_url'); } @@ -910,78 +918,79 @@ class Information extends CI_Controller { $html_file = $html_file . 'index.htm'; } $html_file_mobile = $html_file . '-mobile.htm'; - $html_file_pc = $html_file . '-pc.htm'; + $html_file_pc = $html_file . '-pc.htm'; switch ($active) { - case 'find': //寻找静态文件 - if (is_file($html_file_mobile) || is_file($html_file_pc)) { - return true; - } else { + case 'find': //寻找静态文件 + if (is_file($html_file_mobile) || is_file($html_file_pc)) { + return true; + } else { + return false; + } + // break; + case 'delete': + if (is_file($html_file_mobile)) { + unlink($html_file_mobile); + } + if (is_file($html_file_pc)) { + unlink($html_file_pc); + } + echo '删除静态文件成功! ' . $ic_url; + break; + default: return false; - } - // break; - case 'delete': - if (is_file($html_file_mobile)) { - unlink($html_file_mobile); - } - if (is_file($html_file_pc)) { - unlink($html_file_pc); - } - echo '删除静态文件成功! ' . $ic_url; - break; - default: - return false; } return false; } //生成静态文件 $device='mobile' or 'pc' - public function make_www_cache($device, $information, $recommand_information) { + public function make_www_cache($device, $information, $recommand_information) + { $data = []; 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: + 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: } // CH Home 下层节点名称和链接映射 $group_map = [ 278008010 => [ - 'ic_url' => '/travelguide/culture/', + 'ic_url' => '/travelguide/culture/', 'ic_url_title' => 'Chinese Culture', ], 278008011 => [ - 'ic_url' => '/citytour/', + 'ic_url' => '/citytour/', 'ic_url_title' => 'Destinations', ], 278008012 => [ - 'ic_url' => '/aboutus/', + 'ic_url' => '/aboutus/', 'ic_url_title' => 'About Us', ], 278008013 => [ - 'ic_url' => '/citytour/', + 'ic_url' => '/citytour/', 'ic_url_title' => 'City Tours', ], 278008014 => [ - 'ic_url' => '/tour/', + 'ic_url' => '/tour/', 'ic_url_title' => 'China Tours', ], ]; @@ -1010,14 +1019,14 @@ class Information extends CI_Controller { // 解析结果:; Shanghai,Beijing $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $city_name_list = explode(',', $city_name_string); - $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list, FALSE); + $city_name_list = explode(',', $city_name_string); + $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list, FALSE); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/ch-feedback-list', ['feedback_list' => $top3_feedback_list], true @@ -1035,10 +1044,10 @@ class Information extends CI_Controller { // 解析结果:; Bangkok $feedback30_array = []; preg_match_all('^^', $information->ic_content, $feedback30_array); - if (! empty($feedback30_array)) { + if (!empty($feedback30_array)) { foreach ($feedback30_array[0] as $index => $tag_name) { - $city_name = $feedback30_array[1][$index]; - $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 30, FALSE); + $city_name = $feedback30_array[1][$index]; + $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 30, FALSE); $feedback_30_content = $this->load->view( 'mobile_first/ch-feedback-30-list', ['feedback_list' => $feedback_list], @@ -1055,14 +1064,14 @@ class Information extends CI_Controller { // 集合页面反馈标签 $feedback_city_array = []; preg_match_all('^^', $information->ic_content, $feedback_city_array); - if (! empty($feedback_city_array)) { + if (!empty($feedback_city_array)) { foreach ($feedback_city_array[0] as $index => $tag_name) { - $city_name_string = $feedback_city_array[1][$index]; - $city_name_list = explode(',', $city_name_string); + $city_name_string = $feedback_city_array[1][$index]; + $city_name_list = explode(',', $city_name_string); $feedback_city_list = []; foreach ($city_name_list as $index => $city_name) { - $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 5, FALSE); - $data_name = str_replace(" ", "_", $city_name); + $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 5, FALSE); + $data_name = str_replace(" ", "_", $city_name); $feedback_city_list[$data_name] = $feedback_list; } @@ -1094,7 +1103,7 @@ class Information extends CI_Controller { // 火车票首页搜索框 --zp $template_TrainSearch = ""; if ($information->ic_url == "/china-trains/hometest.htm" || $information->ic_url == "/china-trains/") { - $template_TrainSearch = $this->load->view($template_path . '-train-index', null, true); + $template_TrainSearch = $this->load->view($template_path . '-train-index', null, true); $information->ic_content = str_replace( '', $template_TrainSearch, @@ -1102,43 +1111,43 @@ class Information extends CI_Controller { ); } - //火车票搜索框添加 -- zp + //火车票搜索框添加 -- zp if ($information->is_parent_id == "278008234" && $information->ic_url != "/china-trains/") { //20240403 字节 - //本地测试的火车父类ID为:278035939 。网前为:278008234 - $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai - $data_TrainCity = []; + //本地测试的火车父类ID为:278035939 。网前为:278008234 + $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai + $data_TrainCity = []; $data_TrainCity["from"] = ""; - $data_TrainCity["to"] = ""; - if (! empty($meta_train_city)) { + $data_TrainCity["to"] = ""; + if (!empty($meta_train_city)) { if (strpos($meta_train_city, '|') !== false) { - $arrTrainCity = explode('|', $meta_train_city); + $arrTrainCity = explode('|', $meta_train_city); $data_TrainCity["from"] = $arrTrainCity[0]; - $data_TrainCity["to"] = $arrTrainCity[1]; + $data_TrainCity["to"] = $arrTrainCity[1]; } } $template_TrainSearch = $this->load->view($template_path . '-train-detail', $data_TrainCity, true); - $template = str_replace('', $template_TrainSearch, $template); + $template = str_replace('', $template_TrainSearch, $template); } - $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); + $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); $meta_google_ad_article = get_meta($information->ic_id, 'meta_google_ad_article'); - $ads_by_google = ! empty($meta_google_ad_article); + $ads_by_google = !empty($meta_google_ad_article); //H1模板替换 - $data_H1 = []; - $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 - $data_H1['author'] = ''; //获取作者信息 + $data_H1 = []; + $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 + $data_H1['author'] = ''; //获取作者信息 $data_H1['meta_news_createdate'] = $this->get_publish_date_in_6_month($information); - $author_url = ''; - $author = $this->Operator_model->get_author_nikename($information->ic_author); - if (! empty($author)) { - $data_H1['author'] = $author->OPI_FirstName; + $author_url = ''; + $author = $this->Operator_model->get_author_nikename($information->ic_author); + if (!empty($author)) { + $data_H1['author'] = $author->OPI_FirstName; $data_H1['OPI_Code'] = $author->OPI_Code; - $author_url = $this->get_author_url('www.chinahighlights.com', $author->OPI_Code); + $author_url = $this->get_author_url('www.chinahighlights.com', $author->OPI_Code); } else { $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 - if (! empty($author_web)) { + if (!empty($author_web)) { $data_H1['author'] = $author_web->a_name; } } @@ -1148,12 +1157,12 @@ class Information extends CI_Controller { if ($device == 'mobile') { $meta_addon_picture_mobile = get_meta($information->ic_id, 'meta_addon_picture_mobile'); - if (! empty($meta_addon_picture_mobile)) { + if (!empty($meta_addon_picture_mobile)) { $parsed_photo = $meta_addon_picture_mobile; } } else { $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); - if (! empty($meta_addon_picture)) { + if (!empty($meta_addon_picture)) { $parsed_photo = $meta_addon_picture; } } @@ -1164,16 +1173,16 @@ class Information extends CI_Controller { //判断是否录入了//data.chinahighlihgts.com这种以前兼容http的图片url //如果有,就不需要改变图片url } else if ( - (! isset($parsed_photo_url['host']) || ! isset($parsed_photo_url['scheme'])) && isset($parsed_photo_url['path']) + (!isset($parsed_photo_url['host']) || !isset($parsed_photo_url['scheme'])) && isset($parsed_photo_url['path']) ) { $parsed_photo = 'https://images.chinahighlights.com' . $parsed_photo_url['path']; } - $data_H1['ic_title'] = $information->ic_title; - $data_H1['ic_photo'] = $parsed_photo; + $data_H1['ic_title'] = $information->ic_title; + $data_H1['ic_photo'] = $parsed_photo; $data_H1['breadcrumb_data'] = $breadcrumb_data; - $data_H1['ads_by_google'] = $ads_by_google; - $data_H1['ic_datetime'] = $information->ic_datetime; + $data_H1['ads_by_google'] = $ads_by_google; + $data_H1['ic_datetime'] = $information->ic_datetime; if ($information->ic_url == "/china-trains/" && $device == 'mobile') { //火车首页不需要头部大图及H1标题,但是需要一个H1的标签来占位置,避免表单上移 $template_H1 = "

"; @@ -1190,7 +1199,7 @@ class Information extends CI_Controller { $meta_addon_picture_mobile = get_meta($information->ic_id, 'meta_addon_picture_mobile'); $article_image_list = [$meta_addon_picture, $meta_addon_picture_mobile]; - $article_image_list = array_values(array_filter($article_image_list, function($value) { + $article_image_list = array_values(array_filter($article_image_list, function ($value) { return !empty($value); })); $article_image_json = json_encode($article_image_list, JSON_UNESCAPED_SLASHES); @@ -1199,25 +1208,27 @@ class Information extends CI_Controller { $article_modified_date = new DateTime('now', new DateTimeZone('UTC')); $article_structured_data_content = $this->load->view( - $template_path . '-structured-data-article', [ + $template_path . '-structured-data-article', + [ 'information' => $information, 'article_published_date' => $article_published_date, 'article_modified_date' => $article_modified_date, - 'author_name' => $data_H1['author'], 'author_url' => $author_url, + 'author_name' => $data_H1['author'], + 'author_url' => $author_url, 'article_image_urls' => $article_image_json ], true ); $template = str_replace('', $article_structured_data_content, $template); - $info_page_form_content = $this->load->view($template_path . '-info-page-form', false, true); + $info_page_form_content = $this->load->view($template_path . '-info-page-form', false, true); $information->ic_content = str_replace('', $info_page_form_content, $information->ic_content); $visa_free_tester_content = $this->load->view($template_path . '-visa-free-tester', false, true); - $information->ic_content = str_replace('', $visa_free_tester_content, $information->ic_content); + $information->ic_content = str_replace('', $visa_free_tester_content, $information->ic_content); } else { - $inquiry_form_template = $this->load->view($template_path . '-inquiry-form', ['meta_product_code' => $meta_product_code], true); - $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); + $inquiry_form_template = $this->load->view($template_path . '-inquiry-form', ['meta_product_code' => $meta_product_code], true); + $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); $information->ic_content = str_replace('', $inquiry_form_template, $information->ic_content); } @@ -1241,7 +1252,7 @@ class Information extends CI_Controller { '', $template ); - if (! empty($meta_product_code)) { + if (!empty($meta_product_code)) { //准备需要的数据 $dataTrippest = []; @@ -1254,15 +1265,15 @@ class Information extends CI_Controller { $dataTrippest["t_Type"] = "general"; } - $t_package = get_meta($information->ic_id, 'meta_trippest_package'); - $dataTrippest["t_package"] = explode("|", $t_package); - $t_excludedate = get_meta($information->ic_id, 'meta_trippest_excludedate'); - $dataTrippest["t_excludedate"] = $t_excludedate; - $t_includedate = get_meta($information->ic_id, 'meta_trippest_includedate'); - $dataTrippest["t_includedate"] = $t_includedate; - $t_excludemonth = get_meta($information->ic_id, 'meta_trippest_excludemonth'); + $t_package = get_meta($information->ic_id, 'meta_trippest_package'); + $dataTrippest["t_package"] = explode("|", $t_package); + $t_excludedate = get_meta($information->ic_id, 'meta_trippest_excludedate'); + $dataTrippest["t_excludedate"] = $t_excludedate; + $t_includedate = get_meta($information->ic_id, 'meta_trippest_includedate'); + $dataTrippest["t_includedate"] = $t_includedate; + $t_excludemonth = get_meta($information->ic_id, 'meta_trippest_excludemonth'); $dataTrippest["t_excludemonth"] = $t_excludemonth; - $dataTrippest["t_limitperson"] = get_meta($information->ic_id, 'meta_trippest_limitperson'); + $dataTrippest["t_limitperson"] = get_meta($information->ic_id, 'meta_trippest_limitperson'); //获取翰特对应信息 $dataTrippest['PagDetail'] = $this->trippest_model->get_pagdetail($meta_product_code); @@ -1275,47 +1286,47 @@ class Information extends CI_Controller { if (isset($dataTrippest['PagDetail']) && $dataTrippest['PagDetail'] != null) { $PAG_SourceType = $dataTrippest['PagDetail']->PAG_SourceType; switch ($PAG_SourceType) { - case '132001': - $dataTrippest['PAG_SourceType'] = "beijing"; - break; - case '132002': - $dataTrippest['PAG_SourceType'] = "shanghai"; - break; - case '132003': - $dataTrippest['PAG_SourceType'] = "xian"; - break; - case '132004': - $dataTrippest['PAG_SourceType'] = "guilin"; - break; - case '132005': - $dataTrippest['PAG_SourceType'] = "chengdu"; - break; - case '132006': - $dataTrippest['PAG_SourceType'] = "zhangjiajie"; - break; - case '132007': - $dataTrippest['PAG_SourceType'] = "huangshan"; - break; - default: - $dataTrippest['PAG_SourceType'] = ""; - break; + case '132001': + $dataTrippest['PAG_SourceType'] = "beijing"; + break; + case '132002': + $dataTrippest['PAG_SourceType'] = "shanghai"; + break; + case '132003': + $dataTrippest['PAG_SourceType'] = "xian"; + break; + case '132004': + $dataTrippest['PAG_SourceType'] = "guilin"; + break; + case '132005': + $dataTrippest['PAG_SourceType'] = "chengdu"; + break; + case '132006': + $dataTrippest['PAG_SourceType'] = "zhangjiajie"; + break; + case '132007': + $dataTrippest['PAG_SourceType'] = "huangshan"; + break; + default: + $dataTrippest['PAG_SourceType'] = ""; + break; } //每周发团 - $PAG_Scheme = $dataTrippest['PagDetail']->PAG_Scheme; + $PAG_Scheme = $dataTrippest['PagDetail']->PAG_Scheme; $dataTrippest['PAG_Scheme'] = $PAG_Scheme; //接送 if ($dataTrippest["t_Type"] == "transfer" || 1 == 1) { - $PagList = $this->trippest_model->GetTransfer($dataTrippest['PagDetail']->PAG_SN); + $PagList = $this->trippest_model->GetTransfer($dataTrippest['PagDetail']->PAG_SN); $dataTrippest["PagList"] = $PagList; } //价格 // $price = $this->trippest_model->get_price("BJALC-1",2); - $price = $this->trippest_model->get_price($dataTrippest['PagDetail']->PAG_Code, 2); + $price = $this->trippest_model->get_price($dataTrippest['PagDetail']->PAG_Code, 2); $showPrice = ""; - if (! empty($price)) { - $PKP_AdultNetPrice = $price->PKP_AdultNetPrice; + if (!empty($price)) { + $PKP_AdultNetPrice = $price->PKP_AdultNetPrice; $PKP_AdultSpecialPrice = $price->PKP_AdultSpecialPrice; if ($PKP_AdultSpecialPrice > 0) { $showPrice = $PKP_AdultSpecialPrice; @@ -1337,15 +1348,15 @@ class Information extends CI_Controller { //---day tours end ---- - //信息推荐 - $template_recommand = $recommand_information; //$this->recommand_information($information); 从外面传进来,pc和移动只需要查一次,减少数据库负担 - $template = str_replace('', $this->load->view($template_path . '-next', ['recommands' => $template_recommand], true), $template); + //信息推荐 + $template_recommand = $recommand_information; //$this->recommand_information($information); 从外面传进来,pc和移动只需要查一次,减少数据库负担 + $template = str_replace('', $this->load->view($template_path . '-next', ['recommands' => $template_recommand], true), $template); $meta_show_advertise = get_meta($information->ic_id, 'meta_show_advertise'); // //广告,改叫tips,防止被插件屏蔽 - if (! empty($template_recommand['Tips Right TOP']) && ($meta_show_advertise == 'yes' || empty($meta_show_advertise))) { + if (!empty($template_recommand['Tips Right TOP']) && ($meta_show_advertise == 'yes' || empty($meta_show_advertise))) { $template = str_replace('', "
" . $template_recommand['Tips Right TOP']->it_content . "
", $template); } - if (! empty($template_recommand['Tips Right']) && ($meta_show_advertise == 'yes' || empty($meta_show_advertise))) { + if (!empty($template_recommand['Tips Right']) && ($meta_show_advertise == 'yes' || empty($meta_show_advertise))) { $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); } @@ -1400,7 +1411,7 @@ class Information extends CI_Controller { } // 未勾选In Article 广告时,加入标签 ,让 ezoic 识别出该页面不展示广告。 - if (empty($meta_google_ad_article) || ! $meta_google_ad_article) { + if (empty($meta_google_ad_article) || !$meta_google_ad_article) { $template = str_replace( '', '', @@ -1417,7 +1428,7 @@ class Information extends CI_Controller { //替换内容中广告 $temp_array = []; preg_match_all('^^', $information->ic_content, $temp_array); - if (! empty($temp_array[1])) { + if (!empty($temp_array[1])) { foreach ($temp_array[1] as $key => $item) { $tips_detail = $this->recommends_and_tips_model->tips_detail($item); if ($tips_detail) { @@ -1426,7 +1437,7 @@ class Information extends CI_Controller { } } - //顶部全屏大图 + //顶部全屏大图 if ($device == 'mobile') { //移动端读取移动大图 $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile'); } else { @@ -1434,9 +1445,9 @@ class Information extends CI_Controller { } //顶部视频 - $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); + $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)) { + if (!empty($meta_news_video) && !empty($meta_video_picture)) { $template = str_replace('', '
', $template); } @@ -1459,13 +1470,13 @@ class Information extends CI_Controller { // 自定义 Html Head $meta_custom_head = get_meta($information->ic_id, 'meta_custom_head'); - if (! empty($meta_custom_head)) { + if (!empty($meta_custom_head)) { $template = str_replace('', $meta_custom_head, $template); } //额外样式 $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (! empty($meta_addon_css)) { + if (!empty($meta_addon_css)) { if ($meta_addon_css == 'https://proxy-data.chinahighlights.com/css/tour-detail-former.css' && is_file('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')) { $meta_addon_css_string = compress_css(file_get_contents('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')); } else { @@ -1475,31 +1486,31 @@ class Information extends CI_Controller { } //额外js $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (! empty($meta_addon_js)) { + if (!empty($meta_addon_js)) { $template = str_replace('', '', $template); } $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); - if (! empty($meta_index_set)) { + if (!empty($meta_index_set)) { $template = str_replace('', '', $template); } $meta_note_ogtitle = get_meta($information->ic_id, 'meta_note_ogtitle'); - if (! empty($meta_note_ogtitle)) { + if (!empty($meta_note_ogtitle)) { $template = str_replace('', '', $template); } $meta_note = get_meta($information->ic_id, 'meta_note'); - if (! empty($meta_note)) { + if (!empty($meta_note)) { $template = str_replace('', '', $template); } //设置内容图片缓加载 $lazy_content = $this->html_optimize_lib->set_lazy_loader($information->ic_content, 'https://data.chinahighlights.com/grey.gif'); - $template = str_replace('', $lazy_content, $template); + $template = str_replace('', $lazy_content, $template); //替换内容中各种标签 $tag_why_us = $this->load->view($template_path . '-why-us', false, true); - $template = str_replace('', $tag_why_us, $template); + $template = str_replace('', $tag_why_us, $template); //Google广告代码 //if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) { @@ -1507,17 +1518,17 @@ class Information extends CI_Controller { //} //社媒分享图片 $full_ic_photo = ''; - if (! empty($information->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)) { + if (!empty($full_ic_photo)) { $template = str_replace('', '', $template); } //设置图片尺寸 // 优化过图片目录:D:\wwwroot\origin-images.chinahighlights.com\optimize\ - $www_local_path = 'D:/wwwroot/origin-www.chinahighlights.com'; + $www_local_path = 'D:/wwwroot/origin-www.chinahighlights.com'; $image_local_path = 'D:/wwwroot/origin-images.chinahighlights.com/optimize'; if (is_dir($www_local_path) && is_dir($image_local_path)) { $template = $this->html_optimize_lib->set_image_size_local($template, $www_local_path, $image_local_path); @@ -1536,14 +1547,15 @@ class Information extends CI_Controller { } // 六个月以前的文章不显示发布时间 - private function get_publish_date_in_6_month($information) { + private function get_publish_date_in_6_month($information) + { $publish_date_in_6_month = NULL; - $meta_news_createdate = get_meta($information->ic_id, 'meta_news_createdate'); + $meta_news_createdate = get_meta($information->ic_id, 'meta_news_createdate'); - if (! empty($meta_news_createdate) && strtotime($meta_news_createdate)) { + if (!empty($meta_news_createdate) && strtotime($meta_news_createdate)) { $publish_date = new DateTime($meta_news_createdate, new DateTimeZone('UTC')); $current_date = new DateTime('now', new DateTimeZone('UTC')); - $interval = $current_date->diff($publish_date); + $interval = $current_date->diff($publish_date); $total_months = $interval->y * 12 + $interval->m; if ($total_months < 6) { @@ -1554,8 +1566,9 @@ class Information extends CI_Controller { return $publish_date_in_6_month; } - public function test_recommand() { - $information = $this->Information_model->Detail($this->input->get('is_id')); + public function test_recommand() + { + $information = $this->Information_model->Detail($this->input->get('is_id')); $recommand_information = $this->recommand_information($information); // var_dump($recommand_information); $tips_right_a = []; @@ -1596,23 +1609,25 @@ class Information extends CI_Controller { echo $tips_right_list_content; } - public function test_feedback() { - $city_name_list = []; + public function test_feedback() + { + $city_name_list = []; $city_name_list[] = 'Bangkok'; - $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list); + $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list); var_dump($feedback_list); echo 'All feedback -------------------------------------------------'; $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list, true); var_dump($feedback_list); } - public function test_ch_feedback30() { + public function test_ch_feedback30() + { $feedback30_array = []; preg_match_all('^^', '
', $feedback30_array); - if (! empty($feedback30_array)) { + if (!empty($feedback30_array)) { foreach ($feedback30_array[0] as $index => $tag_name) { - $city_name = $feedback30_array[1][$index]; - $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 2); + $city_name = $feedback30_array[1][$index]; + $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 2); $feedback_content = $this->load->view( 'mobile_first/ch-feedback-30-list', ['feedback_list' => $feedback_list], @@ -1623,23 +1638,25 @@ class Information extends CI_Controller { } } - public function test_get_feedback_by_city_name() { + public function test_get_feedback_by_city_name() + { $feedback_list = $this->Feedback_model->get_feedback_by_city_name('Bangkok', 5); var_dump($feedback_list); } - public function test_feedback_city_list() { + public function test_feedback_city_list() + { $feedback_city_array = []; preg_match_all('^^', '
', $feedback_city_array); - if (! empty($feedback_city_array)) { + if (!empty($feedback_city_array)) { foreach ($feedback_city_array[0] as $index => $tag_name) { - $city_name_string = $feedback_city_array[1][$index]; - $city_name_list = explode(',', $city_name_string); + $city_name_string = $feedback_city_array[1][$index]; + $city_name_list = explode(',', $city_name_string); $feedback_city_list = []; foreach ($city_name_list as $index => $city_name) { - $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 5); - $data_name = str_replace(" ", "_", $city_name); + $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 5); + $data_name = str_replace(" ", "_", $city_name); $feedback_city_list[$data_name] = $feedback_list; } @@ -1658,9 +1675,10 @@ class Information extends CI_Controller { //
#ah-mtc-3,st,2#
// CH: 1; AH: 28; GH : 33 - public function test_price() { - $price_rule = base64_decode($this->input->get('price_rule')); - $dept_sn = $this->input->get('dept_sn'); + public function test_price() + { + $price_rule = base64_decode($this->input->get('price_rule')); + $dept_sn = $this->input->get('dept_sn'); $price_item_array = $this->price_pregmatch($price_rule); echo 'price_item_array: '; var_dump($price_item_array); @@ -1677,87 +1695,88 @@ class Information extends CI_Controller { * @param string $price_content 包含价格标签的内容 * @return array 包含价格与占位符的数组 */ - public function parse_price_tag($price_content, $dept_sn = 28) { + public function parse_price_tag($price_content, $dept_sn = 28) + { $price_item_array = $this->price_pregmatch($price_content); - $price_tag_list = []; - if (! empty($price_item_array)) { + $price_tag_list = []; + if (!empty($price_item_array)) { foreach ($price_item_array as $price_item) { - $price_date = ! empty($price_item->price_date) ? $price_item->price_date : date('Y-m-d', time() + 86400 * 7); //当前时间7天后的价格 + $price_date = !empty($price_item->price_date) ? $price_item->price_date : date('Y-m-d', time() + 86400 * 7); //当前时间7天后的价格 $price_number = ''; //优先读取新的价格体系 $price = $this->PrimeLinePrice_model->search($price_item->cli_no, 1, $price_item->cli_grade, $price_item->person_size, $price_date, $dept_sn); - if (! empty($price)) { + if (!empty($price)) { switch (strtoupper($price_item->price_people)) { - case 'A': - $price_number = $price->PLP_AdultUnitPrice; - break; - case 'C': - $price_number = $price->PLP_ChildUnitPrice; - break; - case 'B': - $price_number = $price->PLP_BabyUnitPrice; - break; - case 'R': - $price_number = $price->PLP_RoomDiffPrice; - break; - case 'AR': - $price_number = $price->PLP_AdultUnitPrice + $price->PLP_RoomDiffPrice; //成人加单间房差 - break; - default: - $price_number = $price->PLP_AdultUnitPrice; - } - } else { - $price = $this->Price_model->search($price_item->cli_no, 1, $price_item->cli_grade, false, $price_date); - if (! empty($price)) { - - switch (strtoupper($price_item->price_people)) { case 'A': - switch ($price_item->person_size) { - case '1': - $price_number = $price->CLP_OneAdultPriceRMB; - break; - case '2': //25 - $price_number = $price->CLP_TwoToFiveAdultPriceRMB; - break; - case '6': //69 - $price_number = $price->CLP_SixToNineAdultPriceRMB; - break; - case '10': - $price_number = $price->CLP_OverTenAdultPriceRMB; - break; - default: - $price_number = $price->CLP_TwoToFiveAdultPriceRMB; - } + $price_number = $price->PLP_AdultUnitPrice; break; case 'C': - $price_number = 0; + $price_number = $price->PLP_ChildUnitPrice; break; case 'B': - $price_number = 0; + $price_number = $price->PLP_BabyUnitPrice; break; case 'R': - switch ($price_item->person_size) { - case '1': - $price_number = $price->CLP_OneRoomDiffPriceRMB; + $price_number = $price->PLP_RoomDiffPrice; + break; + case 'AR': + $price_number = $price->PLP_AdultUnitPrice + $price->PLP_RoomDiffPrice; //成人加单间房差 + break; + default: + $price_number = $price->PLP_AdultUnitPrice; + } + } else { + $price = $this->Price_model->search($price_item->cli_no, 1, $price_item->cli_grade, false, $price_date); + if (!empty($price)) { + + switch (strtoupper($price_item->price_people)) { + case 'A': + switch ($price_item->person_size) { + case '1': + $price_number = $price->CLP_OneAdultPriceRMB; + break; + case '2': //25 + $price_number = $price->CLP_TwoToFiveAdultPriceRMB; + break; + case '6': //69 + $price_number = $price->CLP_SixToNineAdultPriceRMB; + break; + case '10': + $price_number = $price->CLP_OverTenAdultPriceRMB; + break; + default: + $price_number = $price->CLP_TwoToFiveAdultPriceRMB; + } break; - case '2': //25 - $price_number = $price->CLP_TwoToFiveRoomDiffPriceRMB; + case 'C': + $price_number = 0; break; - case '6': //69 - $price_number = $price->CLP_SixToNineRoomDiffPriceRMB; + case 'B': + $price_number = 0; break; - case '10': - $price_number = $price->CLP_OverTenRoomDiffPriceRMB; + case 'R': + switch ($price_item->person_size) { + case '1': + $price_number = $price->CLP_OneRoomDiffPriceRMB; + break; + case '2': //25 + $price_number = $price->CLP_TwoToFiveRoomDiffPriceRMB; + break; + case '6': //69 + $price_number = $price->CLP_SixToNineRoomDiffPriceRMB; + break; + case '10': + $price_number = $price->CLP_OverTenRoomDiffPriceRMB; + break; + default: + $price_number = $price->CLP_TwoToFiveRoomDiffPriceRMB; + } + break; + case 'AR': //成人加单间房差 + $price_number = 0; break; default: - $price_number = $price->CLP_TwoToFiveRoomDiffPriceRMB; - } - break; - case 'AR': //成人加单间房差 - $price_number = 0; - break; - default: - $price_number = 0; + $price_number = 0; } } } @@ -1767,9 +1786,9 @@ class Information extends CI_Controller { $site_money = $this->currency->calc_show_price($price_number); //把金额格式化为带有逗号(,)方便阅读,如 12,345 $price_number = is_numeric($price_number) ? number_format($site_money) : $price_number; - if (! empty($price_number)) { + if (!empty($price_number)) { $price_tag = [ - 'placeholder' => $price_item->placeholder, + 'placeholder' => $price_item->placeholder, 'price_number' => $price_number, ]; $price_tag_list[] = $price_tag; @@ -1780,88 +1799,90 @@ class Information extends CI_Controller { } //使用正则匹配出价格标签,返回一个价格数组 - private function price_pregmatch($content) { + private function price_pregmatch($content) + { $price_array = []; - $temp_array = []; - $result = false; + $temp_array = []; + $result = false; //#ah-1,lx,2,2016-01-23,A# //线路代号,等级(st标准、lx豪华、ec经济),人等,时间,人型(A成人、C小孩、B婴儿、R单间房差、AR成人+房差) preg_match_all('^#[a-zA-Z0-9,-]+#^', $content, $temp_array); foreach ($temp_array[0] as $item) { $placeholder = $item; - $item = str_replace('#', '', $item); + $item = str_replace('#', '', $item); $price_array = explode(',', $item); - $cli_no = ! empty($price_array[0]) ? $price_array[0] : false; //线路代号 + $cli_no = !empty($price_array[0]) ? $price_array[0] : false; //线路代号 if (empty($cli_no)) { continue; //没有设置线路代号则进入下一条 } - $cli_grade = ! empty($price_array[1]) ? $price_array[1] : false; //标准7001、豪华7002、经济7003 + $cli_grade = !empty($price_array[1]) ? $price_array[1] : false; //标准7001、豪华7002、经济7003 switch (strtoupper($cli_grade)) { - case 'ST': - $cli_grade = '7001'; - break; - case 'LX': - $cli_grade = '7002'; - break; - case 'EC': - $cli_grade = '7003'; - break; - default: - $cli_grade = '7001'; - } - $person_size = (! empty($price_array[2]) && is_numeric($price_array[2])) ? $price_array[2] : 2; //人等1,2-5,6-9,10,默认2人等 - //为了兼容以前的人等方式,把算数人等转换为单数 25=>2 + case 'ST': + $cli_grade = '7001'; + break; + case 'LX': + $cli_grade = '7002'; + break; + case 'EC': + $cli_grade = '7003'; + break; + default: + $cli_grade = '7001'; + } + $person_size = (!empty($price_array[2]) && is_numeric($price_array[2])) ? $price_array[2] : 2; //人等1,2-5,6-9,10,默认2人等 + //为了兼容以前的人等方式,把算数人等转换为单数 25=>2 switch ($person_size) { - case '25': - $person_size = '2'; - break; - case '69': - $person_size = '6'; - break; + case '25': + $person_size = '2'; + break; + case '69': + $person_size = '6'; + break; } - $price_date = ! empty($price_array[3]) ? $price_array[3] : false; //价格时间 - $price_people = ! empty($price_array[4]) ? $price_array[4] : 'A'; //A成人、C小孩、B婴儿、R单间房差 - $result[] = (object) ['placeholder' => $placeholder, 'cli_no' => $cli_no, 'cli_grade' => $cli_grade, 'person_size' => $person_size, 'price_date' => $price_date, 'price_people' => $price_people]; + $price_date = !empty($price_array[3]) ? $price_array[3] : false; //价格时间 + $price_people = !empty($price_array[4]) ? $price_array[4] : 'A'; //A成人、C小孩、B婴儿、R单间房差 + $result[] = (object) ['placeholder' => $placeholder, 'cli_no' => $cli_no, 'cli_grade' => $cli_grade, 'person_size' => $person_size, 'price_date' => $price_date, 'price_people' => $price_people]; } return $result; } - public function make_www_cache_gh($device, $information, $recommand_information) { - $data = []; - $meta_show_advertise = get_meta($information->ic_id, 'meta_show_advertise'); + public function make_www_cache_gh($device, $information, $recommand_information) + { + $data = []; + $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; - } - 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: + 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', $data, true); + $html_path_ext = '-pc.htm'; + } else { + return false; + } + break; + default: } // GH Home 下层节点名称和链接映射 $group_map = [ 278009289 => [ - 'ic_url' => '/destinations', + 'ic_url' => '/destinations', 'ic_url_title' => 'Destinations', ], 278009290 => [ - 'ic_url' => '/about', + 'ic_url' => '/about', 'ic_url_title' => 'About Us', ], ]; @@ -1884,7 +1905,7 @@ class Information extends CI_Controller { $template = str_replace('', $information->ic_seo_keywords, $template); $template = str_replace('', $this->config->item('site_url') . $information->ic_url, $template); - //顶部全屏大图 + //顶部全屏大图 if ($device == 'mobile') { //移动端读取移动大图 $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile'); } else { @@ -1892,13 +1913,13 @@ class Information extends CI_Controller { } $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); - $ads_by_google = ! empty(get_meta($information->ic_id, 'meta_google_ad_article')); + $ads_by_google = !empty(get_meta($information->ic_id, 'meta_google_ad_article')); $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); $meta_addon_picture_mobile = get_meta($information->ic_id, 'meta_addon_picture_mobile'); $article_image_list = [$meta_addon_picture, $meta_addon_picture_mobile]; - $article_image_list = array_values(array_filter($article_image_list, function($value) { + $article_image_list = array_values(array_filter($article_image_list, function ($value) { return !empty($value); })); $article_image_json = json_encode($article_image_list, JSON_UNESCAPED_SLASHES); @@ -1907,50 +1928,52 @@ class Information extends CI_Controller { $article_modified_date = new DateTime('now', new DateTimeZone('UTC')); //H1模板替换 - $data_H1 = []; - $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 - $data_H1['author'] = ''; //获取作者信息 + $data_H1 = []; + $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 + $data_H1['author'] = ''; //获取作者信息 $data_H1['meta_news_createdate'] = $this->get_publish_date_in_6_month($information); - $author = $this->Operator_model->get_author_nikename($information->ic_author); - $author_url = ''; - if (! empty($author)) { - $data_H1['author'] = $author->OPI_FirstName; + $author = $this->Operator_model->get_author_nikename($information->ic_author); + $author_url = ''; + if (!empty($author)) { + $data_H1['author'] = $author->OPI_FirstName; $data_H1['OPI_Code'] = $author->OPI_Code; - $author_url = $this->get_author_url('www.globalhighlights.com', $author->OPI_Code); + $author_url = $this->get_author_url('www.globalhighlights.com', $author->OPI_Code); } else { $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 - if (! empty($author_web)) { + if (!empty($author_web)) { $data_H1['author'] = $author_web->a_name; } } - $data_H1['ic_title'] = $information->ic_title; - $data_H1['ic_photo'] = $meta_addon_picture; //$information->ic_photo; 用额外设置的图片替代 + $data_H1['ic_title'] = $information->ic_title; + $data_H1['ic_photo'] = $meta_addon_picture; //$information->ic_photo; 用额外设置的图片替代 $data_H1['breadcrumb_data'] = $breadcrumb_data; - $data_H1['ads_by_google'] = $ads_by_google; - $template_H1 = $this->load->view($template_path . '-h1', $data_H1, true); - $template = str_replace('', $template_H1, $template); + $data_H1['ads_by_google'] = $ads_by_google; + $template_H1 = $this->load->view($template_path . '-h1', $data_H1, true); + $template = str_replace('', $template_H1, $template); if (empty($meta_product_code)) { $addthis_widget = $this->load->view($template_path . '-add-this', false, true); - $template = str_replace('', $addthis_widget, $template); + $template = str_replace('', $addthis_widget, $template); } $article_structured_data_content = $this->load->view( - $template_path . '-structured-data-article', [ + $template_path . '-structured-data-article', + [ 'information' => $information, 'article_published_date' => $article_published_date, 'article_modified_date' => $article_modified_date, - 'author_name' => $data_H1['author'], 'author_url' => $author_url, + 'author_name' => $data_H1['author'], + 'author_url' => $author_url, 'article_image_urls' => $article_image_json ], true ); $template = str_replace('', $article_structured_data_content, $template); - if (! empty($meta_product_code)) { + if (!empty($meta_product_code)) { // $product_code_input = ""; - $template = str_replace('', $product_code_input, $template); + $template = str_replace('', $product_code_input, $template); } if (empty($meta_product_code)) { @@ -1959,14 +1982,14 @@ class Information extends CI_Controller { $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); } - //信息推荐 + //信息推荐 $template_recommand = $recommand_information; //$this->recommand_information($information); 从外面传进来,pc和移动只需要查一次,减少数据库负担 - $template = str_replace('', $this->load->view($template_path . '-next', ['recommands' => $template_recommand], true), $template); + $template = str_replace('', $this->load->view($template_path . '-next', ['recommands' => $template_recommand], true), $template); // //广告,改叫tips,防止被插件屏蔽 - if (! empty($template_recommand['Tips Right TOP'])) { + if (!empty($template_recommand['Tips Right TOP'])) { // $template = str_replace('', "
", $template); } - if (! empty($template_recommand['Tips Right']) && ($meta_show_advertise == 'yes' || empty($meta_show_advertise))) { + if (!empty($template_recommand['Tips Right']) && ($meta_show_advertise == 'yes' || empty($meta_show_advertise))) { $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); } // 右侧列表广告 @@ -2016,7 +2039,7 @@ class Information extends CI_Controller { //替换内容中广告 $temp_array = []; preg_match_all('^^', $information->ic_content, $temp_array); - if (! empty($temp_array[1])) { + if (!empty($temp_array[1])) { foreach ($temp_array[1] as $key => $item) { $tips_detail = $this->recommends_and_tips_model->tips_detail($item); if ($tips_detail) { @@ -2027,7 +2050,7 @@ class Information extends CI_Controller { // 未勾选In Article 广告时,加入标签 ,让 ezoic 识别出该页面不展示广告。 $meta_google_ad_article = get_meta($information->ic_id, 'meta_google_ad_article'); - if (empty($meta_google_ad_article) || ! $meta_google_ad_article) { + if (empty($meta_google_ad_article) || !$meta_google_ad_article) { $template = str_replace( '', '', @@ -2046,7 +2069,7 @@ class Information extends CI_Controller { [], true ); - $information->ic_content = str_replace('', $why_us_covid_list_pc, $information->ic_content); + $information->ic_content = str_replace('', $why_us_covid_list_pc, $information->ic_content); $why_us_covid_list_mobile = $this->load->view( $template_path . '-why-us-covid-mobile', [], @@ -2055,7 +2078,7 @@ class Information extends CI_Controller { $information->ic_content = str_replace('', $why_us_covid_list_mobile, $information->ic_content); if (empty($meta_product_code)) { - $info_page_form_content = $this->load->view($template_path . '-info-page-form', false, true); + $info_page_form_content = $this->load->view($template_path . '-info-page-form', false, true); $information->ic_content = str_replace('', $info_page_form_content, $information->ic_content); } else { $tour_form_content = $this->load->view( @@ -2082,10 +2105,10 @@ class Information extends CI_Controller { // 解析结果:; Bangkok $feedback30_array = []; preg_match_all('^^', $information->ic_content, $feedback30_array); - if (! empty($feedback30_array)) { + if (!empty($feedback30_array)) { foreach ($feedback30_array[0] as $index => $tag_name) { - $city_name = $feedback30_array[1][$index]; - $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name); + $city_name = $feedback30_array[1][$index]; + $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name); $feedback_30_content = $this->load->view( 'mobile_first/gh-feedback-30-list', ['feedback_list' => $feedback_list], @@ -2102,14 +2125,14 @@ class Information extends CI_Controller { // 集合页面反馈标签 $feedback_city_array = []; preg_match_all('^^', $information->ic_content, $feedback_city_array); - if (! empty($feedback_city_array)) { + if (!empty($feedback_city_array)) { foreach ($feedback_city_array[0] as $index => $tag_name) { - $city_name_string = $feedback_city_array[1][$index]; - $city_name_list = explode(',', $city_name_string); + $city_name_string = $feedback_city_array[1][$index]; + $city_name_list = explode(',', $city_name_string); $feedback_city_list = []; foreach ($city_name_list as $index => $city_name) { - $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 5); - $data_name = str_replace(" ", "_", $city_name); + $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 5); + $data_name = str_replace(" ", "_", $city_name); $feedback_city_list[$data_name] = $feedback_list; } @@ -2131,14 +2154,14 @@ class Information extends CI_Controller { // 解析结果:; Siem Reap,Bangkok $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $city_name_list = explode(',', $city_name_string); - $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list); + $city_name_list = explode(',', $city_name_string); + $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/gh-feedback-list', ['feedback_list' => $top3_feedback_list], true @@ -2154,15 +2177,15 @@ class Information extends CI_Controller { // 顾问英文名反馈标签 $feedback_advisor_array = []; preg_match_all('^^', $information->ic_content, $feedback_advisor_array); - if (! empty($feedback_advisor_array)) { + if (!empty($feedback_advisor_array)) { foreach ($feedback_advisor_array[0] as $index => $tag_name) { - $advisor_name = $feedback_advisor_array[1][$index]; - $feedback_list = $this->Feedback_model->get_feedback_by_advisor_name($advisor_name); + $advisor_name = $feedback_advisor_array[1][$index]; + $feedback_list = $this->Feedback_model->get_feedback_by_advisor_name($advisor_name); $feedback_content = $this->load->view( 'mobile_first/gh-feedback-advisor-list', [ 'feedback_list' => $feedback_list, - 'advisor_name' => $advisor_name, + 'advisor_name' => $advisor_name, ], true ); @@ -2182,7 +2205,7 @@ class Information extends CI_Controller { $template = str_replace('', '', $template); //额外样式 $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (! empty($meta_addon_css)) { + if (!empty($meta_addon_css)) { // if ($meta_addon_css == 'https://proxy-data.chinahighlights.com/css/tour-detail-former.css' && is_file('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')) { //$meta_addon_css_string = compress_css(file_get_contents('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')); // } else { @@ -2192,31 +2215,31 @@ class Information extends CI_Controller { } //额外js $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (! empty($meta_addon_js)) { + if (!empty($meta_addon_js)) { $template = str_replace('', '', $template); } $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); - if (! empty($meta_index_set)) { + if (!empty($meta_index_set)) { $template = str_replace('', '', $template); } //设置内容图片缓加载 $lazy_content = $this->html_optimize_lib->set_lazy_loader($information->ic_content, 'https://data.chinahighlights.com/grey.gif'); - $template = str_replace('', $lazy_content, $template); + $template = str_replace('', $lazy_content, $template); //社媒分享图片 $full_ic_photo = ''; - if (! empty($information->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)) { + if (!empty($full_ic_photo)) { $template = str_replace('', '', $template); } //设置图片尺寸 // 优化过图片目录:D:\wwwroot\origin-images.chinahighlights.com\optimize\ - $www_local_path = 'D:/wwwroot/origin-www.globalhighlights.com'; + $www_local_path = 'D:/wwwroot/origin-www.globalhighlights.com'; $image_local_path = 'D:/wwwroot/origin-images.chinahighlights.com/optimize'; if (is_dir($www_local_path) && is_dir('D:/wwwroot/origin-www.globalhighlights.com')) { $template = $this->html_optimize_lib->set_image_size_local($template, $www_local_path, $image_local_path); @@ -2234,37 +2257,38 @@ class Information extends CI_Controller { file_put_contents($html_path, $template, LOCK_EX); } - public function make_www_cache_htravel($device, $information, $recommand_information) { + public function make_www_cache_htravel($device, $information, $recommand_information) + { - $data = []; - $data['information'] = $information; - $recommand_template = ''; - $meta_show_advertise = get_meta($information->ic_id, 'meta_show_advertise'); + $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/htravel-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/htravel-next'; - break; - default: + 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/htravel-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/htravel-next'; + break; + default: } //替换模板中的标签 @@ -2274,11 +2298,11 @@ class Information extends CI_Controller { $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_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 { @@ -2290,23 +2314,23 @@ class Information extends CI_Controller { // AH Home 下层节点名称和链接映射 $group_map = [ 278002667 => [ - 'ic_url' => '/destinations', + 'ic_url' => '/destinations', 'ic_url_title' => 'Destinations', ], 278008885 => [ - 'ic_url' => '/about-us', + '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')); + $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')); $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); $meta_addon_picture_mobile = get_meta($information->ic_id, 'meta_addon_picture_mobile'); $article_image_list = [$meta_addon_picture, $meta_addon_picture_mobile]; - $article_image_list = array_values(array_filter($article_image_list, function($value) { + $article_image_list = array_values(array_filter($article_image_list, function ($value) { return !empty($value); })); $article_image_json = json_encode($article_image_list, JSON_UNESCAPED_SLASHES); @@ -2315,32 +2339,34 @@ class Information extends CI_Controller { $article_modified_date = new DateTime('now', new DateTimeZone('UTC')); $data['meta_news_createdate'] = $this->get_publish_date_in_6_month($information); - $data['ads_by_google'] = $ads_by_google; - $data['author'] = ''; //获取作者信息 - $author_url = ''; - $author = $this->Operator_model->get_author_nikename($information->ic_author); - if (! empty($author)) { - $data['author'] = $author->OPI_FirstName; - $data['OPI_Code'] = $author->OPI_Code; + $data['ads_by_google'] = $ads_by_google; + $data['author'] = ''; //获取作者信息 + $author_url = ''; + $author = $this->Operator_model->get_author_nikename($information->ic_author); + if (!empty($author)) { + $data['author'] = $author->OPI_FirstName; + $data['OPI_Code'] = $author->OPI_Code; $data['author_url'] = $this->get_author_url('www.highlightstravel.com', $author->OPI_Code); - $author_url = $this->get_author_url('www.highlightstravel.com', $author->OPI_Code); + $author_url = $this->get_author_url('www.highlightstravel.com', $author->OPI_Code); } else { $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 - if (! empty($author_web)) { + if (!empty($author_web)) { $data['author'] = $author_web->a_name; } } $data['breadcrumb_data'] = $breadcrumb_data; - $template_H1 = $this->load->view($template_path . '-h1', $data, true); - $template = str_replace('', $template_H1, $template); + $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', [ + $template_path . '-structured-data-article', + [ 'information' => $information, 'article_published_date' => $article_published_date, 'article_modified_date' => $article_modified_date, - 'author_name' => $data['author'], 'author_url' => $author_url, + 'author_name' => $data['author'], + 'author_url' => $author_url, 'article_image_urls' => $article_image_json ], true @@ -2360,9 +2386,9 @@ class Information extends CI_Controller { //推荐信息或者产品 $template_recommand = $recommand_information; - $template = str_replace('', $this->load->view($recommand_template, ['recommands' => $template_recommand], true), $template); + $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))) { + if (!empty($template_recommand['Tips Right']) && ($meta_show_advertise == 'yes' || empty($meta_show_advertise))) { $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); } // 右侧列表广告 @@ -2415,7 +2441,7 @@ class Information extends CI_Controller { //替换内容中广告 $temp_array = []; preg_match_all('^^', $information->ic_content, $temp_array); - if (! empty($temp_array[1])) { + if (!empty($temp_array[1])) { foreach ($temp_array[1] as $key => $item) { $tips_detail = $this->recommends_and_tips_model->tips_detail($item); if ($tips_detail) { @@ -2428,10 +2454,10 @@ class Information extends CI_Controller { // 非产品页面 if (empty($meta_product_code)) { $addthis_widget = $this->load->view($template_path . '-add-this', false, true); - $template = str_replace('', $addthis_widget, $template); - $template = str_replace('?product_code=', '', $template); + $template = str_replace('', $addthis_widget, $template); + $template = str_replace('?product_code=', '', $template); } else { - $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); + $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); $inquiry_form_template = $this->load->view( $template_path . '-inquiry-form', ['meta_product_code' => $meta_product_code, 'information' => $information], @@ -2474,16 +2500,16 @@ class Information extends CI_Controller { ); } // why-us 相关的标签 - $why_us_mobile = $this->load->view($template_path . '-why-us-mobile', false, true); + $why_us_mobile = $this->load->view($template_path . '-why-us-mobile', false, true); $information->ic_content = str_replace('', $why_us_mobile, $information->ic_content); - $why_us_tour_detail_pc = $this->load->view($template_path . '-why-us-tour-detail-pc', false, true); + $why_us_tour_detail_pc = $this->load->view($template_path . '-why-us-tour-detail-pc', false, true); $information->ic_content = str_replace('', $why_us_tour_detail_pc, $information->ic_content); - $why_us_tour_list_pc = $this->load->view($template_path . '-why-us-tour-list-pc', false, true); + $why_us_tour_list_pc = $this->load->view($template_path . '-why-us-tour-list-pc', false, true); $information->ic_content = str_replace('', $why_us_tour_list_pc, $information->ic_content); - $info_page_form_content = $this->load->view($template_path . '-info-page-form', false, true); + $info_page_form_content = $this->load->view($template_path . '-info-page-form', false, true); $information->ic_content = str_replace('', $info_page_form_content, $information->ic_content); // 水灯节表单 @@ -2535,14 +2561,14 @@ class Information extends CI_Controller { // 解析结果:; Siem Reap,Bangkok $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $city_name_list = explode(',', $city_name_string); - $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list, FALSE); + $city_name_list = explode(',', $city_name_string); + $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list, FALSE); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/htravel-feedback-list', ['feedback_list' => $top3_feedback_list], true @@ -2560,10 +2586,10 @@ class Information extends CI_Controller { // 解析结果:; Bangkok $feedback30_array = []; preg_match_all('^^', $information->ic_content, $feedback30_array); - if (! empty($feedback30_array)) { + if (!empty($feedback30_array)) { foreach ($feedback30_array[0] as $index => $tag_name) { - $city_name = $feedback30_array[1][$index]; - $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 30, FALSE); + $city_name = $feedback30_array[1][$index]; + $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 30, FALSE); $feedback_30_content = $this->load->view( 'mobile_first/htravel-feedback-30-list', ['feedback_list' => $feedback_list], @@ -2580,14 +2606,14 @@ class Information extends CI_Controller { // 集合页面反馈标签 $feedback_city_array = []; preg_match_all('^^', $information->ic_content, $feedback_city_array); - if (! empty($feedback_city_array)) { + if (!empty($feedback_city_array)) { foreach ($feedback_city_array[0] as $index => $tag_name) { - $city_name_string = $feedback_city_array[1][$index]; - $city_name_list = explode(',', $city_name_string); + $city_name_string = $feedback_city_array[1][$index]; + $city_name_list = explode(',', $city_name_string); $feedback_city_list = []; foreach ($city_name_list as $index => $city_name) { - $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 5, FALSE); - $data_name = str_replace(" ", "_", $city_name); + $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 5, FALSE); + $data_name = str_replace(" ", "_", $city_name); $feedback_city_list[$data_name] = $feedback_list; } @@ -2608,15 +2634,15 @@ class Information extends CI_Controller { $feedback_advisor_array = []; preg_match_all('^^', $information->ic_content, $feedback_advisor_array); - if (! empty($feedback_advisor_array)) { + if (!empty($feedback_advisor_array)) { foreach ($feedback_advisor_array[0] as $index => $tag_name) { - $advisor_name = $feedback_advisor_array[1][$index]; - $feedback_list = $this->Feedback_model->get_feedback_by_advisor_name($advisor_name); + $advisor_name = $feedback_advisor_array[1][$index]; + $feedback_list = $this->Feedback_model->get_feedback_by_advisor_name($advisor_name); $feedback_content = $this->load->view( 'mobile_first/htravel-feedback-advisor-list', [ 'feedback_list' => $feedback_list, - 'advisor_name' => $advisor_name, + 'advisor_name' => $advisor_name, ], true ); @@ -2628,7 +2654,7 @@ class Information extends CI_Controller { } } - //主样式表,内联模式 + //主样式表,内联模式 if (is_file('D:/wwwroot/origin-www.highlightstravel.com/css/mobile-first.css')) { //主样式表,内联模式,优先读取本地,没有在从网络读取,为了加速 $main_css_string = compress_css(file_get_contents('D:/wwwroot/origin-www.highlightstravel.com/css/mobile-first.css')); } else { @@ -2637,34 +2663,34 @@ class Information extends CI_Controller { $template = str_replace('', '', $template); //额外样式 $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (! empty($meta_addon_css)) { + if (!empty($meta_addon_css)) { //内联方式 $meta_addon_css_string = compress_css(GET_HTTP($meta_addon_css)); - $template = str_replace('', '', $template); + $template = str_replace('', '', $template); } //额外js $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (! empty($meta_addon_js)) { + if (!empty($meta_addon_js)) { $template = str_replace('', '', $template); } $meta_note_ogtitle = get_meta($information->ic_id, 'meta_note_ogtitle'); - if (! empty($meta_note_ogtitle)) { + if (!empty($meta_note_ogtitle)) { $template = str_replace('', '', $template); } $meta_note = get_meta($information->ic_id, 'meta_note'); - if (! empty($meta_note)) { + if (!empty($meta_note)) { $template = str_replace('', '', $template); } $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); - if (! empty($meta_index_set)) { + if (!empty($meta_index_set)) { $template = str_replace('', '', $template); } //设置内容图片缓加载 $lazy_content = $this->html_optimize_lib->set_lazy_loader($information->ic_content, 'https://data.highlightstravel.com/grey.gif'); - $template = str_replace('', $lazy_content, $template); + $template = str_replace('', $lazy_content, $template); //Google广告代码 //if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) { @@ -2673,18 +2699,18 @@ class Information extends CI_Controller { //社媒分享图片 $full_ic_photo = ''; - if (! empty($information->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)) { + if (!empty($full_ic_photo)) { $template = str_replace('', '', $template); } // 设置图片尺寸 // 优化过图片目录:D:\wwwroot\origin-images.chinahighlights.com\optimize\ - $www_local_path = 'D:/wwwroot/origin-www.highlightstravel.com'; + $www_local_path = 'D:/wwwroot/origin-www.highlightstravel.com'; $image_local_path = 'D:/wwwroot/origin-images.chinahighlights.com/optimize'; if (is_dir($www_local_path) && is_dir($image_local_path)) { $template = $this->html_optimize_lib->set_image_size_local($template, $www_local_path, $image_local_path); @@ -2702,37 +2728,38 @@ class Information extends CI_Controller { file_put_contents($html_path, $template, LOCK_EX); } - public function make_www_cache_jh($device, $information, $recommand_information) { + public function make_www_cache_jh($device, $information, $recommand_information) + { - $data = []; - $data['information'] = $information; - $recommand_template = ''; - $meta_show_advertise = get_meta($information->ic_id, 'meta_show_advertise'); + $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/jh-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/jh-next'; - break; - default: + 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/jh-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/jh-next'; + break; + default: } //替换模板中的标签 @@ -2742,11 +2769,11 @@ class Information extends CI_Controller { $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_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 { @@ -2758,7 +2785,7 @@ class Information extends CI_Controller { // AH Home 下层节点名称和链接映射 $group_map = [ 278011836 => [ - 'ic_url' => '/about-us', + 'ic_url' => '/about-us', 'ic_url_title' => 'About Us', ], ]; @@ -2767,7 +2794,7 @@ class Information extends CI_Controller { $meta_addon_picture_mobile = get_meta($information->ic_id, 'meta_addon_picture_mobile'); $article_image_list = [$meta_addon_picture, $meta_addon_picture_mobile]; - $article_image_list = array_values(array_filter($article_image_list, function($value) { + $article_image_list = array_values(array_filter($article_image_list, function ($value) { return !empty($value); })); $article_image_json = json_encode($article_image_list, JSON_UNESCAPED_SLASHES); @@ -2775,19 +2802,19 @@ class Information extends CI_Controller { $article_published_date = new DateTime($information->is_datetime, new DateTimeZone('UTC')); $article_modified_date = new DateTime('now', new DateTimeZone('UTC')); - $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')); + $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' => '']; + $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; + $data['OPI_Code'] = $author->OPI_Code; - $author_info = $this->get_author_info('japanhighlights.com', $author->OPI_Code); + $author_info = $this->get_author_info('japanhighlights.com', $author->OPI_Code); $data['author_info'] = $author_info; } else { $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 @@ -2797,16 +2824,18 @@ class Information extends CI_Controller { } } $data['breadcrumb_data'] = $breadcrumb_data; - $template_H1 = $this->load->view($template_path . '-h1', $data, true); - $template = str_replace('', $template_H1, $template); + $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', [ + $template_path . '-structured-data-article', + [ 'information' => $information, 'article_published_date' => $article_published_date, 'article_modified_date' => $article_modified_date, - 'author_name' => $data['author_name'], 'author_url' => $author_info['url'], + 'author_name' => $data['author_name'], + 'author_url' => $author_info['url'], 'article_image_urls' => $article_image_json ], true @@ -2826,9 +2855,9 @@ class Information extends CI_Controller { //推荐信息或者产品 $template_recommand = $recommand_information; - $template = str_replace('', $this->load->view($recommand_template, ['recommands' => $template_recommand], true), $template); + $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))) { + if (!empty($template_recommand['Tips Right']) && ($meta_show_advertise == 'yes' || empty($meta_show_advertise))) { $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); } // 右侧列表广告 @@ -2881,7 +2910,7 @@ class Information extends CI_Controller { //替换内容中广告 $temp_array = []; preg_match_all('^^', $information->ic_content, $temp_array); - if (! empty($temp_array[1])) { + if (!empty($temp_array[1])) { foreach ($temp_array[1] as $key => $item) { $tips_detail = $this->recommends_and_tips_model->tips_detail($item); if ($tips_detail) { @@ -2895,7 +2924,7 @@ class Information extends CI_Controller { if (empty($meta_product_code)) { } else { - $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); + $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); $inquiry_form_template = $this->load->view( 'mobile_first/jh-inquiry-form', ['meta_product_code' => $meta_product_code, 'information' => $information], @@ -2928,14 +2957,14 @@ class Information extends CI_Controller { // 解析结果:; Siem Reap,Bangkok $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $city_name_list = explode(',', $city_name_string); - $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list, FALSE); + $city_name_list = explode(',', $city_name_string); + $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list, FALSE); // 防止触发 Google 网络垃圾政策只返回前三条,但市场要求显示五条 $top3_feedback_list = array_slice($feedback_list, 0, 5); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/jh-feedback-list', ['feedback_list' => $top3_feedback_list], true @@ -2953,10 +2982,10 @@ class Information extends CI_Controller { // 解析结果:; Bangkok $feedback30_array = []; preg_match_all('^^', $information->ic_content, $feedback30_array); - if (! empty($feedback30_array)) { + if (!empty($feedback30_array)) { foreach ($feedback30_array[0] as $index => $tag_name) { - $city_name = $feedback30_array[1][$index]; - $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 30, FALSE); + $city_name = $feedback30_array[1][$index]; + $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 30, FALSE); $feedback_30_content = $this->load->view( 'mobile_first/jh-feedback-30-list', ['feedback_list' => $feedback_list], @@ -2973,14 +3002,14 @@ class Information extends CI_Controller { // 集合页面反馈标签 $feedback_city_array = []; preg_match_all('^^', $information->ic_content, $feedback_city_array); - if (! empty($feedback_city_array)) { + if (!empty($feedback_city_array)) { foreach ($feedback_city_array[0] as $index => $tag_name) { - $city_name_string = $feedback_city_array[1][$index]; - $city_name_list = explode(',', $city_name_string); + $city_name_string = $feedback_city_array[1][$index]; + $city_name_list = explode(',', $city_name_string); $feedback_city_list = []; foreach ($city_name_list as $index => $city_name) { - $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 5, FALSE); - $data_name = str_replace(" ", "_", $city_name); + $feedback_list = $this->Feedback_model->get_feedback_by_city_name($city_name, 5, FALSE); + $data_name = str_replace(" ", "_", $city_name); $feedback_city_list[$data_name] = $feedback_list; } @@ -2997,7 +3026,7 @@ class Information extends CI_Controller { } } - //主样式表,内联模式 + //主样式表,内联模式 if (is_file('D:/wwwroot/origin-www.japanhighlights.com/css/mobile-first.css')) { //主样式表,内联模式,优先读取本地,没有在从网络读取,为了加速 $main_css_string = compress_css(file_get_contents('D:/wwwroot/origin-www.japanhighlights.com/css/mobile-first.css')); } else { @@ -3006,34 +3035,34 @@ class Information extends CI_Controller { $template = str_replace('', '', $template); //额外样式 $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (! empty($meta_addon_css)) { + if (!empty($meta_addon_css)) { //内联方式 $meta_addon_css_string = compress_css(GET_HTTP($meta_addon_css)); - $template = str_replace('', '', $template); + $template = str_replace('', '', $template); } //额外js $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (! empty($meta_addon_js)) { + if (!empty($meta_addon_js)) { $template = str_replace('', '', $template); } $meta_note_ogtitle = get_meta($information->ic_id, 'meta_note_ogtitle'); - if (! empty($meta_note_ogtitle)) { + if (!empty($meta_note_ogtitle)) { $template = str_replace('', '', $template); } $meta_note = get_meta($information->ic_id, 'meta_note'); - if (! empty($meta_note)) { + if (!empty($meta_note)) { $template = str_replace('', '', $template); } $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); - if (! empty($meta_index_set)) { + if (!empty($meta_index_set)) { $template = str_replace('', '', $template); } //设置内容图片缓加载 $lazy_content = $this->html_optimize_lib->set_lazy_loader($information->ic_content, 'https://data.japanhighlights.com/grey.gif'); - $template = str_replace('', $lazy_content, $template); + $template = str_replace('', $lazy_content, $template); //Google广告代码 //if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) { @@ -3042,18 +3071,18 @@ class Information extends CI_Controller { //社媒分享图片 $full_ic_photo = ''; - if (! empty($information->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)) { + if (!empty($full_ic_photo)) { $template = str_replace('', '', $template); } // 设置图片尺寸 // 优化过图片目录:D:\wwwroot\origin-images.chinahighlights.com\optimize\ - $www_local_path = 'D:/wwwroot/origin-www.japanhighlights.com'; + $www_local_path = 'D:/wwwroot/origin-www.japanhighlights.com'; $image_local_path = 'D:/wwwroot/origin-images.chinahighlights.com/optimize'; if (is_dir($www_local_path) && is_dir($image_local_path)) { $template = $this->html_optimize_lib->set_image_size_local($template, $www_local_path, $image_local_path); @@ -3076,25 +3105,26 @@ class Information extends CI_Controller { * @return: * @Date Changed: */ - public function make_www_cache_ct($information) { + public function make_www_cache_ct($information) + { $data = []; - #region 公用数据 - //$apiurl = "http://202.103.68.104:61/info.php"; //本地测试 + #region 公用数据 + //$apiurl = "http://202.103.68.104:61/info.php"; //本地测试 $apiurl = "https://ct.mycht.cn/info.php"; //网前 //先准备数据,CT采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。 - $data["TITLE"] = $information->ic_seo_title; + $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; - $meta_ct_page_type = ""; - $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 - $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 - $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 + $data["KEYWORDS"] = $information->ic_seo_keywords; + $data["CANONICAL"] = $this->config->item('site_url') . $information->ic_url; + $meta_ct_page_type = ""; + $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 + $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 + $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 //面包屑 - $crumb = ""; + $crumb = ""; $crumb_data = $this->Information_model->get_path_exclude_ct($information->is_id, $information->is_path); if (count($crumb_data) > 0) { //至少有一个父类面包屑才显示 $crumb = "
Home"; @@ -3106,31 +3136,31 @@ class Information extends CI_Controller { $data["crumb"] = $crumb; //作者字符串,信息页或者城市天气页加载 2022-7-26 - $str_author = ""; - $author = $this->Operator_model->get_author_nikename($information->ic_author); + $str_author = ""; + $author = $this->Operator_model->get_author_nikename($information->ic_author); $meta_news_createdate = get_meta($information->ic_id, 'meta_news_createdate'); //信息发布时间 - if ((empty($meta_product_code) && ! ($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { - $OPI_FirstName = ! empty($author) ? $author->OPI_FirstName : 'author nickname'; - $EditTime = strtotime($information->ic_datetime); //如果有录入信息发布时间的属性,就读取这个 - if (! empty($meta_news_createdate)) { + if ((empty($meta_product_code) && !($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { + $OPI_FirstName = !empty($author) ? $author->OPI_FirstName : 'author nickname'; + $EditTime = strtotime($information->ic_datetime); //如果有录入信息发布时间的属性,就读取这个 + if (!empty($meta_news_createdate)) { $EditTime = strtotime($meta_news_createdate); } $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", $EditTime) . '
'; } - //火车票详细页搜索框添加 -- zp - $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 + //火车票详细页搜索框添加 -- zp + $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 $template_TrainDetailSearch = ""; if ($meta_ct_page_trainform == "yes" || $information->is_parent_id == "278014609") { - $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai - $data_TrainCity = []; + $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai + $data_TrainCity = []; $data_TrainCity["from"] = ""; - $data_TrainCity["to"] = ""; - if (! empty($meta_train_city)) { + $data_TrainCity["to"] = ""; + if (!empty($meta_train_city)) { if (strpos($meta_train_city, '|') !== false) { - $arrTrainCity = explode('|', $meta_train_city); + $arrTrainCity = explode('|', $meta_train_city); $data_TrainCity["from"] = $arrTrainCity[0]; - $data_TrainCity["to"] = $arrTrainCity[1]; + $data_TrainCity["to"] = $arrTrainCity[1]; } } @@ -3178,13 +3208,13 @@ class Information extends CI_Controller { // 解析结果:; Shanghai,Beijing $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); + $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/chinatravel-feedback-list', ['feedback_list' => $top3_feedback_list], true @@ -3202,13 +3232,13 @@ class Information extends CI_Controller { // 解析结果:; Shanghai,Beijing $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); + $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/chinatravel-feedback-cross', ['feedback_list' => $top3_feedback_list], true @@ -3229,11 +3259,11 @@ class Information extends CI_Controller { $data["CUSTOMCONENT"] = $ic_content; //非产品页面 - $data["PRODUCTJS"] = ""; - $data["ISPRODUCT"] = "no"; //判断是否是产品页 + $data["PRODUCTJS"] = ""; + $data["ISPRODUCT"] = "no"; //判断是否是产品页 $data["addthis_widget"] = ""; - $data["FloatIcon"] = ""; //浮动图标替代addthis - $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; + $data["FloatIcon"] = ""; //浮动图标替代addthis + $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; if (empty(get_meta($information->ic_id, 'meta_product_code')) || in_array($information->ic_url, $arrExitUrl)) { //$data["addthis_widget"] = $this->load->view($template_path . '-add-this', false, true); //社媒代码addthis @@ -3244,33 +3274,33 @@ class Information extends CI_Controller { } //顶部视频 - $data["TOPVIDEO"] = ""; - $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); + $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)) { + if (!empty($meta_news_video) && !empty($meta_video_picture)) { $data["TOPVIDEO"] = ''; } //主样式表,内联模式 //$apiweb="http://202.103.68.104"; //本地测试 - $apiweb = "https://data.chinatravel.com"; - $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"] = ''; //额外样式 $data["ADDONCSS"] = ""; - $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); - if (! empty($meta_addon_css)) { + $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"] = ''; + $data["ADDONCSS"] = ''; } //社媒分享图片 $data["OGIMAGE"] = ""; - if (! empty($information->ic_photo)) { + if (!empty($information->ic_photo)) { if (strpos($information->ic_photo, "chinatravel.com") != false) { $full_ic_photo = $information->ic_photo; } else { @@ -3281,20 +3311,20 @@ class Information extends CI_Controller { //结构化标签 $data["ConstructionCode"] = ""; - $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); - if (! empty($meta_construction_code)) { + $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); + if (!empty($meta_construction_code)) { $data["ConstructionCode"] = $meta_construction_code; } $data["meta_index_set"] = ""; - $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); - if (! empty($meta_index_set)) { + $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); + if (!empty($meta_index_set)) { $data["meta_index_set"] = ''; } //总JS:为了方便以后js好维护,必须的把一些公用的JS统计到一个文件。但是又不是所有页面都需要调用这个基础js,所以必须在这里进行判断 - $addBaseJs = false; - $addonJs = ""; + $addBaseJs = false; + $addonJs = ""; $meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格 if ($meta_ct_page_price == "yes") { @@ -3310,8 +3340,8 @@ class Information extends CI_Controller { //额外js $data["ADDONJS"] = ""; - $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (! empty($meta_addon_js)) { + $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); + if (!empty($meta_addon_js)) { $addonJs .= ''; } //价格js @@ -3332,7 +3362,7 @@ class Information extends CI_Controller { //页面传递参数 $passParam = ""; if (in_array($meta_ct_page_type, ["daytripindex", "tourindex", "attractionindex", "weatherpage"])) { //一日游和线路列表 - //产品首页 + //产品首页 $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); if (in_array($meta_ct_page_type, ["attractionindex"])) { @@ -3352,11 +3382,11 @@ class Information extends CI_Controller { $productCode = ""; if ($meta_ct_page_type == "daytripdetail") { //一日游 - if (! empty($meta_ct_page_type)) { + if (!empty($meta_ct_page_type)) { $productType = $meta_ct_page_type; } $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } $addonJs .= ''; @@ -3365,41 +3395,41 @@ class Information extends CI_Controller { } if ($meta_ct_page_type == "tourdetail") { //线路 - $productType = $meta_ct_page_type; + $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } //获取cli_sn - $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getCliSn/?param=" . $productCode)); + $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getCliSn/?param=" . $productCode)); $data["clisn"] = $tourdata->clisn; $tourdetail = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourDetail/?param=" . $productCode)); - if ($tourdetail->status =="ok"){ + if ($tourdetail->status == "ok") { $tourDays = $tourdetail->data->CLI_Days; $tourPassCity = $tourdetail->data->CLI2_PassCity; - }else{ + } else { $tourDays = 0; $tourPassCity = ""; } //调取模板 $dataform["TourCode"] = $productCode; - $dataform["CLI_SN"] = $tourdata->clisn; - $dataform["TourName"] = $tourDays."-day ".$information->ic_title." (".$tourPassCity.")"; + $dataform["CLI_SN"] = $tourdata->clisn; + $dataform["TourName"] = $tourDays . "-day " . $information->ic_title . " (" . $tourPassCity . ")"; } //游船详细页 if ($meta_ct_page_type == "cruisedetails") { - $productType = $meta_ct_page_type; + $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } - $dataCruise["shipname"] = $productCode; - $template_curisedetails = $this->load->view($template_path . '-cruisedetails-form', $dataCruise, true); + $dataCruise["shipname"] = $productCode; + $template_curisedetails = $this->load->view($template_path . '-cruisedetails-form', $dataCruise, true); $data["template_curisedetails"] = $template_curisedetails; } @@ -3414,34 +3444,34 @@ class Information extends CI_Controller { $data["productCode"] = $productCode; //页面添加的元素 - $data["ADDONJS"] = $addonJs; + $data["ADDONJS"] = $addonJs; $data["passParam"] = $passParam; #endregion #region 移动端和PC端差别处理区域 - $arrDevice = ["mobile", "pc"]; + $arrDevice = ["mobile", "pc"]; $data["showFormTourQi"] = true; //是否显示线路表单,默认显示 foreach ($arrDevice as $device) { //顶部全屏大图 - $data["TOPBANNER"] = ""; - $ImgText = ""; //图文字 - $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url'); + $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 = '' . $information->ic_title . ''; - if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) { + $bannerImg = '' . $information->ic_title . ''; + if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { $ImgText = ''; - } else if (! empty($meta_addon_picture_text)) { + } else if (!empty($meta_addon_picture_text)) { $ImgText = ''; } } else { $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); - $bannerImg = '' . $information->ic_title . ''; - if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) { + $bannerImg = '' . $information->ic_title . ''; + if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { $ImgText = ''; - } else if (! empty($meta_addon_picture_text)) { + } else if (!empty($meta_addon_picture_text)) { $ImgText = ''; } } @@ -3451,25 +3481,25 @@ class Information extends CI_Controller { if ($information->ic_url == "/china-trains/hometest" || $information->ic_url == "/china-trains") { //火车票首页 $template_TrainSearch = $this->load->view($template_path . '-train-index', null, true); - $ImgText = ""; + $ImgText = ""; //火车票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { $meta_addon_picture = ""; - $data["TOPBANNER"] = ''; + $data["TOPBANNER"] = ''; } } else if ($information->ic_url == "/china-flights") { //机票首页 $template_TrainSearch = $this->load->view($template_path . '-flight-index', null, true); - $ImgText = ""; + $ImgText = ""; //飞机票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { $meta_addon_picture = ""; - $data["TOPBANNER"] = ''; + $data["TOPBANNER"] = ''; } } - if (! empty($meta_addon_picture)) { - if (! empty($meta_addon_picture_url)) { + if (!empty($meta_addon_picture)) { + if (!empty($meta_addon_picture_url)) { $data["TOPBANNER"] = ''; } else { $data["TOPBANNER"] = ''; @@ -3477,43 +3507,43 @@ class Information extends CI_Controller { } if ($meta_ct_page_type == "tourdetail") { - $dataform['device'] = $device; - $template_form_tourqi = $this->load->view($template_path . '-form-tourqi-new', $dataform, true); + $dataform['device'] = $device; + $template_form_tourqi = $this->load->view($template_path . '-form-tourqi-new', $dataform, true); $data["template_form_tourqi"] = $template_form_tourqi; //表单模板字符串 /**替换左右结构的线路表单标签 2024-7-4*/ if (strpos($ic_content, '') !== false) { - $template_form_tourqi = $this->load->view($template_path . '-form-tourqi-new', $dataform, true); + $template_form_tourqi = $this->load->view($template_path . '-form-tourqi-new', $dataform, true); $ic_content_pc = $ic_content; //需要一个变量来过渡,不然$ic_content改变以后,PC端就没有标签了 $ic_content_pc = str_replace('', $template_form_tourqi, $ic_content_pc); $data["showFormTourQi"] = false; //如果有标签就不显示外面的表单,因为$ic_content会在第一次就替换掉标签,所以第二次pc端这里不执行。 - $data["CUSTOMCONENT"] = $ic_content_pc; + $data["CUSTOMCONENT"] = $ic_content_pc; } } //两种设备分别调用两种模板 ,静态化 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: + 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: } //生成静态文件 @@ -3533,25 +3563,26 @@ class Information extends CI_Controller { /** * 上海站 */ - public function make_www_cache_sh($information) { + public function make_www_cache_sh($information) + { $data = []; - #region 公用数据 - //$apiurl = "http://202.103.68.104:61/info.php"; //本地测试 + #region 公用数据 + //$apiurl = "http://202.103.68.104:61/info.php"; //本地测试 $apiurl = "https://ct.mycht.cn/info.php"; //网前 //先准备数据,采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。 - $data["TITLE"] = $information->ic_seo_title; + $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; - $meta_ct_page_type = ""; - $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 - $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 - $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 + $data["KEYWORDS"] = $information->ic_seo_keywords; + $data["CANONICAL"] = $this->config->item('site_url') . $information->ic_url; + $meta_ct_page_type = ""; + $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 + $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 + $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 //面包屑 - $crumb = ""; + $crumb = ""; $crumb_data = $this->Information_model->get_path_exclude_ct($information->is_id, $information->is_path); if (count($crumb_data) > 0) { //至少有一个父类面包屑才显示 $crumb = "
Home"; @@ -3564,25 +3595,25 @@ class Information extends CI_Controller { //作者字符串,信息页或者城市天气页加载 2022-7-26 $str_author = ""; - $author = $this->Operator_model->get_author_nikename($information->ic_author); - if ((empty($meta_product_code) && ! ($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { - $OPI_FirstName = ! empty($author) ? $author->OPI_FirstName : 'author nickname'; - $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; + $author = $this->Operator_model->get_author_nikename($information->ic_author); + if ((empty($meta_product_code) && !($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { + $OPI_FirstName = !empty($author) ? $author->OPI_FirstName : 'author nickname'; + $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; } - //火车票详细页搜索框添加 -- zp - $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 + //火车票详细页搜索框添加 -- zp + $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 $template_TrainDetailSearch = ""; if ($meta_ct_page_trainform == "yes" || strpos($information->ic_url, "/china-trains") !== false) { - $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai - $data_TrainCity = []; + $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai + $data_TrainCity = []; $data_TrainCity["from"] = ""; - $data_TrainCity["to"] = ""; - if (! empty($meta_train_city)) { + $data_TrainCity["to"] = ""; + if (!empty($meta_train_city)) { if (strpos($meta_train_city, '|') !== false) { - $arrTrainCity = explode('|', $meta_train_city); + $arrTrainCity = explode('|', $meta_train_city); $data_TrainCity["from"] = $arrTrainCity[0]; - $data_TrainCity["to"] = $arrTrainCity[1]; + $data_TrainCity["to"] = $arrTrainCity[1]; } } @@ -3600,13 +3631,13 @@ class Information extends CI_Controller { // 解析结果:; Shanghai,Beijing $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); + $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/chinatravel-feedback-list', ['feedback_list' => $top3_feedback_list], true @@ -3624,13 +3655,13 @@ class Information extends CI_Controller { // 解析结果:; Shanghai,Beijing $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); + $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/chinatravel-feedback-cross', ['feedback_list' => $top3_feedback_list], true @@ -3649,11 +3680,11 @@ class Information extends CI_Controller { $ic_content = $this->html_optimize_lib->set_image_size($ic_content); //非产品页面 - $data["PRODUCTJS"] = ""; - $data["ISPRODUCT"] = "no"; //判断是否是产品页 + $data["PRODUCTJS"] = ""; + $data["ISPRODUCT"] = "no"; //判断是否是产品页 $data["addthis_widget"] = ""; - $data["FloatIcon"] = ""; //浮动图标替代addthis - $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; + $data["FloatIcon"] = ""; //浮动图标替代addthis + $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; if (empty(get_meta($information->ic_id, 'meta_product_code')) || in_array($information->ic_url, $arrExitUrl)) { $data["FloatIcon"] = ""; @@ -3662,33 +3693,33 @@ class Information extends CI_Controller { } //顶部视频 - $data["TOPVIDEO"] = ""; - $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); + $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)) { + if (!empty($meta_news_video) && !empty($meta_video_picture)) { $data["TOPVIDEO"] = ''; } //主样式表,内联模式 //$apiweb="http://202.103.68.104:81"; //本地测试 - $apiweb = "https://data.shanghaihighlights.com"; - $cssUrl = $apiweb . "/css/css3/base.css?v=" . time(); + $apiweb = "https://data.shanghaihighlights.com"; + $cssUrl = $apiweb . "/css/css3/base.css?v=" . time(); $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)) { + $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"] = ''; + $data["ADDONCSS"] = ''; } //社媒分享图片 $data["OGIMAGE"] = ""; - if (! empty($information->ic_photo)) { + if (!empty($information->ic_photo)) { if (strpos($information->ic_photo, "shanghaihighlights.com") != false) { $full_ic_photo = $information->ic_photo; } else { @@ -3699,20 +3730,20 @@ class Information extends CI_Controller { //结构化标签 $data["ConstructionCode"] = ""; - $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); - if (! empty($meta_construction_code)) { + $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); + if (!empty($meta_construction_code)) { $data["ConstructionCode"] = $meta_construction_code; } $data["meta_index_set"] = ""; - $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); - if (! empty($meta_index_set)) { + $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); + if (!empty($meta_index_set)) { $data["meta_index_set"] = ''; } //总JS:为了方便以后js好维护,必须的把一些公用的JS统计到一个文件。但是又不是所有页面都需要调用这个基础js,所以必须在这里进行判断 - $addBaseJs = false; - $addonJs = ""; + $addBaseJs = false; + $addonJs = ""; $meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格 if ($meta_ct_page_price == "yes") { @@ -3728,8 +3759,8 @@ class Information extends CI_Controller { //额外js $data["ADDONJS"] = ""; - $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (! empty($meta_addon_js)) { + $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); + if (!empty($meta_addon_js)) { $addonJs .= ''; } //价格js @@ -3750,7 +3781,7 @@ class Information extends CI_Controller { //页面传递参数 $passParam = ""; if (in_array($meta_ct_page_type, ["daytripindex", "tourindex", "attractionindex", "weatherpage"])) { //一日游和线路列表 - //产品首页 + //产品首页 $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); if (in_array($meta_ct_page_type, ["attractionindex"])) { @@ -3770,11 +3801,11 @@ class Information extends CI_Controller { $productCode = ""; if ($meta_ct_page_type == "daytripdetail") { //一日游 - if (! empty($meta_ct_page_type)) { + if (!empty($meta_ct_page_type)) { $productType = $meta_ct_page_type; } $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } $addonJs .= ''; @@ -3783,28 +3814,28 @@ class Information extends CI_Controller { //一日游表单的替换 $DayTripData["productCode"] = $productCode; - $template_form_daydetail = $this->load->view($template_path . '-daydetail-form', $DayTripData, true); //模板内容 - //使用simple_html_dom_lib库来进行表单添加 + $template_form_daydetail = $this->load->view($template_path . '-daydetail-form', $DayTripData, true); //模板内容 + //使用simple_html_dom_lib库来进行表单添加 $ic_content = $this->html_optimize_lib->add_htmlcode($ic_content, "#maincontent", $template_form_daydetail); } if ($meta_ct_page_type == "tourdetail") { //线路 - $productType = $meta_ct_page_type; + $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } //获取cli_sn - $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apish/getCliSn/?param=" . $productCode)); + $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apish/getCliSn/?param=" . $productCode)); $data["clisn"] = $tourdata->clisn; //获取price - $tourprice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apish/getTourPrice/?param=" . $productCode)); + $tourprice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apish/getTourPrice/?param=" . $productCode)); $dataform["tourprice"] = $tourprice->price; //调取模板 $dataform["TourCode"] = $productCode; - $dataform["CLI_SN"] = $tourdata->clisn; + $dataform["CLI_SN"] = $tourdata->clisn; $dataform["TourName"] = $information->ic_title; $dataform["ic_photo"] = $information->ic_photo; $template_form_tourqi = $this->load->view($template_path . '-form-tourqi', $dataform, true); @@ -3815,28 +3846,28 @@ class Information extends CI_Controller { if ($meta_ct_page_type == "tourlist") { //线路类型列表 - $lineTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getLineTypeList/?webcode=shanghai")); + $lineTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getLineTypeList/?webcode=shanghai")); $dataTourList["lineTypeList"] = $lineTypeList; - $tourListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourList/?webcode=shanghai")); + $tourListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourList/?webcode=shanghai")); $dataTourList["tourListData"] = $tourListData; - //替换模板 + //替换模板 $template_page_tourlist = $this->load->view($template_path . '-tour-list', $dataTourList, true); //模板内容 - $ic_content = str_replace('', $template_page_tourlist, $ic_content); + $ic_content = str_replace('', $template_page_tourlist, $ic_content); $addonJs .= ''; } if ($meta_ct_page_type == "daytriplist") { //一日游类型 - $allTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getPagTypeList/?webcode=shanghai")); - $dataDayTripList["allTypeList"] = $allTypeList; - $dayTripListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getSearchDaytripList/?webcode=shanghai")); + $allTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getPagTypeList/?webcode=shanghai")); + $dataDayTripList["allTypeList"] = $allTypeList; + $dayTripListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getSearchDaytripList/?webcode=shanghai")); $dataDayTripList["dayTripListData"] = $dayTripListData; - //替换模板 + //替换模板 $template_page_daytriplist = $this->load->view($template_path . '-daytrip-list', $dataDayTripList, true); //模板内容 - $ic_content = str_replace('', $template_page_daytriplist, $ic_content); + $ic_content = str_replace('', $template_page_daytriplist, $ic_content); $addonJs .= ''; } @@ -3858,7 +3889,7 @@ class Information extends CI_Controller { $data["productCode"] = $productCode; //页面添加的元素 - $data["ADDONJS"] = $addonJs; + $data["ADDONJS"] = $addonJs; $data["passParam"] = $passParam; //页面详细内容放最后,这样上面都可以进行内容的替换,比如一日游表单 @@ -3870,24 +3901,24 @@ class Information extends CI_Controller { $arrDevice = ["mobile", "pc"]; foreach ($arrDevice as $device) { //顶部全屏大图 - $data["TOPBANNER"] = ""; - $ImgText = ""; //图文字 - $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url'); + $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 = '' . $information->ic_title . ''; - if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) { + $bannerImg = '' . $information->ic_title . ''; + if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { $ImgText = ''; - } else if (! empty($meta_addon_picture_text)) { + } else if (!empty($meta_addon_picture_text)) { $ImgText = ''; } } else { $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); - $bannerImg = '' . $information->ic_title . ''; - if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) { + $bannerImg = '' . $information->ic_title . ''; + if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { $ImgText = ''; - } else if (! empty($meta_addon_picture_text)) { + } else if (!empty($meta_addon_picture_text)) { $ImgText = ''; } } @@ -3897,25 +3928,25 @@ class Information extends CI_Controller { if ($information->ic_url == "/china-trains/hometest" || $information->ic_url == "/trains") { //火车票首页 $template_TrainSearch = $this->load->view($template_path . '-train-index', null, true); - $ImgText = ""; + $ImgText = ""; //火车票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { $meta_addon_picture = ""; - $data["TOPBANNER"] = ''; + $data["TOPBANNER"] = ''; } } else if ($information->ic_url == "/china-flights") { //机票首页 $template_TrainSearch = $this->load->view($template_path . '-flight-index', null, true); - $ImgText = ""; + $ImgText = ""; //飞机票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { $meta_addon_picture = ""; - $data["TOPBANNER"] = ''; + $data["TOPBANNER"] = ''; } } - if (! empty($meta_addon_picture)) { - if (! empty($meta_addon_picture_url)) { + if (!empty($meta_addon_picture)) { + if (!empty($meta_addon_picture_url)) { $data["TOPBANNER"] = ''; } else { $data["TOPBANNER"] = ''; @@ -3924,27 +3955,27 @@ class Information extends CI_Controller { //两种设备分别调用两种模板 ,静态化 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: + 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: } //生成静态文件 @@ -3964,25 +3995,26 @@ class Information extends CI_Controller { /** * 北京站mybeijingchina.com */ - public function make_www_cache_bj($information) { + public function make_www_cache_bj($information) + { $data = []; - #region 公用数据 - //$apiurl = "http://202.103.68.104:61/info.php"; //本地测试 + #region 公用数据 + //$apiurl = "http://202.103.68.104:61/info.php"; //本地测试 $apiurl = "https://ct.mycht.cn/info.php"; //网前 //先准备数据,采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。 - $data["TITLE"] = $information->ic_seo_title; + $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; - $meta_ct_page_type = ""; - $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 - $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 - $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 + $data["KEYWORDS"] = $information->ic_seo_keywords; + $data["CANONICAL"] = $this->config->item('site_url') . $information->ic_url; + $meta_ct_page_type = ""; + $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 + $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 + $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 //面包屑 - $crumb = ""; + $crumb = ""; $crumb_data = $this->Information_model->get_path_exclude_ct($information->is_id, $information->is_path); if (count($crumb_data) > 0) { //至少有一个父类面包屑才显示 $crumb = "
Home"; @@ -3995,25 +4027,25 @@ class Information extends CI_Controller { //作者字符串,信息页或者城市天气页加载 2022-7-26 $str_author = ""; - $author = $this->Operator_model->get_author_nikename($information->ic_author); - if ((empty($meta_product_code) && ! ($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { - $OPI_FirstName = ! empty($author) ? $author->OPI_FirstName : 'author nickname'; - $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; + $author = $this->Operator_model->get_author_nikename($information->ic_author); + if ((empty($meta_product_code) && !($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { + $OPI_FirstName = !empty($author) ? $author->OPI_FirstName : 'author nickname'; + $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; } - //火车票详细页搜索框添加 -- zp - $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 + //火车票详细页搜索框添加 -- zp + $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 $template_TrainDetailSearch = ""; if ($meta_ct_page_trainform == "yes" || strpos($information->ic_url, "/china-trains") !== false) { - $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai - $data_TrainCity = []; + $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai + $data_TrainCity = []; $data_TrainCity["from"] = ""; - $data_TrainCity["to"] = ""; - if (! empty($meta_train_city)) { + $data_TrainCity["to"] = ""; + if (!empty($meta_train_city)) { if (strpos($meta_train_city, '|') !== false) { - $arrTrainCity = explode('|', $meta_train_city); + $arrTrainCity = explode('|', $meta_train_city); $data_TrainCity["from"] = $arrTrainCity[0]; - $data_TrainCity["to"] = $arrTrainCity[1]; + $data_TrainCity["to"] = $arrTrainCity[1]; } } @@ -4031,13 +4063,13 @@ class Information extends CI_Controller { // 解析结果:; Shanghai,Beijing $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); + $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/chinatravel-feedback-list', ['feedback_list' => $top3_feedback_list], true @@ -4055,13 +4087,13 @@ class Information extends CI_Controller { // 解析结果:; Shanghai,Beijing $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); + $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/chinatravel-feedback-cross', ['feedback_list' => $top3_feedback_list], true @@ -4080,11 +4112,11 @@ class Information extends CI_Controller { $ic_content = $this->html_optimize_lib->set_image_size($ic_content); //非产品页面 - $data["PRODUCTJS"] = ""; - $data["ISPRODUCT"] = "no"; //判断是否是产品页 + $data["PRODUCTJS"] = ""; + $data["ISPRODUCT"] = "no"; //判断是否是产品页 $data["addthis_widget"] = ""; - $data["FloatIcon"] = ""; //浮动图标替代addthis - $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; + $data["FloatIcon"] = ""; //浮动图标替代addthis + $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; if (empty(get_meta($information->ic_id, 'meta_product_code')) || in_array($information->ic_url, $arrExitUrl)) { $data["FloatIcon"] = ""; @@ -4093,33 +4125,33 @@ class Information extends CI_Controller { } //顶部视频 - $data["TOPVIDEO"] = ""; - $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); + $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)) { + if (!empty($meta_news_video) && !empty($meta_video_picture)) { $data["TOPVIDEO"] = ''; } //主样式表,内联模式 //$apiweb="http://202.103.68.104:84"; //本地测试 - $apiweb = "https://www.mybeijingchina.com"; - $cssUrl = $apiweb . "/css/css3/base.css?v=" . time(); + $apiweb = "https://www.mybeijingchina.com"; + $cssUrl = $apiweb . "/css/css3/base.css?v=" . time(); $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)) { + $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"] = ''; + $data["ADDONCSS"] = ''; } //社媒分享图片 $data["OGIMAGE"] = ""; - if (! empty($information->ic_photo)) { + if (!empty($information->ic_photo)) { if (strpos($information->ic_photo, "mybeijingchina.com") != false) { $full_ic_photo = $information->ic_photo; } else { @@ -4130,20 +4162,20 @@ class Information extends CI_Controller { //结构化标签 $data["ConstructionCode"] = ""; - $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); - if (! empty($meta_construction_code)) { + $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); + if (!empty($meta_construction_code)) { $data["ConstructionCode"] = $meta_construction_code; } $data["meta_index_set"] = ""; - $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); - if (! empty($meta_index_set)) { + $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); + if (!empty($meta_index_set)) { $data["meta_index_set"] = ''; } //总JS:为了方便以后js好维护,必须的把一些公用的JS统计到一个文件。但是又不是所有页面都需要调用这个基础js,所以必须在这里进行判断 - $addBaseJs = false; - $addonJs = ""; + $addBaseJs = false; + $addonJs = ""; $meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格 if ($meta_ct_page_price == "yes") { @@ -4159,8 +4191,8 @@ class Information extends CI_Controller { //额外js $data["ADDONJS"] = ""; - $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (! empty($meta_addon_js)) { + $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); + if (!empty($meta_addon_js)) { $addonJs .= ''; } //价格js @@ -4181,7 +4213,7 @@ class Information extends CI_Controller { //页面传递参数 $passParam = ""; if (in_array($meta_ct_page_type, ["daytripindex", "tourindex", "attractionindex", "weatherpage"])) { //一日游和线路列表 - //产品首页 + //产品首页 $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); if (in_array($meta_ct_page_type, ["attractionindex"])) { @@ -4201,63 +4233,63 @@ class Information extends CI_Controller { $productCode = ""; if ($meta_ct_page_type == "daytripdetail") { //一日游 - if (! empty($meta_ct_page_type)) { + if (!empty($meta_ct_page_type)) { $productType = $meta_ct_page_type; } $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } $addonJs .= ''; //$addonJs .= ''; $data["ADDONCSS"] .= ''; - //一日游表单的替换,放到下面的区分PC端和移动端 + //一日游表单的替换,放到下面的区分PC端和移动端 } if ($meta_ct_page_type == "tourdetail") { //线路 - $productType = $meta_ct_page_type; + $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } //获取cli_sn - $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apibj/getCliSn/?param=" . $productCode)); + $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apibj/getCliSn/?param=" . $productCode)); $data["clisn"] = $tourdata->clisn; //调取模板 $dataform["TourCode"] = $productCode; - $dataform["CLI_SN"] = $tourdata->clisn; + $dataform["CLI_SN"] = $tourdata->clisn; $dataform["TourName"] = $information->ic_title; } if ($meta_ct_page_type == "tourlist") { //线路类型列表 - $lineTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getLineTypeList/?webcode=beijing")); + $lineTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getLineTypeList/?webcode=beijing")); $dataTourList["lineTypeList"] = $lineTypeList; - $tourListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourList/?webcode=beijing")); + $tourListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourList/?webcode=beijing")); $dataTourList["tourListData"] = $tourListData; - //替换模板 + //替换模板 $template_page_tourlist = $this->load->view('mobile_first/shanghai-tour-list', $dataTourList, true); //模板内容,统一用上海站模板 - $ic_content = str_replace('', $template_page_tourlist, $ic_content); + $ic_content = str_replace('', $template_page_tourlist, $ic_content); $addonJs .= ''; } if ($meta_ct_page_type == "daytriplist") { //一日游类型 - $allTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getPagTypeList/?webcode=beijing")); - $dataDayTripList["allTypeList"] = $allTypeList; - $dayTripListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getSearchDaytripList/?webcode=beijing")); + $allTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getPagTypeList/?webcode=beijing")); + $dataDayTripList["allTypeList"] = $allTypeList; + $dayTripListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getSearchDaytripList/?webcode=beijing")); $dataDayTripList["dayTripListData"] = $dayTripListData; - //替换模板 + //替换模板 $template_page_daytriplist = $this->load->view('mobile_first/shanghai-daytrip-list', $dataDayTripList, true); //模板内容,统一用上海站模板 - $ic_content = str_replace('', $template_page_daytriplist, $ic_content); + $ic_content = str_replace('', $template_page_daytriplist, $ic_content); $addonJs .= ''; } @@ -4279,7 +4311,7 @@ class Information extends CI_Controller { $data["productCode"] = $productCode; //页面添加的元素 - $data["ADDONJS"] = $addonJs; + $data["ADDONJS"] = $addonJs; $data["passParam"] = $passParam; //页面详细内容放最后,这样上面都可以进行内容的替换,比如一日游表单 @@ -4291,24 +4323,24 @@ class Information extends CI_Controller { $arrDevice = ["mobile", "pc"]; foreach ($arrDevice as $device) { //顶部全屏大图 - $data["TOPBANNER"] = ""; - $ImgText = ""; //图文字 - $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url'); + $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 = '' . $information->ic_title . ''; - if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) { + $bannerImg = '' . $information->ic_title . ''; + if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { $ImgText = ''; - } else if (! empty($meta_addon_picture_text)) { + } else if (!empty($meta_addon_picture_text)) { $ImgText = ''; } } else { $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); - $bannerImg = '' . $information->ic_title . ''; - if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) { + $bannerImg = '' . $information->ic_title . ''; + if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { $ImgText = ''; - } else if (! empty($meta_addon_picture_text)) { + } else if (!empty($meta_addon_picture_text)) { $ImgText = ''; } } @@ -4318,25 +4350,25 @@ class Information extends CI_Controller { if ($information->ic_url == "/china-trains/hometest" || $information->ic_url == "/trains") { //火车票首页 $template_TrainSearch = $this->load->view($template_path . '-train-index', null, true); - $ImgText = ""; + $ImgText = ""; //火车票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { $meta_addon_picture = ""; - $data["TOPBANNER"] = ''; + $data["TOPBANNER"] = ''; } } else if ($information->ic_url == "/china-flights") { //机票首页 $template_TrainSearch = $this->load->view($template_path . '-flight-index', null, true); - $ImgText = ""; + $ImgText = ""; //飞机票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { $meta_addon_picture = ""; - $data["TOPBANNER"] = ''; + $data["TOPBANNER"] = ''; } } - if (! empty($meta_addon_picture)) { - if (! empty($meta_addon_picture_url)) { + if (!empty($meta_addon_picture)) { + if (!empty($meta_addon_picture_url)) { $data["TOPBANNER"] = ''; } else { $data["TOPBANNER"] = ''; @@ -4347,13 +4379,13 @@ class Information extends CI_Controller { if ($meta_ct_page_type == "daytripdetail") { //一日游产品的表单处理放这里,根据PC和移动端有所区别 $DayTripData['device'] = $device; //准备数据 - $DayTripData["productCode"] = $productCode; + $DayTripData["productCode"] = $productCode; $DayTripData["picture_mobile"] = get_meta($information->ic_id, 'meta_addon_picture_mobile'); - $DayTripData["picture_pc"] = get_meta($information->ic_id, 'meta_addon_picture'); - $DayTripData["TITLE"] = $information->ic_title; + $DayTripData["picture_pc"] = get_meta($information->ic_id, 'meta_addon_picture'); + $DayTripData["TITLE"] = $information->ic_title; - $InfoData = new stdClass(); //传递用来计算的信息平台数据 - $MinTravelers = get_meta($information->ic_id, 'meta_trippest_limitperson'); + $InfoData = new stdClass(); //传递用来计算的信息平台数据 + $MinTravelers = get_meta($information->ic_id, 'meta_trippest_limitperson'); $InfoData->MinTravelers = $MinTravelers == null ? 0 : $MinTravelers; //附加选项 $t_Type = get_meta($information->ic_id, "meta_trippest_type"); //产品类型 @@ -4362,43 +4394,43 @@ class Information extends CI_Controller { } else { $InfoData->t_Type = "general"; } - $t_excludedate = get_meta($information->ic_id, "meta_trippest_excludedate"); - $t_includedate = get_meta($information->ic_id, "meta_trippest_includedate"); - $t_excludemonth = get_meta($information->ic_id, "meta_trippest_excludemonth"); - $InfoData->t_excludedate = $t_excludedate; - $InfoData->t_includedate = $t_includedate; + $t_excludedate = get_meta($information->ic_id, "meta_trippest_excludedate"); + $t_includedate = get_meta($information->ic_id, "meta_trippest_includedate"); + $t_excludemonth = get_meta($information->ic_id, "meta_trippest_excludemonth"); + $InfoData->t_excludedate = $t_excludedate; + $InfoData->t_includedate = $t_includedate; $InfoData->t_excludemonth = $t_excludemonth; $InfoData->t_hoteladdress = get_meta($information->ic_id, "meta_trippest_hoteladdress"); - $InfoData->t_defaultDate = get_meta($information->ic_id, "meta_trippest_defaultDate"); + $InfoData->t_defaultDate = get_meta($information->ic_id, "meta_trippest_defaultDate"); //延迟天数 $t_meta_trippest_delayday = get_meta($information->ic_id, "meta_trippest_delayday"); - $InfoData->t_meta_trippest_delayday = $t_meta_trippest_delayday == null ? 0 : $t_meta_trippest_delayday; + $InfoData->t_meta_trippest_delayday = $t_meta_trippest_delayday == null ? 0 : $t_meta_trippest_delayday; $DayTripData["InfoData"] = $InfoData; //传递信息平台数据 $linktour = get_meta($information->ic_id, 'meta_trainspread_linktour'); //关联线路 - if (! empty($linktour)) { + if (!empty($linktour)) { $paramCode = $productCode . "," . $linktour; } else { $paramCode = $productCode; } //产品汉特信息,测试地址:http://202.103.68.104:61/info.php/thirdparty/ctmobilefirst/apits/getDaytripDetail/?param=TS-HKALC-1,TS-HKALC-2,TS-HKALC-3 - $TourData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getDaytripDetail/?webcode=beijing¶m=" . $paramCode)); + $TourData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getDaytripDetail/?webcode=beijing¶m=" . $paramCode)); $DayTripData["TourData"] = $TourData; $TourPrice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getDaytripsPrice/?webcode=beijing¶m=" . $productCode)); if ($TourPrice->status == "ok") { $DayTripData["DaytripPrice"] = $TourPrice->price; } else { - $TourPrice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getDaytripsPrice/?webcode=beijing¶m=" . $productCode . ",3")); + $TourPrice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getDaytripsPrice/?webcode=beijing¶m=" . $productCode . ",3")); $DayTripData["DaytripPrice"] = $TourPrice->price; } - $template_form_daydetail = $this->load->view($template_path . '-daydetail-form', $DayTripData, true); //模板内容 + $template_form_daydetail = $this->load->view($template_path . '-daydetail-form', $DayTripData, true); //模板内容 //使用simple_html_dom_lib库来进行表单添加 $ic_content_pc = $ic_content; //需要一个变量来过渡,不然$ic_content改变以后PC端就没有 $ic_content_pc = $this->html_optimize_lib->add_htmlcode($ic_content, "#maincontent", $template_form_daydetail); @@ -4406,7 +4438,7 @@ class Information extends CI_Controller { } if ($meta_ct_page_type == "tourdetail") { //线路表单,左右结构,用标签来做 - $dataform['device'] = $device; + $dataform['device'] = $device; $template_form_tourqi = $this->load->view($template_path . '-form-tourqi-new', $dataform, true); $ic_content_pc = $ic_content; //需要一个变量来过渡,不然$ic_content改变以后,PC端就没有标签了 $ic_content_pc = str_replace('', $template_form_tourqi, $ic_content_pc); @@ -4415,27 +4447,27 @@ class Information extends CI_Controller { //两种设备分别调用两种模板 ,静态化 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: + 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: } //生成静态文件 @@ -4455,7 +4487,8 @@ class Information extends CI_Controller { /** * TrainSpread网站静态化 */ - public function make_www_cache_ts($information) { + public function make_www_cache_ts($information) + { $data = []; #region 公用数据 @@ -4463,17 +4496,17 @@ class Information extends CI_Controller { $apiurl = "https://ct.mycht.cn/info.php"; //网前 //先准备数据,采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。 - $data["TITLE"] = $information->ic_seo_title; + $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; - $meta_ct_page_type = ""; - $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 - $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 - $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 + $data["KEYWORDS"] = $information->ic_seo_keywords; + $data["CANONICAL"] = $this->config->item('site_url') . $information->ic_url; + $meta_ct_page_type = ""; + $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 + $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 + $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 //面包屑 - $crumb = ""; + $crumb = ""; $crumb_data = $this->Information_model->get_path_exclude_ct($information->is_id, $information->is_path); if (count($crumb_data) > 0) { //至少有一个父类面包屑才显示 $crumb = "
Home"; @@ -4486,25 +4519,25 @@ class Information extends CI_Controller { //作者字符串,信息页或者城市天气页加载 2022-7-26 $str_author = ""; - $author = $this->Operator_model->get_author_nikename($information->ic_author); - if ((empty($meta_product_code) && ! ($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { - $OPI_FirstName = ! empty($author) ? $author->OPI_FirstName : 'author nickname'; - $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; + $author = $this->Operator_model->get_author_nikename($information->ic_author); + if ((empty($meta_product_code) && !($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { + $OPI_FirstName = !empty($author) ? $author->OPI_FirstName : 'author nickname'; + $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; } - //火车票详细页搜索框添加 -- zp - $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 + //火车票详细页搜索框添加 -- zp + $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 $template_TrainDetailSearch = ""; if ($meta_ct_page_trainform == "yes" || strpos($information->ic_url, "/china-trains") !== false) { - $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai - $data_TrainCity = []; + $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai + $data_TrainCity = []; $data_TrainCity["from"] = ""; - $data_TrainCity["to"] = ""; - if (! empty($meta_train_city)) { + $data_TrainCity["to"] = ""; + if (!empty($meta_train_city)) { if (strpos($meta_train_city, '|') !== false) { - $arrTrainCity = explode('|', $meta_train_city); + $arrTrainCity = explode('|', $meta_train_city); $data_TrainCity["from"] = $arrTrainCity[0]; - $data_TrainCity["to"] = $arrTrainCity[1]; + $data_TrainCity["to"] = $arrTrainCity[1]; } } @@ -4523,11 +4556,11 @@ class Information extends CI_Controller { $ic_content = $this->html_optimize_lib->set_image_size($ic_content); //非产品页面 - $data["PRODUCTJS"] = ""; - $data["ISPRODUCT"] = "no"; //判断是否是产品页 + $data["PRODUCTJS"] = ""; + $data["ISPRODUCT"] = "no"; //判断是否是产品页 $data["addthis_widget"] = ""; - $data["FloatIcon"] = ""; //浮动图标替代addthis - $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; + $data["FloatIcon"] = ""; //浮动图标替代addthis + $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; if (empty(get_meta($information->ic_id, 'meta_product_code')) || in_array($information->ic_url, $arrExitUrl)) { $data["FloatIcon"] = ""; @@ -4536,67 +4569,67 @@ class Information extends CI_Controller { } //顶部视频 - $data["TOPVIDEO"] = ""; - $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); + $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)) { + if (!empty($meta_news_video) && !empty($meta_video_picture)) { $data["TOPVIDEO"] = ''; } //主样式表,内联模式 //$apiweb="http://202.103.68.104:71"; //本地测试 - $apiweb = "https://www.trainspread.com"; - $cssUrl = $apiweb . "/css/base.css?v=" . time(); + $apiweb = "https://www.trainspread.com"; + $cssUrl = $apiweb . "/css/base.css?v=" . time(); $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)) { + $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"] = ''; + $data["ADDONCSS"] = ''; } //社媒分享图片 - $data["OGIMAGE"] = ""; + $data["OGIMAGE"] = ""; $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile'); - if (! empty($information->ic_photo)) { + if (!empty($information->ic_photo)) { // if (strpos($information->ic_photo, "trainspread.com") != false) { // $full_ic_photo = $information->ic_photo; // } else { // $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo; // } - $full_ic_photo = $information->ic_photo; + $full_ic_photo = $information->ic_photo; $data["OGIMAGE"] = ''; - } else if (! empty($meta_addon_picture)) { + } else if (!empty($meta_addon_picture)) { // if (strpos($meta_addon_picture, "trainspread.com") != false) { // $full_ic_photo = $meta_addon_picture; // } else { // $full_ic_photo = $this->config->item('site_image_url') . $meta_addon_picture; // } - $full_ic_photo = $meta_addon_picture; + $full_ic_photo = $meta_addon_picture; $data["OGIMAGE"] = ''; } //结构化标签 $data["ConstructionCode"] = ""; - $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); - if (! empty($meta_construction_code)) { + $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); + if (!empty($meta_construction_code)) { $data["ConstructionCode"] = $meta_construction_code; } $data["meta_index_set"] = ""; - $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); - if (! empty($meta_index_set)) { + $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); + if (!empty($meta_index_set)) { $data["meta_index_set"] = ''; } //总JS:为了方便以后js好维护,必须的把一些公用的JS统计到一个文件。但是又不是所有页面都需要调用这个基础js,所以必须在这里进行判断 - $addBaseJs = false; - $addonJs = ""; + $addBaseJs = false; + $addonJs = ""; $meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格 if ($meta_ct_page_price == "yes") { @@ -4612,8 +4645,8 @@ class Information extends CI_Controller { //额外js $data["ADDONJS"] = ""; - $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (! empty($meta_addon_js)) { + $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); + if (!empty($meta_addon_js)) { $addonJs .= ''; } //价格js @@ -4634,7 +4667,7 @@ class Information extends CI_Controller { //页面传递参数 $passParam = ""; if (in_array($meta_ct_page_type, ["daytripindex", "tourindex", "attractionindex", "weatherpage"])) { //一日游和线路列表 - //产品首页 + //产品首页 $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); if (in_array($meta_ct_page_type, ["attractionindex"])) { @@ -4654,23 +4687,23 @@ class Information extends CI_Controller { $productCode = ""; if ($meta_ct_page_type == "daytripdetail") { //一日游 - if (! empty($meta_ct_page_type)) { + if (!empty($meta_ct_page_type)) { $productType = $meta_ct_page_type; } $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } - $addonJs .= ''; + $addonJs .= ''; // $addonJs .= ''; $data["ADDONCSS"] .= ''; //一日游表单的替换,放到下面的区分PC端和移动端 //浮动按钮 $floatButton = ''; - if ( strpos($ic_content, 'container-right') !== false){ + if (strpos($ic_content, 'container-right') !== false) { $ic_content = $this->html_optimize_lib->add_htmlcode($ic_content, ".container-right", $floatButton); - }else{ + } else { $ic_content = $this->html_optimize_lib->add_htmlcode($ic_content, ".container-details", $floatButton); } @@ -4678,19 +4711,19 @@ class Information extends CI_Controller { } if ($meta_ct_page_type == "tourdetail") { //线路 - $productType = $meta_ct_page_type; + $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } //获取cli_sn - $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apits/getCliSn/?param=" . $productCode)); + $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apits/getCliSn/?param=" . $productCode)); $data["clisn"] = $tourdata->clisn; //调取模板 $dataform["TourCode"] = $productCode; - $dataform["CLI_SN"] = $tourdata->clisn; + $dataform["CLI_SN"] = $tourdata->clisn; $dataform["TourName"] = $information->ic_title; } @@ -4713,7 +4746,7 @@ class Information extends CI_Controller { $data["productCode"] = $productCode; //页面添加的元素 - $data["ADDONJS"] = $addonJs; + $data["ADDONJS"] = $addonJs; $data["passParam"] = $passParam; //页面详细内容放最后,这样上面都可以进行内容的替换,比如一日游表单 @@ -4725,24 +4758,24 @@ class Information extends CI_Controller { $arrDevice = ["mobile", "pc"]; foreach ($arrDevice as $device) { //顶部全屏大图 - $data["TOPBANNER"] = ""; - $ImgText = ""; //图文字 - $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url'); + $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 = '' . $information->ic_title . ''; - if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) { + $bannerImg = '' . $information->ic_title . ''; + if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { $ImgText = ''; - } else if (! empty($meta_addon_picture_text)) { + } else if (!empty($meta_addon_picture_text)) { $ImgText = ''; } } else { $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); - $bannerImg = '' . $information->ic_title . ''; - if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) { + $bannerImg = '' . $information->ic_title . ''; + if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { $ImgText = ''; - } else if (! empty($meta_addon_picture_text)) { + } else if (!empty($meta_addon_picture_text)) { $ImgText = ''; } } @@ -4752,20 +4785,20 @@ class Information extends CI_Controller { if ($information->ic_url == "/" || $information->ic_url == "/test" || $information->ic_url == "/china-trains") { //火车票首页 $template_TrainSearch = $this->load->view($template_path . '-train-index', null, true); - $ImgText = ""; + $ImgText = ""; //火车票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { $meta_addon_picture = ""; - $data["TOPBANNER"] = ''; + $data["TOPBANNER"] = ''; } } else if ($information->ic_url == "/china-flights") { //机票首页 $template_TrainSearch = $this->load->view($template_path . '-flight-index', null, true); - $ImgText = ""; + $ImgText = ""; //飞机票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { $meta_addon_picture = ""; - $data["TOPBANNER"] = ''; + $data["TOPBANNER"] = ''; } } @@ -4775,10 +4808,10 @@ class Information extends CI_Controller { /**替换左右结构的线路表单标签 2024-7-4*/ if (strpos($ic_content, '') !== false) { //准备数据 - $DayTripData["productCode"] = $productCode; + $DayTripData["productCode"] = $productCode; $DayTripData["picture_mobile"] = get_meta($information->ic_id, 'meta_addon_picture_mobile'); - $DayTripData["picture_pc"] = get_meta($information->ic_id, 'meta_addon_picture'); - $DayTripData["TITLE"] = $information->ic_title; + $DayTripData["picture_pc"] = get_meta($information->ic_id, 'meta_addon_picture'); + $DayTripData["TITLE"] = $information->ic_title; //成人,儿童,婴儿的年龄显示信息 $AdultMsg = $this->infoBokunData_model->getBokunMetaList($information->ic_id, "AdultMsg"); if ($AdultMsg) { @@ -4817,24 +4850,24 @@ class Information extends CI_Controller { $DayTripData["Other_Msg"] = null; } - $InfoData = new stdClass(); //传递用来计算的信息平台数据 - $MinTravelers = get_meta($information->ic_id, 'meta_trippest_limitperson'); + $InfoData = new stdClass(); //传递用来计算的信息平台数据 + $MinTravelers = get_meta($information->ic_id, 'meta_trippest_limitperson'); $InfoData->MinTravelers = $MinTravelers == null ? 0 : $MinTravelers; //选项一 - $TsOption1 = get_meta($information->ic_id, 'meta_trainspread_option1'); + $TsOption1 = get_meta($information->ic_id, 'meta_trainspread_option1'); $InfoData->Option1 = new stdClass(); if ($TsOption1 != false) { $arrOption = explode(",", $TsOption1); - $arrItem = []; - $num = count($arrOption); + $arrItem = []; + $num = count($arrOption); for ($i = 0; $i < $num; $i++) { if ($i == 0) { $InfoData->Option1->OptionName = $arrOption[$i]; } else { - $arrItemClass = new stdClass(); - $arrItemClass->id = $i - 1; + $arrItemClass = new stdClass(); + $arrItemClass->id = $i - 1; $arrItemClass->value = $arrOption[$i]; - $arrItem[$i - 1] = $arrItemClass; + $arrItem[$i - 1] = $arrItemClass; } } $InfoData->Option1->ItemList = $arrItem; @@ -4843,24 +4876,24 @@ class Information extends CI_Controller { } //Package - $TsPackage = get_meta($information->ic_id, 'meta_trippest_package'); + $TsPackage = get_meta($information->ic_id, 'meta_trippest_package'); $InfoData->Package = new stdClass(); if ($TsPackage != false) { $arrOption = explode("|", $TsPackage); - $arrItem = []; - $num = count($arrOption); + $arrItem = []; + $num = count($arrOption); for ($i = 0; $i < $num; $i++) { if ($i == 0) { $InfoData->Package->PackageName = $arrOption[$i]; } else { $arr_Item = explode(",", $arrOption[$i]); for ($j = 0; $j < count($arr_Item); $j++) { - $arrItemClass = new stdClass(); - $arrItemClass->id = $i; - $arrItemClass->ItemName = $arr_Item[0]; + $arrItemClass = new stdClass(); + $arrItemClass->id = $i; + $arrItemClass->ItemName = $arr_Item[0]; $arrItemClass->ItemAdult = $arr_Item[1]; $arrItemClass->ItemChild = $arr_Item[2]; - $arrItem[$i - 1] = $arrItemClass; + $arrItem[$i - 1] = $arrItemClass; } } } @@ -4870,20 +4903,20 @@ class Information extends CI_Controller { } //选项二 - $TsOption2 = get_meta($information->ic_id, 'meta_trainspread_option2'); + $TsOption2 = get_meta($information->ic_id, 'meta_trainspread_option2'); $InfoData->Option2 = new stdClass(); if ($TsOption2 != false) { $arrOption = explode(",", $TsOption2); - $arrItem = []; - $num = count($arrOption); + $arrItem = []; + $num = count($arrOption); for ($i = 0; $i < $num; $i++) { if ($i == 0) { $InfoData->Option2->OptionName = $arrOption[$i]; } else { - $arrItemClass = new stdClass(); - $arrItemClass->id = $i - 1; + $arrItemClass = new stdClass(); + $arrItemClass->id = $i - 1; $arrItemClass->value = $arrOption[$i]; - $arrItem[$i - 1] = $arrItemClass; + $arrItem[$i - 1] = $arrItemClass; } } $InfoData->Option2->ItemList = $arrItem; @@ -4898,18 +4931,18 @@ class Information extends CI_Controller { } else { $InfoData->t_Type = "general"; } - $t_excludedate = get_meta($information->ic_id, "meta_trippest_excludedate"); - $t_includedate = get_meta($information->ic_id, "meta_trippest_includedate"); - $t_excludemonth = get_meta($information->ic_id, "meta_trippest_excludemonth"); - $InfoData->t_excludedate = $t_excludedate; - $InfoData->t_includedate = $t_includedate; + $t_excludedate = get_meta($information->ic_id, "meta_trippest_excludedate"); + $t_includedate = get_meta($information->ic_id, "meta_trippest_includedate"); + $t_excludemonth = get_meta($information->ic_id, "meta_trippest_excludemonth"); + $InfoData->t_excludedate = $t_excludedate; + $InfoData->t_includedate = $t_includedate; $InfoData->t_excludemonth = $t_excludemonth; $InfoData->t_hoteladdress = get_meta($information->ic_id, "meta_trippest_hoteladdress"); - $InfoData->t_defaultDate = get_meta($information->ic_id, "meta_trippest_defaultDate"); + $InfoData->t_defaultDate = get_meta($information->ic_id, "meta_trippest_defaultDate"); //延迟天数 $t_meta_trippest_delayday = get_meta($information->ic_id, "meta_trippest_delayday"); - $InfoData->t_meta_trippest_delayday = $t_meta_trippest_delayday == null ? 0 : $t_meta_trippest_delayday; + $InfoData->t_meta_trippest_delayday = $t_meta_trippest_delayday == null ? 0 : $t_meta_trippest_delayday; $t_Cancellation = get_meta($information->ic_id, "meta_trainspread_Cancellation"); //取消条款类型 if ($t_Cancellation) { @@ -4927,34 +4960,34 @@ class Information extends CI_Controller { $DayTripData["InfoData"] = $InfoData; //传递信息平台数据 $linktour = get_meta($information->ic_id, 'meta_trainspread_linktour'); //关联线路 - if (! empty($linktour)) { + if (!empty($linktour)) { $paramCode = $productCode . "," . $linktour; } else { $paramCode = $productCode; } //产品汉特信息,测试地址:http://202.103.68.104:61/info.php/thirdparty/ctmobilefirst/apits/getDaytripDetail/?param=TS-HKALC-1,TS-HKALC-2,TS-HKALC-3 - $TourData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apits/getDaytripDetail/?param=" . $paramCode)); + $TourData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apits/getDaytripDetail/?param=" . $paramCode)); $DayTripData["TourData"] = $TourData; $TourPrice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apits/getDaytripsPrice/?param=" . $productCode)); if ($TourPrice->status == "ok") { $DayTripData["DaytripPrice"] = $TourPrice->price; } else { - $TourPrice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apits/getDaytripsPrice/?param=" . $productCode . ",3")); + $TourPrice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apits/getDaytripsPrice/?param=" . $productCode . ",3")); $DayTripData["DaytripPrice"] = $TourPrice->price; } //替换模板 - $TS_DayTripContent = $ic_content; //因为需要替换,所以要转给零时变量。不然手机端替换完了,PC端就没有了。 + $TS_DayTripContent = $ic_content; //因为需要替换,所以要转给零时变量。不然手机端替换完了,PC端就没有了。 $template_form_daydetail = $this->load->view($template_path . '-daydetail-form', $DayTripData, true); //模板内容 - $TS_DayTripContent = str_replace('', $template_form_daydetail, $TS_DayTripContent); - $data["CUSTOMCONENT"] = $TS_DayTripContent; + $TS_DayTripContent = str_replace('', $template_form_daydetail, $TS_DayTripContent); + $data["CUSTOMCONENT"] = $TS_DayTripContent; } } else { //一日游产品有自己的图片展示效果 - if (! empty($meta_addon_picture)) { - if (! empty($meta_addon_picture_url)) { + if (!empty($meta_addon_picture)) { + if (!empty($meta_addon_picture_url)) { $data["TOPBANNER"] = ''; } else { $data["TOPBANNER"] = ''; @@ -4964,27 +4997,27 @@ class Information extends CI_Controller { //两种设备分别调用两种模板 ,静态化 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: + 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: } //生成静态文件 @@ -5003,25 +5036,26 @@ class Information extends CI_Controller { /** * 桂林站 www.guilinchina.net */ - public function make_www_cache_gl($information) { + public function make_www_cache_gl($information) + { $data = []; - #region 公用数据 - //$apiurl = "http://202.103.68.104:88/info.php"; //本地测试 + #region 公用数据 + //$apiurl = "http://202.103.68.104:88/info.php"; //本地测试 $apiurl = "https://ct.mycht.cn/info.php"; //网前 //先准备数据,采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。 - $data["TITLE"] = $information->ic_seo_title; + $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; - $meta_ct_page_type = ""; - $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 - $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 - $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 + $data["KEYWORDS"] = $information->ic_seo_keywords; + $data["CANONICAL"] = $this->config->item('site_url') . $information->ic_url; + $meta_ct_page_type = ""; + $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 + $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 + $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 //面包屑 - $crumb = ""; + $crumb = ""; $crumb_data = $this->Information_model->get_path_exclude_ct($information->is_id, $information->is_path); if (count($crumb_data) > 0) { //至少有一个父类面包屑才显示 $crumb = "
Home"; @@ -5034,25 +5068,25 @@ class Information extends CI_Controller { //作者字符串,信息页或者城市天气页加载 2022-7-26 $str_author = ""; - $author = $this->Operator_model->get_author_nikename($information->ic_author); - if ((empty($meta_product_code) && ! ($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { - $OPI_FirstName = ! empty($author) ? $author->OPI_FirstName : 'author nickname'; - $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; + $author = $this->Operator_model->get_author_nikename($information->ic_author); + if ((empty($meta_product_code) && !($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { + $OPI_FirstName = !empty($author) ? $author->OPI_FirstName : 'author nickname'; + $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; } - //火车票详细页搜索框添加 -- zp - $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 + //火车票详细页搜索框添加 -- zp + $meta_ct_page_trainform = get_meta($information->ic_id, 'meta_ct_page_trainform'); //是否插入火车票搜索框 $template_TrainDetailSearch = ""; if ($meta_ct_page_trainform == "yes" || strpos($information->ic_url, "/china-trains") !== false) { - $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai - $data_TrainCity = []; + $meta_train_city = get_meta($information->ic_id, 'meta_train_city'); //默认的出发及目的地城市 , beijing|shanghai + $data_TrainCity = []; $data_TrainCity["from"] = ""; - $data_TrainCity["to"] = ""; - if (! empty($meta_train_city)) { + $data_TrainCity["to"] = ""; + if (!empty($meta_train_city)) { if (strpos($meta_train_city, '|') !== false) { - $arrTrainCity = explode('|', $meta_train_city); + $arrTrainCity = explode('|', $meta_train_city); $data_TrainCity["from"] = $arrTrainCity[0]; - $data_TrainCity["to"] = $arrTrainCity[1]; + $data_TrainCity["to"] = $arrTrainCity[1]; } } @@ -5070,13 +5104,13 @@ class Information extends CI_Controller { // 解析结果:; Shanghai,Beijing $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); + $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/chinatravel-feedback-list', ['feedback_list' => $top3_feedback_list], true @@ -5094,13 +5128,13 @@ class Information extends CI_Controller { // 解析结果:; Shanghai,Beijing $feedback_array = []; preg_match_all('^^', $information->ic_content, $feedback_array); - if (! empty($feedback_array)) { + if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; - $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); + $feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string, 30); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); - $feedback_content = $this->load->view( + $feedback_content = $this->load->view( 'mobile_first/chinatravel-feedback-cross', ['feedback_list' => $top3_feedback_list], true @@ -5119,11 +5153,11 @@ class Information extends CI_Controller { $ic_content = $this->html_optimize_lib->set_image_size($ic_content); //非产品页面 - $data["PRODUCTJS"] = ""; - $data["ISPRODUCT"] = "no"; //判断是否是产品页 + $data["PRODUCTJS"] = ""; + $data["ISPRODUCT"] = "no"; //判断是否是产品页 $data["addthis_widget"] = ""; - $data["FloatIcon"] = ""; //浮动图标替代addthis - $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; + $data["FloatIcon"] = ""; //浮动图标替代addthis + $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; if (empty(get_meta($information->ic_id, 'meta_product_code')) || in_array($information->ic_url, $arrExitUrl)) { $data["FloatIcon"] = ""; @@ -5132,33 +5166,33 @@ class Information extends CI_Controller { } //顶部视频 - $data["TOPVIDEO"] = ""; - $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); + $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)) { + if (!empty($meta_news_video) && !empty($meta_video_picture)) { $data["TOPVIDEO"] = ''; } //主样式表,内联模式 //$apiweb="http://202.103.68.104:88"; //本地测试 - $apiweb = "https://data.guilinchina.net"; - $cssUrl = $apiweb . "/css/css3/base.css?v=" . time(); + $apiweb = "https://data.guilinchina.net"; + $cssUrl = $apiweb . "/css/css3/base.css?v=" . time(); $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)) { + $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"] = ''; + $data["ADDONCSS"] = ''; } //社媒分享图片 $data["OGIMAGE"] = ""; - if (! empty($information->ic_photo)) { + if (!empty($information->ic_photo)) { if (strpos($information->ic_photo, "guilinchina.net") != false) { $full_ic_photo = $information->ic_photo; } else { @@ -5169,14 +5203,14 @@ class Information extends CI_Controller { //结构化标签 $data["ConstructionCode"] = ""; - $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); - if (! empty($meta_construction_code)) { + $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); + if (!empty($meta_construction_code)) { $data["ConstructionCode"] = $meta_construction_code; } //总JS:为了方便以后js好维护,必须的把一些公用的JS统计到一个文件。但是又不是所有页面都需要调用这个基础js,所以必须在这里进行判断 - $addBaseJs = false; - $addonJs = ""; + $addBaseJs = false; + $addonJs = ""; $meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格 if ($meta_ct_page_price == "yes") { @@ -5192,8 +5226,8 @@ class Information extends CI_Controller { //额外js $data["ADDONJS"] = ""; - $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (! empty($meta_addon_js)) { + $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); + if (!empty($meta_addon_js)) { $addonJs .= ''; } //价格js @@ -5218,7 +5252,7 @@ class Information extends CI_Controller { //页面传递参数 $passParam = ""; if (in_array($meta_ct_page_type, ["daytripindex", "tourindex", "attractionindex", "weatherpage"])) { //一日游和线路列表 - //产品首页 + //产品首页 $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); if (in_array($meta_ct_page_type, ["attractionindex"])) { @@ -5238,11 +5272,11 @@ class Information extends CI_Controller { $productCode = ""; if ($meta_ct_page_type == "daytripdetail") { //一日游 - if (! empty($meta_ct_page_type)) { + if (!empty($meta_ct_page_type)) { $productType = $meta_ct_page_type; } $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } $addonJs .= ''; @@ -5251,56 +5285,56 @@ class Information extends CI_Controller { //一日游表单的替换 $DayTripData["productCode"] = $productCode; - $template_form_daydetail = $this->load->view($template_path . '-daydetail-form', $DayTripData, true); //模板内容 - //使用simple_html_dom_lib库来进行表单添加 + $template_form_daydetail = $this->load->view($template_path . '-daydetail-form', $DayTripData, true); //模板内容 + //使用simple_html_dom_lib库来进行表单添加 $ic_content = $this->html_optimize_lib->add_htmlcode($ic_content, "#maincontent", $template_form_daydetail); } if ($meta_ct_page_type == "tourdetail") { //线路 - $productType = $meta_ct_page_type; + $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } //获取cli_sn - $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getCliSn/?param=" . $productCode . "&webcode=guilin")); + $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getCliSn/?param=" . $productCode . "&webcode=guilin")); $data["clisn"] = $tourdata->clisn; //获取price - $tourprice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourPrice/?param=" . $productCode . "&webcode=guilin")); + $tourprice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourPrice/?param=" . $productCode . "&webcode=guilin")); $dataform["tourprice"] = $tourprice->price; //调取模板 $dataform["TourCode"] = $productCode; - $dataform["CLI_SN"] = $tourdata->clisn; + $dataform["CLI_SN"] = $tourdata->clisn; $dataform["TourName"] = $information->ic_title; } if ($meta_ct_page_type == "tourlist") { //线路类型列表 - $lineTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getLineTypeList/?webcode=guilin")); + $lineTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getLineTypeList/?webcode=guilin")); $dataTourList["lineTypeList"] = $lineTypeList; - $tourListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourList/?webcode=guilin")); + $tourListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourList/?webcode=guilin")); $dataTourList["tourListData"] = $tourListData; - //替换模板 + //替换模板 $template_page_tourlist = $this->load->view('mobile_first/shanghai-tour-list', $dataTourList, true); //模板内容,统一用上海站模板 - $ic_content = str_replace('', $template_page_tourlist, $ic_content); + $ic_content = str_replace('', $template_page_tourlist, $ic_content); $addonJs .= ''; } if ($meta_ct_page_type == "daytriplist") { //一日游类型 - $allTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getPagTypeList/?webcode=guilin")); - $dataDayTripList["allTypeList"] = $allTypeList; - $dayTripListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getSearchDaytripList/?webcode=guilin")); + $allTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getPagTypeList/?webcode=guilin")); + $dataDayTripList["allTypeList"] = $allTypeList; + $dayTripListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getSearchDaytripList/?webcode=guilin")); $dataDayTripList["dayTripListData"] = $dayTripListData; - //替换模板 + //替换模板 $template_page_daytriplist = $this->load->view('mobile_first/shanghai-daytrip-list', $dataDayTripList, true); //模板内容,统一用上海站模板 - $ic_content = str_replace('', $template_page_daytriplist, $ic_content); + $ic_content = str_replace('', $template_page_daytriplist, $ic_content); $addonJs .= ''; } @@ -5322,7 +5356,7 @@ class Information extends CI_Controller { $data["productCode"] = $productCode; //页面添加的元素 - $data["ADDONJS"] = $addonJs; + $data["ADDONJS"] = $addonJs; $data["passParam"] = $passParam; //页面详细内容放最后,这样上面都可以进行内容的替换,比如一日游表单 @@ -5334,24 +5368,24 @@ class Information extends CI_Controller { $arrDevice = ["mobile", "pc"]; foreach ($arrDevice as $device) { //顶部全屏大图 - $data["TOPBANNER"] = ""; - $ImgText = ""; //图文字 - $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url'); + $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 = '' . $information->ic_title . ''; - if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) { + $bannerImg = '' . $information->ic_title . ''; + if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { $ImgText = ''; - } else if (! empty($meta_addon_picture_text)) { + } else if (!empty($meta_addon_picture_text)) { $ImgText = ''; } } else { $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); - $bannerImg = '' . $information->ic_title . ''; - if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) { + $bannerImg = '' . $information->ic_title . ''; + if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) { $ImgText = ''; - } else if (! empty($meta_addon_picture_text)) { + } else if (!empty($meta_addon_picture_text)) { $ImgText = ''; } } @@ -5361,25 +5395,25 @@ class Information extends CI_Controller { if ($information->ic_url == "/china-trains/hometest" || $information->ic_url == "/trains") { //火车票首页 $template_TrainSearch = $this->load->view($template_path . '-train-index', null, true); - $ImgText = ""; + $ImgText = ""; //火车票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { $meta_addon_picture = ""; - $data["TOPBANNER"] = ''; + $data["TOPBANNER"] = ''; } } else if ($information->ic_url == "/china-flights") { //机票首页 $template_TrainSearch = $this->load->view($template_path . '-flight-index', null, true); - $ImgText = ""; + $ImgText = ""; //飞机票移动端去掉头部图片,保证搜索框CLS if ($device == 'mobile') { $meta_addon_picture = ""; - $data["TOPBANNER"] = ''; + $data["TOPBANNER"] = ''; } } - if (! empty($meta_addon_picture)) { - if (! empty($meta_addon_picture_url)) { + if (!empty($meta_addon_picture)) { + if (!empty($meta_addon_picture_url)) { $data["TOPBANNER"] = ''; } else { $data["TOPBANNER"] = ''; @@ -5387,7 +5421,7 @@ class Information extends CI_Controller { } if ($meta_ct_page_type == "tourdetail") { //线路表单,左右结构,用标签来做 - $dataform['device'] = $device; + $dataform['device'] = $device; $template_form_tourqi = $this->load->view($template_path . '-form-tourqi-new', $dataform, true); $ic_content_pc = $ic_content; //需要一个变量来过渡,不然$ic_content改变以后,PC端就没有标签了 $ic_content_pc = str_replace('', $template_form_tourqi, $ic_content_pc); @@ -5396,27 +5430,27 @@ class Information extends CI_Controller { //两种设备分别调用两种模板 ,静态化 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: + 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: } //生成静态文件 @@ -5435,22 +5469,23 @@ class Information extends CI_Controller { /** * 花梨鹰网站 www.hualiyingtravel.com的静态化 */ - public function make_www_cache_hly($information) { + public function make_www_cache_hly($information) + { $data = []; - #region 公用数据 - //$apiurl = "http://202.103.68.104:61/info.php"; //本地测试 + #region 公用数据 + //$apiurl = "http://202.103.68.104:61/info.php"; //本地测试 $apiurl = "https://ct.mycht.cn/info.php"; //网前 //先准备数据,采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。 - $data["TITLE"] = $information->ic_seo_title; + $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; - $meta_ct_page_type = ""; - $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 - $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 - $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 + $data["KEYWORDS"] = $information->ic_seo_keywords; + $data["CANONICAL"] = $this->config->item('site_url') . $information->ic_url; + $meta_ct_page_type = ""; + $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型 + $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); //绑定的产品编号 + $template_path = 'mobile_first/' . $this->config->item('site_code'); //模板位置 //面包屑 $crumb = ""; @@ -5466,10 +5501,10 @@ class Information extends CI_Controller { //作者字符串,信息页或者城市天气页加载 2022-7-26 $str_author = ""; - $author = $this->Operator_model->get_author_nikename($information->ic_author); - if ((empty($meta_product_code) && ! ($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { - $OPI_FirstName = ! empty($author) ? $author->OPI_FirstName : 'author nickname'; - $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; + $author = $this->Operator_model->get_author_nikename($information->ic_author); + if ((empty($meta_product_code) && !($meta_ct_page_type !== false && $meta_ct_page_type != "")) || $meta_ct_page_type == "weatherpage") { + $OPI_FirstName = !empty($author) ? $author->OPI_FirstName : 'author nickname'; + $str_author = '
Written by ' . $OPI_FirstName . ' Updated ' . date("M. j, Y", strtotime($information->ic_datetime)) . '
'; } /* 详细内容 */ @@ -5484,11 +5519,11 @@ class Information extends CI_Controller { $ic_content = $this->html_optimize_lib->set_image_size($ic_content); //非产品页面 - $data["PRODUCTJS"] = ""; - $data["ISPRODUCT"] = "no"; //判断是否是产品页 + $data["PRODUCTJS"] = ""; + $data["ISPRODUCT"] = "no"; //判断是否是产品页 $data["addthis_widget"] = ""; - $data["FloatIcon"] = ""; //浮动图标替代addthis - $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; + $data["FloatIcon"] = ""; //浮动图标替代addthis + $arrExitUrl = ["/", "/culture", "/guide", "/tour", "/citytour", "/daytrip", "/asia-tour", "/china-trains"]; if (empty(get_meta($information->ic_id, 'meta_product_code')) || in_array($information->ic_url, $arrExitUrl)) { $data["FloatIcon"] = ""; @@ -5497,33 +5532,33 @@ class Information extends CI_Controller { } //顶部视频 - $data["TOPVIDEO"] = ""; - $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); + $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)) { + if (!empty($meta_news_video) && !empty($meta_video_picture)) { $data["TOPVIDEO"] = ''; } //主样式表,内联模式 //$apiweb="http://202.103.68.104:97"; //本地测试 - $apiweb = "https://data.hualiyingtravel.com"; - $cssUrl = $apiweb . "/css/css3/base.css?v=" . time(); + $apiweb = "https://data.hualiyingtravel.com"; + $cssUrl = $apiweb . "/css/css3/base.css?v=" . time(); $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)) { + $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"] = ''; + $data["ADDONCSS"] = ''; } //社媒分享图片 $data["OGIMAGE"] = ""; - if (! empty($information->ic_photo)) { + if (!empty($information->ic_photo)) { if (strpos($information->ic_photo, "guilinchina.net") != false) { $full_ic_photo = $information->ic_photo; } else { @@ -5534,21 +5569,21 @@ class Information extends CI_Controller { //结构化标签 $data["ConstructionCode"] = ""; - $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); - if (! empty($meta_construction_code)) { + $meta_construction_code = get_meta($information->ic_id, 'meta_construction_code'); + if (!empty($meta_construction_code)) { $data["ConstructionCode"] = $meta_construction_code; } $data["meta_index_set"] = ""; - $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); - if (! empty($meta_index_set)) { + $meta_index_set = get_meta($information->ic_id, 'meta_index_set'); + if (!empty($meta_index_set)) { $data["meta_index_set"] = ''; } //总JS:为了方便以后js好维护,必须的把一些公用的JS统计到一个文件。但是又不是所有页面都需要调用这个基础js,所以必须在这里进行判断 - $addBaseJs = false; - $addonJs = ""; - $meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格 + $addBaseJs = false; + $addonJs = ""; + $meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格 $meta_ct_page_Carousel = get_meta($information->ic_id, 'meta_ct_page_Carousel'); //是否有顶部轮播图 if ($meta_ct_page_price == "yes") { @@ -5566,8 +5601,8 @@ class Information extends CI_Controller { //额外js $data["ADDONJS"] = ""; - $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); - if (! empty($meta_addon_js)) { + $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js'); + if (!empty($meta_addon_js)) { $addonJs .= ''; } //价格js @@ -5590,7 +5625,7 @@ class Information extends CI_Controller { //页面传递参数 $passParam = ""; if (in_array($meta_ct_page_type, ["daytripindex", "tourindex", "attractionindex", "weatherpage"])) { //一日游和线路列表 - //产品首页 + //产品首页 $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); if (in_array($meta_ct_page_type, ["attractionindex"])) { @@ -5610,23 +5645,23 @@ class Information extends CI_Controller { $productCode = ""; if ($meta_ct_page_type == "daytripdetail") { //一日游 - if (! empty($meta_ct_page_type)) { + if (!empty($meta_ct_page_type)) { $productType = $meta_ct_page_type; } $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } //一日游表单的替换 - $DayTripData["productCode"] = $productCode; + $DayTripData["productCode"] = $productCode; $DayTripData["picture_mobile"] = get_meta($information->ic_id, 'meta_addon_picture_mobile'); - $DayTripData["picture_pc"] = get_meta($information->ic_id, 'meta_addon_picture'); - $DayTripData["TITLE"] = $information->ic_title; + $DayTripData["picture_pc"] = get_meta($information->ic_id, 'meta_addon_picture'); + $DayTripData["TITLE"] = $information->ic_title; - $arrCAD = ['HLYCAD-S', 'HLYCAD-V', 'HLYCAD-P']; //水灯节 + $arrCAD = ['HLYCAD-S', 'HLYCAD-V', 'HLYCAD-P']; //水灯节 $arrCAD_EN = ['QM-NUT-V', 'QM-NUT-P']; //水灯节英文 - //$arrTest = ['QM-9-A','QM-9-B','QM-9-C']; + //$arrTest = ['QM-9-A','QM-9-B','QM-9-C']; if (in_array($productCode, $arrCAD) || in_array($productCode, $arrCAD_EN)) { //水灯节,中英文分别调用不同模板 /**替换左右结构的线路表单标签 2024-7-4*/ @@ -5634,25 +5669,25 @@ class Information extends CI_Controller { //准备数据 $InfoData = new stdClass(); //传递用来计算的信息平台数据 - //附加选项 - $t_excludedate = get_meta($information->ic_id, "meta_trippest_excludedate"); - $t_includedate = get_meta($information->ic_id, "meta_trippest_includedate"); - $t_excludemonth = get_meta($information->ic_id, "meta_trippest_excludemonth"); - $InfoData->t_excludedate = $t_excludedate; - $InfoData->t_includedate = $t_includedate; + //附加选项 + $t_excludedate = get_meta($information->ic_id, "meta_trippest_excludedate"); + $t_includedate = get_meta($information->ic_id, "meta_trippest_includedate"); + $t_excludemonth = get_meta($information->ic_id, "meta_trippest_excludemonth"); + $InfoData->t_excludedate = $t_excludedate; + $InfoData->t_includedate = $t_includedate; $InfoData->t_excludemonth = $t_excludemonth; $DayTripData["InfoData"] = $InfoData; //传递信息平台数据 $linktour = get_meta($information->ic_id, 'meta_trainspread_linktour'); //关联线路 - if (! empty($linktour)) { + if (!empty($linktour)) { $paramCode = $productCode . "," . $linktour; } else { $paramCode = $productCode; } //产品汉特信息,测试地址:http://202.103.68.104:61/info.php/thirdparty/ctmobilefirst/api/getDaytripDetail/?webcode=hly¶m=QM-9-A,QM-9-B,QM-9-C - $TourData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getDaytripDetail/?webcode=hly¶m=" . $paramCode)); + $TourData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getDaytripDetail/?webcode=hly¶m=" . $paramCode)); $DayTripData["TourData"] = $TourData; //替换模板 @@ -5669,29 +5704,29 @@ class Information extends CI_Controller { $data["ADDONCSS"] .= ''; $template_form_daydetail = $this->load->view($template_path . '-daydetail-form', $DayTripData, true); //模板内容 - //使用simple_html_dom_lib库来进行表单添加 + //使用simple_html_dom_lib库来进行表单添加 $ic_content = $this->html_optimize_lib->add_htmlcode($ic_content, "#maincontent", $template_form_daydetail); } } if ($meta_ct_page_type == "tourdetail") { //线路 - $productType = $meta_ct_page_type; + $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); - if (! empty($meta_ct_page_value)) { + if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } //获取cli_sn - $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getCliSn/?param=" . $productCode . "&webcode=hly")); + $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getCliSn/?param=" . $productCode . "&webcode=hly")); $data["clisn"] = $tourdata->clisn; //获取price - $tourprice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourPrice/?param=" . $productCode . "&webcode=hly")); + $tourprice = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourPrice/?param=" . $productCode . "&webcode=hly")); $dataform["tourprice"] = $tourprice->price; //调取模板 $dataform["TourCode"] = $productCode; - $dataform["CLI_SN"] = $tourdata->clisn; + $dataform["CLI_SN"] = $tourdata->clisn; $dataform["TourName"] = $information->ic_title; $addonJs .= ''; @@ -5716,7 +5751,7 @@ class Information extends CI_Controller { $data["productCode"] = $productCode; //页面添加的元素 - $data["ADDONJS"] = $addonJs; + $data["ADDONJS"] = $addonJs; $data["passParam"] = $passParam; //页面详细内容放最后,这样上面都可以进行内容的替换,比如一日游表单 @@ -5728,20 +5763,20 @@ class Information extends CI_Controller { $arrDevice = ["mobile", "pc"]; foreach ($arrDevice as $device) { //顶部全屏大图 - $data["TOPBANNER"] = ""; - $ImgText = ""; //图文字 - $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url'); + $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 = '' . $information->ic_title . ''; + $bannerImg = '' . $information->ic_title . ''; } else { $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); - $bannerImg = '' . $information->ic_title . ''; + $bannerImg = '' . $information->ic_title . ''; } - if (! empty($meta_addon_picture)) { - if (! empty($meta_addon_picture_url)) { + if (!empty($meta_addon_picture)) { + if (!empty($meta_addon_picture_url)) { $data["TOPBANNER"] = ''; } else { $data["TOPBANNER"] = ''; @@ -5753,15 +5788,15 @@ class Information extends CI_Controller { if (strpos($ic_content, '') !== false) { - $InfoData = new stdClass(); //传递用来计算的信息平台数据 - $t_excludedate = get_meta($information->ic_id, "meta_trippest_excludedate"); - $t_includedate = get_meta($information->ic_id, "meta_trippest_includedate"); - $t_excludemonth = get_meta($information->ic_id, "meta_trippest_excludemonth"); - $InfoData->t_excludedate = $t_excludedate; - $InfoData->t_includedate = $t_includedate; + $InfoData = new stdClass(); //传递用来计算的信息平台数据 + $t_excludedate = get_meta($information->ic_id, "meta_trippest_excludedate"); + $t_includedate = get_meta($information->ic_id, "meta_trippest_includedate"); + $t_excludemonth = get_meta($information->ic_id, "meta_trippest_excludemonth"); + $InfoData->t_excludedate = $t_excludedate; + $InfoData->t_includedate = $t_includedate; $InfoData->t_excludemonth = $t_excludemonth; - $InfoData->t_defaultDate = get_meta($information->ic_id, "meta_trippest_defaultDate"); - $dataform["InfoData"] = $InfoData; //传递信息平台数据 + $InfoData->t_defaultDate = get_meta($information->ic_id, "meta_trippest_defaultDate"); + $dataform["InfoData"] = $InfoData; //传递信息平台数据 $template_form_tourqi = $this->load->view($template_path . '-form-tourqi', $dataform, true); $ic_content_pc = $ic_content; //需要一个变量来过渡,不然$ic_content改变以后,PC端就没有标签了 @@ -5774,27 +5809,27 @@ class Information extends CI_Controller { //两种设备分别调用两种模板 ,静态化 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: + 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: } //生成静态文件 @@ -5811,10 +5846,11 @@ class Information extends CI_Controller { } //通过内容找到第一张图片 - public function set_photo_content($ic_photo, $ic_content) { + public function set_photo_content($ic_photo, $ic_content) + { if (empty($ic_photo)) { $images = get_image_url_by_source($ic_content); - if (! empty($images) and ! empty($images[1])) { + if (!empty($images) and !empty($images[1])) { return $images[1][0]; } } else { @@ -5824,53 +5860,54 @@ class Information extends CI_Controller { } //根据推荐规则进行查询 - public function recommand_information_rule($information, $root_information, $recommand, &$exclude_ids) { + public function recommand_information_rule($information, $root_information, $recommand, &$exclude_ids) + { $data = []; switch ($recommand->ir_rule) { - case 'rule_same_node_keyword': //同节点关键词 - $keywords = explode(',', $recommand->ir_keyword); - $data = $this->Information_model->search_by_words_2($root_information->is_path, $keywords, $exclude_ids); - break; - case 'rule_same_url_keyword': //同URL关键词 - $keywords = explode(',', $recommand->ir_keyword); - $url = trim($information->ic_url); - $url = substr($url, 0, strpos($url, '/', 1) + 1); - $data = $this->Information_model->search_by_words($url, $keywords, $exclude_ids); - break; - case 'rule_same_node_random': //同节点随机 - $data = $this->Information_model->random(1, $root_information->is_path, $exclude_ids); - break; - case 'rule_this_node_random': //指定节点下随机 - $ir_pointer = $this->Information_model->Detail($recommand->ir_pointer_is_id, 'is_path'); - if (! empty($ir_pointer)) { - $data = $this->Information_model->random(1, $ir_pointer->is_path, $exclude_ids); - } - break; - case 'rule_range_random': //范围内随机,同读取备用节点 - break; - case 'rule_show_tips': //显示广告 - $data = $this->recommends_and_tips_model->tips_detail($recommand->ir_pointer_it_id); - return [$recommand->ir_name => $data]; - //break; - case 'rule_no_show': //不显示 - return [$recommand->ir_name => false]; - //break; - default: //'rule_parent'://继承上级规则则留空,程序会循环一遍分组的规则 - return false; + case 'rule_same_node_keyword': //同节点关键词 + $keywords = explode(',', $recommand->ir_keyword); + $data = $this->Information_model->search_by_words_2($root_information->is_path, $keywords, $exclude_ids); + break; + case 'rule_same_url_keyword': //同URL关键词 + $keywords = explode(',', $recommand->ir_keyword); + $url = trim($information->ic_url); + $url = substr($url, 0, strpos($url, '/', 1) + 1); + $data = $this->Information_model->search_by_words($url, $keywords, $exclude_ids); + break; + case 'rule_same_node_random': //同节点随机 + $data = $this->Information_model->random(1, $root_information->is_path, $exclude_ids); + break; + case 'rule_this_node_random': //指定节点下随机 + $ir_pointer = $this->Information_model->Detail($recommand->ir_pointer_is_id, 'is_path'); + if (!empty($ir_pointer)) { + $data = $this->Information_model->random(1, $ir_pointer->is_path, $exclude_ids); + } + break; + case 'rule_range_random': //范围内随机,同读取备用节点 + break; + case 'rule_show_tips': //显示广告 + $data = $this->recommends_and_tips_model->tips_detail($recommand->ir_pointer_it_id); + return [$recommand->ir_name => $data]; + //break; + case 'rule_no_show': //不显示 + return [$recommand->ir_name => false]; + //break; + default: //'rule_parent'://继承上级规则则留空,程序会循环一遍分组的规则 + return false; } - //读取备用节点 - if (empty($data) && ! empty($recommand->ir_urls)) { //查不到信息并且备选urls不为空,则随机选一条 - // $url_array = explode("\n", $recommand->ir_urls); - // $data = $this->Information_model->Detail(trim($url_array[rand(0, count($url_array) - 1)])); + //读取备用节点 + if (empty($data) && !empty($recommand->ir_urls)) { //查不到信息并且备选urls不为空,则随机选一条 + // $url_array = explode("\n", $recommand->ir_urls); + // $data = $this->Information_model->Detail(trim($url_array[rand(0, count($url_array) - 1)])); $url_array = explode("\n", $recommand->ir_urls); - $data = $this->Information_model->random_range(1, $url_array, $exclude_ids); + $data = $this->Information_model->random_range(1, $url_array, $exclude_ids); } - if (! empty($data)) { - $exclude_ids[] = $data->is_id; + if (!empty($data)) { + $exclude_ids[] = $data->is_id; $data->desktop_photo = get_meta($data->ic_id, 'meta_addon_picture'); - $data->mobile_photo = get_meta($data->ic_id, 'meta_addon_picture_mobile'); + $data->mobile_photo = get_meta($data->ic_id, 'meta_addon_picture_mobile'); if (empty($data->mobile_photo)) { - if (! empty($data->ic_photo)) { + if (!empty($data->ic_photo)) { $data->mobile_photo = $this->config->item('site_image_url') . $data->ic_photo; } else { $data->mobile_photo = 'https://data.chinahighlights.com/image/travelguide/article/recommended-info-bottom-cover.jpg'; @@ -5881,12 +5918,13 @@ class Information extends CI_Controller { } //获取当前信息所有的推荐信息和广告内容 - public function recommand_information($information) { - $data = []; - $group_detail = $this->Information_model->get_detail_by_path($information->is_path, 0); //信息所属分组,根据分组进行不同推荐 + public function recommand_information($information) + { + $data = []; + $group_detail = $this->Information_model->get_detail_by_path($information->is_path, 0); //信息所属分组,根据分组进行不同推荐 $group_recommands = $this->recommends_and_tips_model->recommends_list($group_detail->is_id); //节点下所有的推荐规则 - $root_detail = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 - $root_recommands = $this->recommends_and_tips_model->recommends_list($root_detail->is_id); //节点下所有的推荐规则 + $root_detail = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 + $root_recommands = $this->recommends_and_tips_model->recommends_list($root_detail->is_id); //节点下所有的推荐规则 $exclude_ids = [$information->is_id]; //需要排除的is_id,防止通过页面显示相同内容,默认排除本身,每个推荐内容都需要排除已经推荐过的 foreach ($root_recommands as $item) { @@ -5894,7 +5932,7 @@ class Information extends CI_Controller { $exclude_ids = [0]; } $result = $this->recommand_information_rule($information, $root_detail, $item, $exclude_ids); - if (! empty($result)) { + if (!empty($result)) { $data += $result; } } @@ -5905,7 +5943,7 @@ class Information extends CI_Controller { } if (empty($data[$item->ir_name])) { $result = $this->recommand_information_rule($information, $root_detail, $item, $exclude_ids); - if (! empty($result)) { + if (!empty($result)) { $data += $result; } } @@ -5915,110 +5953,111 @@ class Information extends CI_Controller { return $data; } - public function call_mobile_template_NEXT($template_path, $is_id) { - $data['detail'] = $this->Information_model->Detail($is_id); + public function call_mobile_template_NEXT($template_path, $is_id) + { + $data['detail'] = $this->Information_model->Detail($is_id); $data['type_detail'] = $this->Information_model->get_detail_by_path($data['detail']->is_path, 0); //信息所属分组,根据分组进行不同推荐 $data['root_detail'] = $this->Information_model->get_detail_by_path($data['detail']->is_path, 1); //信息所属分类,获取信息顶级节点内容 switch (strtolower($data['type_detail']->is_id)) { - case 278008010: //Inspiration - //随机获取两个同级节点内容 - $random_array = $this->Information_model->random(2, $data['root_detail']->is_path, [$data['detail']->is_id]); - if (! empty($random_array[0])) { - $data['info_howtoplan'] = $random_array[0]; - $data['info_howtoplan_root'] = $data['root_detail']; - $data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content); - } - if (! empty($random_array[1])) { - $data['info_besttime'] = $random_array[1]; - $data['info_besttime_root'] = $data['root_detail']; - $data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content); - } - //漏斗作用的页面,随机挑选一篇 - $random_array = [ - '/travelguide/china-facts.htm', - '/travelguide/article-top-china-tourist-destination.htm', - '/travelguide/most-beautiful-places.htm', - '/weather/china-best-times.htm', - '/travelguide/article-10-movies-to-watch.htm', - '/travelguide/article-culture-shock-in-china.htm', - '/travelguide/article-what-chinese-eat-for-breakfast.htm', - '/travelguide/china-top-10-attractions.htm', - '/travelguide/chinese-food/eight-chinese-dishes.htm', - '/travelguide/china-travel-reopen-restrictions.htm', - ]; - $data['info_topthings'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); - if (! empty($data['info_topthings'])) { - $data['info_topthings_root'] = $this->Information_model->get_detail_by_path($data['info_topthings']->is_path, 1); - $data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content); - } - //文化板块的页面,随机挑选一篇 - $random_array = [ - '/travelguide/chinese-zodiac/', - '/travelguide/culture/china-arts-crafts.htm', - '/beijing/forbidden-city/', - '/travelguide/culture/traditionalmedichine.htm', - '/travelguide/chinese-tea/', - '/travelguide/kungfu/', - '/travelguide/culture/china-history.htm', - '/travelguide/chinese-food/', - '/travelguide/chinese-language/', - ]; - $data['info_hotel'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); - if (! empty($data['info_hotel'])) { - $data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1); - $data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content); - } - break; - case 278008012: //'planing-1(guide)': - case 278008013: //'planning-2 (decision tips)': - case 278008011: //'destination': //url的第一段表示地区,根据第一段来搜索相关数据如/beijing/ 而不是根据is_parent_id因为可能信息和线路是在不同的分类下 - $destination_url = trim($data['detail']->ic_url); - $destination_url = substr($destination_url, 0, strpos($destination_url, '/', 1) + 1); - //how to plan - $data['info_howtoplan'] = $this->Information_model->search_by_words($destination_url, ['how', 'plan'], [$data['detail']->is_id]); - if (empty($data['info_howtoplan'])) { //找不到对应信息则显示备用 - $data['info_howtoplan'] = $this->Information_model->Detail('/travelguide/plan-first-trip.htm'); - } - $data['info_howtoplan_root'] = $this->Information_model->get_detail_by_path($data['info_howtoplan']->is_path, 1); //信息所属分类,获取信息顶级节点内容 - if (! empty($data['info_howtoplan'])) { - $data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content); - } - //best time to visit - $data['info_besttime'] = $this->Information_model->search_by_words($destination_url, ['best', 'time'], [$data['detail']->is_id]); - if (empty($data['info_besttime'])) { - $data['info_besttime'] = $this->Information_model->Detail('/weather/china-best-times.htm'); - } - $data['info_besttime_root'] = $this->Information_model->get_detail_by_path($data['info_besttime']->is_path, 1); //信息所属分类,获取信息顶级节点内容 - if (! empty($data['info_besttime'])) { - $data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content); - } - //top things to do - $data['info_topthings'] = $this->Information_model->search_by_words($destination_url, ['top', 'things'], [$data['detail']->is_id]); - if (empty($data['info_topthings'])) { - $data['info_topthings'] = $this->Information_model->Detail('/travelguide/article-top-china-tourist-destination.htm'); - } - $data['info_topthings_root'] = $this->Information_model->get_detail_by_path($data['info_topthings']->is_path, 1); //信息所属分类,获取信息顶级节点内容 - if (! empty($data['info_topthings'])) { - $data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content); - } - //第四篇,随机推荐下方url - $random_array = [ - '/feedback/', - '/travelguide/how-chinahighlights-selects-your-hotel.htm', - '/travelguide/article-private-tour-vs-group-tour.htm', - '/aboutus/who-recommended.htm', - '/aboutus/no-shops.htm', - '/aboutus/company-history.htm', - ]; - $data['info_hotel'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); - if (! empty($data['info_hotel'])) { - $data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1); - $data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content); - } - break; - default: - return ''; + case 278008010: //Inspiration + //随机获取两个同级节点内容 + $random_array = $this->Information_model->random(2, $data['root_detail']->is_path, [$data['detail']->is_id]); + if (!empty($random_array[0])) { + $data['info_howtoplan'] = $random_array[0]; + $data['info_howtoplan_root'] = $data['root_detail']; + $data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content); + } + if (!empty($random_array[1])) { + $data['info_besttime'] = $random_array[1]; + $data['info_besttime_root'] = $data['root_detail']; + $data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content); + } + //漏斗作用的页面,随机挑选一篇 + $random_array = [ + '/travelguide/china-facts.htm', + '/travelguide/article-top-china-tourist-destination.htm', + '/travelguide/most-beautiful-places.htm', + '/weather/china-best-times.htm', + '/travelguide/article-10-movies-to-watch.htm', + '/travelguide/article-culture-shock-in-china.htm', + '/travelguide/article-what-chinese-eat-for-breakfast.htm', + '/travelguide/china-top-10-attractions.htm', + '/travelguide/chinese-food/eight-chinese-dishes.htm', + '/travelguide/china-travel-reopen-restrictions.htm', + ]; + $data['info_topthings'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); + if (!empty($data['info_topthings'])) { + $data['info_topthings_root'] = $this->Information_model->get_detail_by_path($data['info_topthings']->is_path, 1); + $data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content); + } + //文化板块的页面,随机挑选一篇 + $random_array = [ + '/travelguide/chinese-zodiac/', + '/travelguide/culture/china-arts-crafts.htm', + '/beijing/forbidden-city/', + '/travelguide/culture/traditionalmedichine.htm', + '/travelguide/chinese-tea/', + '/travelguide/kungfu/', + '/travelguide/culture/china-history.htm', + '/travelguide/chinese-food/', + '/travelguide/chinese-language/', + ]; + $data['info_hotel'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); + if (!empty($data['info_hotel'])) { + $data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1); + $data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content); + } + break; + case 278008012: //'planing-1(guide)': + case 278008013: //'planning-2 (decision tips)': + case 278008011: //'destination': //url的第一段表示地区,根据第一段来搜索相关数据如/beijing/ 而不是根据is_parent_id因为可能信息和线路是在不同的分类下 + $destination_url = trim($data['detail']->ic_url); + $destination_url = substr($destination_url, 0, strpos($destination_url, '/', 1) + 1); + //how to plan + $data['info_howtoplan'] = $this->Information_model->search_by_words($destination_url, ['how', 'plan'], [$data['detail']->is_id]); + if (empty($data['info_howtoplan'])) { //找不到对应信息则显示备用 + $data['info_howtoplan'] = $this->Information_model->Detail('/travelguide/plan-first-trip.htm'); + } + $data['info_howtoplan_root'] = $this->Information_model->get_detail_by_path($data['info_howtoplan']->is_path, 1); //信息所属分类,获取信息顶级节点内容 + if (!empty($data['info_howtoplan'])) { + $data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content); + } + //best time to visit + $data['info_besttime'] = $this->Information_model->search_by_words($destination_url, ['best', 'time'], [$data['detail']->is_id]); + if (empty($data['info_besttime'])) { + $data['info_besttime'] = $this->Information_model->Detail('/weather/china-best-times.htm'); + } + $data['info_besttime_root'] = $this->Information_model->get_detail_by_path($data['info_besttime']->is_path, 1); //信息所属分类,获取信息顶级节点内容 + if (!empty($data['info_besttime'])) { + $data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content); + } + //top things to do + $data['info_topthings'] = $this->Information_model->search_by_words($destination_url, ['top', 'things'], [$data['detail']->is_id]); + if (empty($data['info_topthings'])) { + $data['info_topthings'] = $this->Information_model->Detail('/travelguide/article-top-china-tourist-destination.htm'); + } + $data['info_topthings_root'] = $this->Information_model->get_detail_by_path($data['info_topthings']->is_path, 1); //信息所属分类,获取信息顶级节点内容 + if (!empty($data['info_topthings'])) { + $data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content); + } + //第四篇,随机推荐下方url + $random_array = [ + '/feedback/', + '/travelguide/how-chinahighlights-selects-your-hotel.htm', + '/travelguide/article-private-tour-vs-group-tour.htm', + '/aboutus/who-recommended.htm', + '/aboutus/no-shops.htm', + '/aboutus/company-history.htm', + ]; + $data['info_hotel'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]); + if (!empty($data['info_hotel'])) { + $data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1); + $data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content); + } + break; + default: + return ''; } return $this->load->view($template_path . '-next', $data, true); @@ -6026,176 +6065,177 @@ class Information extends CI_Controller { //更新静态文件 //不用参数提交的原因是可能url带有特殊字符,CI会报错 - public function update_cache($static_html_url = false, $delete_only = false) { - $url = ! empty($static_html_url) ? $static_html_url : $this->input->post('cache_url'); - $url = str_replace($this->config->item('site_url'), '', $url); + public function update_cache($static_html_url = false, $delete_only = false) + { + $url = !empty($static_html_url) ? $static_html_url : $this->input->post('cache_url'); + $url = str_replace($this->config->item('site_url'), '', $url); $original_url = $url; //原始链接 - $delete_only = ! empty($delete_only) ? $delete_only : $this->input->get_post('delete_only'); + $delete_only = !empty($delete_only) ? $delete_only : $this->input->get_post('delete_only'); switch ($this->config->item('site_code')) { - case 'cht': - $search_list = $this->Information_model->search_url($url); - $amp_request = false; - foreach ($search_list as $key => $req_url) { - $meta_amp_status = get_meta($req_url->ic_id, 'AMP_STATUS'); - if ($meta_amp_status) { - $amp_request = true; + case 'cht': + $search_list = $this->Information_model->search_url($url); + $amp_request = false; + foreach ($search_list as $key => $req_url) { + $meta_amp_status = get_meta($req_url->ic_id, 'AMP_STATUS'); + if ($meta_amp_status) { + $amp_request = true; + } } - } - if ($amp_request) { - $url = 'http://169.54.167.189:22224/ampreq' . $url; - } else { - $url = 'http://169.54.167.189:22224' . $url; - } - break; - case 'ah': - if ($delete_only === true) { - $url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url; - } else { // static_html_optimize=comeon 启用静态化压缩和js、css延迟加载 - $url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon'; - } - break; - case 'htravel': - if ($delete_only === true) { - $url = 'https://www.highlightstravel.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url; - } else { // static_html_optimize=comeon 启用静态化压缩和js、css延迟加载 - $url = 'https://www.highlightstravel.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon'; - } - break; - case 'gm': - //GET_HTTP("http://148.251.35.42:3300/create-cache/?url=" . urlencode($url)); //请求nodejs静态化更新页面,删除缓存,因为部分页面没有进入信息平台 - //if ($delete_only) { - // $url = "https://www.chinahighlightstravel.de/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url); - //} else { - //先删除再生成,部分页面没有在信息平台中 - GET_HTTP("https://www.chinahighlightstravel.de/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . $url); - $url = "https://www.chinahighlightstravel.de/gm.php/information/detail/?static_html_url=" . $url; - //} - break; - - //国际站 - case 'vac': - case 'vc': - case 'it': - case 'ru': - case 'jp': - $information = $this->Information_model->Detail($url); - $meta_pc_amp = @get_meta($information->ic_id, 'AMP_BODY_PC_STATUS'); - if ($delete_only) { - //只删除操作,在url修改和不发布信息的时候使用 - $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url; - } else { - $tmp = $url; - //判断是否是更新信息 - // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了 - if (! empty($information->ic_content) || ! empty($information->ic_summary) || $meta_pc_amp == 'yes') { - $url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; + if ($amp_request) { + $url = 'http://169.54.167.189:22224/ampreq' . $url; } else { - $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url; - //$url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; + $url = 'http://169.54.167.189:22224' . $url; } - if (isset($information->ic_type) && $information->ic_type == 'product') { - $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp; + break; + case 'ah': + if ($delete_only === true) { + $url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url; + } else { // static_html_optimize=comeon 启用静态化压缩和js、css延迟加载 + $url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon'; } - //int return direct - $cache_url = $this->input->post('cache_url'); - if ($url && ! $cache_url) { - /* - ignore_user_abort(true); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_TIMEOUT, 1); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容 - curl_setopt($ch, CURLOPT_HEADER, 0); //不需要HEAD - curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); - curl_setopt($ch, CURLOPT_NOBODY, 1); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_exec($ch); - curl_close($ch); - */ - $data['async_update'] = $url; - $data[] = ['name' => 'ok', 'value' => '信息保存成功,请在8秒后检查更新页面。', 'url' => $url]; - //如果是外部调用就返回结果,内部就不返回了 - if ($cache_url) { - echo json_encode($data); - } - return $data; + break; + case 'htravel': + if ($delete_only === true) { + $url = 'https://www.highlightstravel.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url; + } else { // static_html_optimize=comeon 启用静态化压缩和js、css延迟加载 + $url = 'https://www.highlightstravel.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon'; } - } - break; - //国际站 - GH - add gm - case 'gh_vac': - case 'gh_vc': - case 'gh_it': - case 'gh_ru': - case 'gh_jp': - case 'gh_gm': - $information = $this->Information_model->Detail($url); - $meta_pc_amp = @get_meta($information->ic_id, 'AMP_BODY_PC_STATUS'); - if ($delete_only) { - //只删除操作,在url修改和不发布信息的时候使用 - $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url; - } else { - $tmp = $url; - //判断是否是更新信息 - // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了 - if (! empty($information->ic_content) || ! empty($information->ic_summary) || $meta_pc_amp == 'yes') { - $url = $this->config->item('site_url') . '/index.php/gh/info/detail/?static_html_url=' . $url; + break; + case 'gm': + //GET_HTTP("http://148.251.35.42:3300/create-cache/?url=" . urlencode($url)); //请求nodejs静态化更新页面,删除缓存,因为部分页面没有进入信息平台 + //if ($delete_only) { + // $url = "https://www.chinahighlightstravel.de/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url); + //} else { + //先删除再生成,部分页面没有在信息平台中 + GET_HTTP("https://www.chinahighlightstravel.de/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . $url); + $url = "https://www.chinahighlightstravel.de/gm.php/information/detail/?static_html_url=" . $url; + //} + break; + + //国际站 + case 'vac': + case 'vc': + case 'it': + case 'ru': + case 'jp': + $information = $this->Information_model->Detail($url); + $meta_pc_amp = @get_meta($information->ic_id, 'AMP_BODY_PC_STATUS'); + if ($delete_only) { + //只删除操作,在url修改和不发布信息的时候使用 + $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url; } else { - $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url; - //$url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; - } - if (isset($information->ic_type) && $information->ic_type == 'product') { - $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp; + $tmp = $url; + //判断是否是更新信息 + // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了 + if (!empty($information->ic_content) || !empty($information->ic_summary) || $meta_pc_amp == 'yes') { + $url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; + } else { + $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url; + //$url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; + } + if (isset($information->ic_type) && $information->ic_type == 'product') { + $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp; + } + //int return direct + $cache_url = $this->input->post('cache_url'); + if ($url && !$cache_url) { + /* + ignore_user_abort(true); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_TIMEOUT, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容 + curl_setopt($ch, CURLOPT_HEADER, 0); //不需要HEAD + curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); + curl_setopt($ch, CURLOPT_NOBODY, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_exec($ch); + curl_close($ch); + */ + $data['async_update'] = $url; + $data[] = ['name' => 'ok', 'value' => '信息保存成功,请在8秒后检查更新页面。', 'url' => $url]; + //如果是外部调用就返回结果,内部就不返回了 + if ($cache_url) { + echo json_encode($data); + } + return $data; + } } + break; + //国际站 - GH - add gm + case 'gh_vac': + case 'gh_vc': + case 'gh_it': + case 'gh_ru': + case 'gh_jp': + case 'gh_gm': + $information = $this->Information_model->Detail($url); + $meta_pc_amp = @get_meta($information->ic_id, 'AMP_BODY_PC_STATUS'); + if ($delete_only) { + //只删除操作,在url修改和不发布信息的时候使用 + $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url; + } else { + $tmp = $url; + //判断是否是更新信息 + // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了 + if (!empty($information->ic_content) || !empty($information->ic_summary) || $meta_pc_amp == 'yes') { + $url = $this->config->item('site_url') . '/index.php/gh/info/detail/?static_html_url=' . $url; + } else { + $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url; + //$url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url; + } + if (isset($information->ic_type) && $information->ic_type == 'product') { + $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp; + } - // GH国际 不发布的时候删除缓存 - if (isset($information) && ! empty($information) && ! $information->ic_status) { - $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $tmp; - } + // GH国际 不发布的时候删除缓存 + if (isset($information) && !empty($information) && !$information->ic_status) { + $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $tmp; + } - //int return direct - $cache_url = $this->input->post('cache_url'); - if ($url && ! $cache_url) { - /* - ignore_user_abort(true); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_TIMEOUT, 1); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容 - curl_setopt($ch, CURLOPT_HEADER, 0); //不需要HEAD - curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); - curl_setopt($ch, CURLOPT_NOBODY, 1); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_exec($ch); - curl_close($ch); - */ - $data['async_update'] = $url; - $data[] = ['name' => 'ok', 'value' => '信息保存成功,请在8秒后检查更新页面。', 'url' => $url]; - //如果是外部调用就返回结果,内部就不返回了 - if ($cache_url) { - echo json_encode($data); + //int return direct + $cache_url = $this->input->post('cache_url'); + if ($url && !$cache_url) { + /* + ignore_user_abort(true); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_TIMEOUT, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容 + curl_setopt($ch, CURLOPT_HEADER, 0); //不需要HEAD + curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); + curl_setopt($ch, CURLOPT_NOBODY, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_exec($ch); + curl_close($ch); + */ + $data['async_update'] = $url; + $data[] = ['name' => 'ok', 'value' => '信息保存成功,请在8秒后检查更新页面。', 'url' => $url]; + //如果是外部调用就返回结果,内部就不返回了 + if ($cache_url) { + echo json_encode($data); + } + return $data; } - return $data; } - } - break; - - case 'ct': //子站点使用 - $url = 'http://50.97.246.187:22223' . $url; - break; - case 'sht': - case 'gl': - case 'mbj': - case 'yz': - $url = $this->config->item('site_url') . $url . '@cache@refresh'; - break; - default: - return false; + break; + + case 'ct': //子站点使用 + $url = 'http://50.97.246.187:22223' . $url; + break; + case 'sht': + case 'gl': + case 'mbj': + case 'yz': + $url = $this->config->item('site_url') . $url . '@cache@refresh'; + break; + default: + return false; //break; } @@ -6224,10 +6264,11 @@ class Information extends CI_Controller { } //更新CDN缓存 - public function update_cdn($static_html_url = false) { - $flag = false; //false:不更新,true:更新 + public function update_cdn($static_html_url = false) + { + $flag = false; //false:不更新,true:更新 $update_site = ['jp', 'ru']; //需要更新CDN的站点 - //需要更新的url + //需要更新的url $url = $static_html_url; if (empty($url)) { $url = $this->input->post('cache_url'); @@ -6236,8 +6277,8 @@ class Information extends CI_Controller { //如果传递进来的url是带有域名,则对域名进行判断 $tempu = parse_url($url); if (isset($tempu['host'])) { - $url = isset($tempu['path']) ? $tempu['path'] : '/'; - $pad = $tempu['host']; + $url = isset($tempu['path']) ? $tempu['path'] : '/'; + $pad = $tempu['host']; $flag = true; } //如果传递进来的url没有域名,则使用当前站点的信息进行判断 else { @@ -6263,28 +6304,30 @@ class Information extends CI_Controller { } //获取产品信息,提供给用户选择进行绑定 - public function get_products() { + public function get_products() + { $HT_productType = $this->input->post('product_type'); $HT_productName = $this->input->post('product_name'); //产品类型 switch ($HT_productType) { - case 't': - $data['productList'] = $this->Landscape_model->search_list($HT_productName); - break; - default: - $data['productList'] = []; - break; + case 't': + $data['productList'] = $this->Landscape_model->search_list($HT_productName); + break; + default: + $data['productList'] = []; + break; } $data['product_type'] = $HT_productType; - $product_list_page = $this->load->view('bootstrap/information_select_product', $data, true); - $data = []; - $data[] = ['name' => 'ok', 'value' => $product_list_page]; + $product_list_page = $this->load->view('bootstrap/information_select_product', $data, true); + $data = []; + $data[] = ['name' => 'ok', 'value' => $product_list_page]; echo json_encode($data); return true; } //显示备份的内容 - public function backup_content($log_id) { + public function backup_content($log_id) + { $data['log_info'] = $this->Logs_model->read($log_id); if ($data['log_info']->log_action == 'backup_amp') { $data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id, true); @@ -6297,9 +6340,10 @@ class Information extends CI_Controller { } //保存自定义配置 - public function save_meta() { + public function save_meta() + { $im_ic_id = $this->input->post('im_ic_id'); - $im_key = $this->input->post('im_key'); + $im_key = $this->input->post('im_key'); $im_value = $this->input->post('im_value'); if ($im_ic_id && $im_key && $im_value !== false) { $meta = $this->InfoMetas_model->get($im_ic_id, $im_key); @@ -6317,9 +6361,10 @@ class Information extends CI_Controller { } //保存自定义配置 - public function delete_meta() { + public function delete_meta() + { $im_ic_id = $this->input->post('im_ic_id'); - $im_key = $this->input->post('im_key'); + $im_key = $this->input->post('im_key'); if ($im_ic_id && $im_key) { $this->InfoMetas_model->delete($im_ic_id, $im_key); @@ -6331,46 +6376,47 @@ class Information extends CI_Controller { return true; } - public function get_author_url($domain_name, $OPI_Code) { + public function get_author_url($domain_name, $OPI_Code) + { $OPI_CodeUrls = [ - 'zzy' => 'https://' . $domain_name . '/aboutus/team/ruru-zhou', - '2' => 'https://' . $domain_name . '/aboutus/team/ruru-zhou', - 'HWT' => 'https://' . $domain_name . '/aboutus/team/mike-he', - 'CA' => 'https://' . $domain_name . '/aboutus/team/carol-wang', - 'SI' => 'https://' . $domain_name . '/aboutus/team/simon-huang', - 'TJQ' => 'https://' . $domain_name . '/aboutus/team/cindy-tang', - 'CLA' => 'https://' . $domain_name . '/aboutus/team/claire-wang', + 'zzy' => 'https://' . $domain_name . '/aboutus/team/ruru-zhou', + '2' => 'https://' . $domain_name . '/aboutus/team/ruru-zhou', + 'HWT' => 'https://' . $domain_name . '/aboutus/team/mike-he', + 'CA' => 'https://' . $domain_name . '/aboutus/team/carol-wang', + 'SI' => 'https://' . $domain_name . '/aboutus/team/simon-huang', + 'TJQ' => 'https://' . $domain_name . '/aboutus/team/cindy-tang', + 'CLA' => 'https://' . $domain_name . '/aboutus/team/claire-wang', 'Albee' => 'https://' . $domain_name . '/aboutus/team/albee-ning', - 'KM' => 'https://' . $domain_name . '/aboutus/team/kimi-huang', - 'RY' => 'https://' . $domain_name . '/aboutus/team/rita-yu', - 'QMY' => 'https://' . $domain_name . '/aboutus/team/chris-quan', - 'CY' => 'https://' . $domain_name . '/aboutus/team/cynthia-li', + 'KM' => 'https://' . $domain_name . '/aboutus/team/kimi-huang', + 'RY' => 'https://' . $domain_name . '/aboutus/team/rita-yu', + 'QMY' => 'https://' . $domain_name . '/aboutus/team/chris-quan', + 'CY' => 'https://' . $domain_name . '/aboutus/team/cynthia-li', 'Vicky' => 'https://' . $domain_name . '/aboutus/team/vicky-leng', - 'LXW' => 'https://' . $domain_name . '/aboutus/team/carper-li', + 'LXW' => 'https://' . $domain_name . '/aboutus/team/carper-li', 'zzyGH' => 'https://' . $domain_name . '/aboutus/team/ruru-zhou', ]; if ($domain_name == 'www.chinahighlights.com') { $OPI_CodeUrls = [ - 'zzy' => 'https://www.chinahighlights.com/aboutus/team/ruru-zhou.htm', - '2' => 'https://www.chinahighlights.com/aboutus/team/ruru-zhou.htm', - 'HWT' => 'https://www.chinahighlights.com/aboutus/team/mike-he.htm', - 'CA' => 'https://www.chinahighlights.com/aboutus/team/carol-wang.htm', - 'SI' => 'https://www.chinahighlights.com/aboutus/team/simon-huang.htm', - 'TJQ' => 'https://www.chinahighlights.com/aboutus/team/cindy-tang.htm', - 'CLA' => 'https://www.chinahighlights.com/aboutus/team/claire-wang.htm', + 'zzy' => 'https://www.chinahighlights.com/aboutus/team/ruru-zhou.htm', + '2' => 'https://www.chinahighlights.com/aboutus/team/ruru-zhou.htm', + 'HWT' => 'https://www.chinahighlights.com/aboutus/team/mike-he.htm', + 'CA' => 'https://www.chinahighlights.com/aboutus/team/carol-wang.htm', + 'SI' => 'https://www.chinahighlights.com/aboutus/team/simon-huang.htm', + 'TJQ' => 'https://www.chinahighlights.com/aboutus/team/cindy-tang.htm', + 'CLA' => 'https://www.chinahighlights.com/aboutus/team/claire-wang.htm', 'Albee' => 'https://www.chinahighlights.com/aboutus/team/albee-ning.htm', - 'KM' => 'https://www.chinahighlights.com/aboutus/team/kimi-huang.htm', - 'RY' => 'https://www.chinahighlights.com/aboutus/team/rita-yu.htm', - 'QMY' => 'https://www.chinahighlights.com/aboutus/team/chris-quan.htm', - 'CY' => 'https://www.chinahighlights.com/aboutus/team/cynthia-li.htm', + 'KM' => 'https://www.chinahighlights.com/aboutus/team/kimi-huang.htm', + 'RY' => 'https://www.chinahighlights.com/aboutus/team/rita-yu.htm', + 'QMY' => 'https://www.chinahighlights.com/aboutus/team/chris-quan.htm', + 'CY' => 'https://www.chinahighlights.com/aboutus/team/cynthia-li.htm', 'Vicky' => 'https://www.chinahighlights.com/aboutus/team/vicky-leng.htm', - 'LXW' => 'https://www.chinahighlights.com/aboutus/team/carper-li.htm', + 'LXW' => 'https://www.chinahighlights.com/aboutus/team/carper-li.htm', 'zzyGH' => 'https://www.chinahighlights.com/aboutus/team/ruru-zhou.htm', ]; } - if (! empty($OPI_Code) && array_key_exists($OPI_Code, $OPI_CodeUrls)) { + if (!empty($OPI_Code) && array_key_exists($OPI_Code, $OPI_CodeUrls)) { return $OPI_CodeUrls[$OPI_Code]; } else { return ''; @@ -6378,9 +6424,10 @@ class Information extends CI_Controller { } // 获取作者信息,包括头像、领域、主页 - private function get_author_info($domain_name, $OPI_Code) { + private function get_author_info($domain_name, $OPI_Code) + { // 定义URL模板 - $baseUrl = 'https://www.' . $domain_name; + $baseUrl = 'https://www.' . $domain_name; $about_us_url = $baseUrl . '/author-page-not-defined/'; if ($domain_name == 'chinahighlights.com' || $domain_name == 'globalhighlights.com') { @@ -6392,54 +6439,54 @@ class Information extends CI_Controller { // 共享的URL结构 $OPI_CodeUrls = [ - 'zzy' => $about_us_url . 'ruru-zhou' . $urlSuffix, - 'HWT' => $about_us_url . 'mike-he' . $urlSuffix, - 'CA' => $about_us_url . 'carol-wang' . $urlSuffix, - 'SI' => $about_us_url . 'simon-huang' . $urlSuffix, - 'TJQ' => $about_us_url . 'cindy-tang' . $urlSuffix, - 'CLA' => $about_us_url . 'claire-wang' . $urlSuffix, + 'zzy' => $about_us_url . 'ruru-zhou' . $urlSuffix, + 'HWT' => $about_us_url . 'mike-he' . $urlSuffix, + 'CA' => $about_us_url . 'carol-wang' . $urlSuffix, + 'SI' => $about_us_url . 'simon-huang' . $urlSuffix, + 'TJQ' => $about_us_url . 'cindy-tang' . $urlSuffix, + 'CLA' => $about_us_url . 'claire-wang' . $urlSuffix, 'Albee' => $about_us_url . 'albee-ning' . $urlSuffix, - 'KM' => $about_us_url . 'kimi-huang' . $urlSuffix, - 'RY' => $about_us_url . 'rita-yu' . $urlSuffix, - 'QMY' => $about_us_url . 'chris-quan' . $urlSuffix, - 'CY' => $about_us_url . 'cynthia-li' . $urlSuffix, + 'KM' => $about_us_url . 'kimi-huang' . $urlSuffix, + 'RY' => $about_us_url . 'rita-yu' . $urlSuffix, + 'QMY' => $about_us_url . 'chris-quan' . $urlSuffix, + 'CY' => $about_us_url . 'cynthia-li' . $urlSuffix, 'Vicky' => $about_us_url . 'vicky-leng' . $urlSuffix, - 'LXW' => $about_us_url . 'carper-li' . $urlSuffix, + 'LXW' => $about_us_url . 'carper-li' . $urlSuffix, ]; // 共享的头像和专长映射 $expertiseMap = [ - 'zzy' => [ + 'zzy' => [ 'expertise' => 'Japan Expert', - 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/bc1583b921a24cc3be739e57d290f582_cut_300x300_608.JPG', + 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/bc1583b921a24cc3be739e57d290f582_cut_300x300_608.JPG', ], - 'HWT' => [ + 'HWT' => [ 'expertise' => 'Thailand Expert', - 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/5dc9f81961c24725895205d65123b8e7_cut_300x300_608.JPG', + 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/5dc9f81961c24725895205d65123b8e7_cut_300x300_608.JPG', ], - 'TJQ' => [ + 'TJQ' => [ 'expertise' => 'Thailand Expert', - 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/513a1f2af9e54157932fbe157a8862d3_cut_300x300_608.JPG', + 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/513a1f2af9e54157932fbe157a8862d3_cut_300x300_608.JPG', ], - 'RY' => [ + 'RY' => [ 'expertise' => 'Vietnam Expert', - 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/8895dc76301e47a094c0c86048a2c39a_cut_300x300_608.JPG', + 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/8895dc76301e47a094c0c86048a2c39a_cut_300x300_608.JPG', ], - 'QMY' => [ + 'QMY' => [ 'expertise' => 'China Expert', - 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/8097b02a5f2c4486824ffecc045a4125_cut_300x300_608.JPG', + 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/8097b02a5f2c4486824ffecc045a4125_cut_300x300_608.JPG', ], - 'CY' => [ + 'CY' => [ 'expertise' => 'Japan Expert', - 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/65499011c0714e0aa1271bc300d9399d_cut_300x300_608.JPG', + 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/65499011c0714e0aa1271bc300d9399d_cut_300x300_608.JPG', ], 'Vicky' => [ 'expertise' => 'Japan Expert', - 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/a2d6ac5a7ccb4c06a3d8f1bbf939bdf5_cut_300x300_608.JPG', + 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/a2d6ac5a7ccb4c06a3d8f1bbf939bdf5_cut_300x300_608.JPG', ], - 'LXW' => [ + 'LXW' => [ 'expertise' => 'Japan Expert', - 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/b002b9e61b464e24956fea8f17e2ef37_cut_300x300_608.JPG', + 'avatar' => 'https://images.' . $domain_name . '/allpicture/2024/03/b002b9e61b464e24956fea8f17e2ef37_cut_300x300_608.JPG', ], ]; @@ -6448,15 +6495,15 @@ class Information extends CI_Controller { foreach ($OPI_CodeUrls as $key => $url) { if (isset($expertiseMap[$key])) { $authorData[$key] = [ - 'url' => $url, - 'avatar' => $expertiseMap[$key]['avatar'], + 'url' => $url, + 'avatar' => $expertiseMap[$key]['avatar'], 'expertise' => $expertiseMap[$key]['expertise'], ]; } } // 合并重复项 - $authorData['2'] = $authorData['zzy']; + $authorData['2'] = $authorData['zzy']; $authorData['zzyGH'] = $authorData['zzy']; return isset($authorData[$OPI_Code]) ? $authorData[$OPI_Code] : ['url' => '', 'avatar' => '', 'expertise' => ''];