";
@@ -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 = '
';
+ $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 = '
';
}
- //火车票详细页搜索框添加 -- 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"] .= '
';
- 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 = '
';
- if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) {
+ $bannerImg = '
';
+ 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 = '
';
- if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) {
+ $bannerImg = '
';
+ 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"] = '
' . $template_TrainSearch . '
' . $template_TrainSearch . '
';
}
} 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"] = '
' . $template_TrainSearch . '
' . $template_TrainSearch . '
';
}
}
@@ -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"] = '
' . $bannerImg . $ImgText . $template_TrainSearch . '
';
@@ -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 = '

';
- if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) {
+ $bannerImg = '

';
+ 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 = '
' . $meta_addon_picture_text . '
';
}
} else {
$meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture');
- $bannerImg = '

';
- if (! empty($meta_addon_picture_url) && ! empty($meta_addon_picture_text)) {
+ $bannerImg = '

';
+ 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 = '
' . $meta_addon_picture_text . '
';
}
}
@@ -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"] = '
' . $template_TrainSearch . '
';
+ $data["TOPBANNER"] = '
' . $template_TrainSearch . '
';
}
} 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"] = '
' . $template_TrainSearch . '
';
+ $data["TOPBANNER"] = '
' . $template_TrainSearch . '
';
}
}
- 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"] = '
' . $bannerImg . $ImgText . $template_TrainSearch . '
';
@@ -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 = '

';
+ $bannerImg = '

';
} else {
$meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture');
- $bannerImg = '

';
+ $bannerImg = '

';
}
- 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"] = '
' . $bannerImg . $ImgText . '
';
@@ -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' => ''];