|
|
|
|
@ -24,6 +24,7 @@ class Information extends CI_Controller
|
|
|
|
|
$this->load->model('InfoSMS_model');
|
|
|
|
|
$this->load->model('recommends_and_tips_model');
|
|
|
|
|
$this->load->model('trippest_model'); //trippest产品
|
|
|
|
|
$this->load->model('infoBokunData_model'); //trainspread产品
|
|
|
|
|
$this->load->model('Feedback_model');
|
|
|
|
|
$this->load->model('Price_model');
|
|
|
|
|
$this->load->model('PrimeLinePrice_model');
|
|
|
|
|
@ -3628,7 +3629,397 @@ class Information extends CI_Controller
|
|
|
|
|
* TrainSpread网站静态化
|
|
|
|
|
*/
|
|
|
|
|
public function make_www_cache_ts($information){
|
|
|
|
|
$data = array();
|
|
|
|
|
|
|
|
|
|
#region 公用数据
|
|
|
|
|
$apiurl = "http://202.103.68.104:61/info.php"; //本地测试
|
|
|
|
|
//$apiurl = "https://ct.mycht.cn/info.php"; //网前
|
|
|
|
|
|
|
|
|
|
//先准备数据,采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。
|
|
|
|
|
$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'); //模板位置
|
|
|
|
|
|
|
|
|
|
//面包屑
|
|
|
|
|
$crumb = "";
|
|
|
|
|
$crumb_data = $this->Information_model->get_path_exclude_ct($information->is_id, $information->is_path);
|
|
|
|
|
if (count($crumb_data) > 0) { //至少有一个父类面包屑才显示
|
|
|
|
|
$crumb = "<div class=\"crumb\"><a href=\"/\">Home</a>";
|
|
|
|
|
foreach ($crumb_data as $index => $item) {
|
|
|
|
|
$crumb .= '<a href="' . $item['ic_url'] . '" data-index="' . $index . '" data-is-id="' . $item['is_id'] . '">' . $item['ic_url_title'] . '</a>';
|
|
|
|
|
}
|
|
|
|
|
$crumb .= "</div>";
|
|
|
|
|
}
|
|
|
|
|
$data["crumb"] = $crumb;
|
|
|
|
|
|
|
|
|
|
//作者字符串,信息页或者城市天气页加载 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 = '<div class="authorupdate">Written by <strong>' . $OPI_FirstName . '</strong> Updated <span>' . date("M. j, Y", strtotime($information->ic_datetime)) . '</span></div>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 详细内容 */
|
|
|
|
|
$ic_content = $information->ic_content;
|
|
|
|
|
|
|
|
|
|
/** 替换H1加面包屑,加作者 */
|
|
|
|
|
$ic_content = preg_replace('/<h1>(.*)<\/h1>/i', $crumb . "\r\n" . '<H1>$1</H1>' . "\r\n" . $str_author . "\r\n", $ic_content, 1);
|
|
|
|
|
|
|
|
|
|
//图片加延迟
|
|
|
|
|
$ic_content = $this->html_optimize_lib->set_lazy_loader($ic_content, 'https://data.trainspread.com/images/grey.gif');
|
|
|
|
|
|
|
|
|
|
$ic_content = $this->html_optimize_lib->set_image_size($ic_content);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//非产品页面
|
|
|
|
|
$data["PRODUCTJS"] = "";
|
|
|
|
|
$data["ISPRODUCT"] = "no"; //判断是否是产品页
|
|
|
|
|
$data["addthis_widget"] = "";
|
|
|
|
|
$data["FloatIcon"] = ""; //浮动图标替代addthis
|
|
|
|
|
$arrExitUrl = array("/", "/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"] = "<div class=\"fixed-tm\"><a href=\"/forms/customize\" >Create My Trip</a></div>";
|
|
|
|
|
} else {
|
|
|
|
|
$data["ISPRODUCT"] = "yes";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//顶部视频
|
|
|
|
|
$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)) {
|
|
|
|
|
$data["TOPVIDEO"] = '<div class="banner"><video autoplay="" controls="controls" id="bgvid" poster="' . $meta_video_picture . '" src="' . $meta_news_video . '" style="position: inherit;"> </video></div>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//主样式表,内联模式
|
|
|
|
|
$apiweb="http://202.103.68.104:71"; //本地测试
|
|
|
|
|
//$apiweb = "https://www.trainspread.com";
|
|
|
|
|
$cssUrl = $apiweb . "/css/base.css?v=" . time();
|
|
|
|
|
$main_css_string = compress_css(GET_HTTP($cssUrl));
|
|
|
|
|
$data["MAINCSS"] = '<style type="text/css">' . $main_css_string . '</style>';
|
|
|
|
|
|
|
|
|
|
//额外样式
|
|
|
|
|
$data["ADDONCSS"] = "";
|
|
|
|
|
$meta_addon_css = get_meta($information->ic_id, 'meta_addon_css');
|
|
|
|
|
if (!empty($meta_addon_css)) {
|
|
|
|
|
//引用方式
|
|
|
|
|
//$data["ADDONCSS"]= '<link href="' . $meta_addon_css . '" rel="stylesheet" />';
|
|
|
|
|
//内联方式
|
|
|
|
|
$meta_addon_css_string = compress_css(GET_HTTP($meta_addon_css));
|
|
|
|
|
$data["ADDONCSS"] = '<style type="text/css">' . $meta_addon_css_string . '</style>';
|
|
|
|
|
}
|
|
|
|
|
//社媒分享图片
|
|
|
|
|
$data["OGIMAGE"] = "";
|
|
|
|
|
if (!empty($information->ic_photo)) {
|
|
|
|
|
if (strpos($information->ic_photo, "mybeijingchina.com") != false) {
|
|
|
|
|
$full_ic_photo = $information->ic_photo;
|
|
|
|
|
} else {
|
|
|
|
|
$full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo;
|
|
|
|
|
}
|
|
|
|
|
$data["OGIMAGE"] = '<meta property="og:image" content="' . $full_ic_photo . '"><meta property="og:image:secure_url" content="' . $full_ic_photo . '"><meta property="og:image:width" content="800"><meta property="og:image:height" content="450">';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//结构化标签
|
|
|
|
|
$data["ConstructionCode"] = "";
|
|
|
|
|
$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 = "";
|
|
|
|
|
$meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格
|
|
|
|
|
|
|
|
|
|
if ($meta_ct_page_price == "yes") {
|
|
|
|
|
$addBaseJs = true;
|
|
|
|
|
} else if ($meta_ct_page_type !== false && $meta_ct_page_type != "") {
|
|
|
|
|
$addBaseJs = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($addBaseJs) {
|
|
|
|
|
$addonJs = '<script src="' . $apiweb . '/js/mobile-first/base.js" defer></script>';
|
|
|
|
|
}
|
|
|
|
|
/// ----- 总JS判断完成-----
|
|
|
|
|
|
|
|
|
|
//额外js
|
|
|
|
|
$data["ADDONJS"] = "";
|
|
|
|
|
$meta_addon_js = get_meta($information->ic_id, 'meta_addon_js');
|
|
|
|
|
if (!empty($meta_addon_js)) {
|
|
|
|
|
$addonJs .= '<script src="' . $meta_addon_js . '" defer></script>';
|
|
|
|
|
}
|
|
|
|
|
//价格js
|
|
|
|
|
if ($meta_ct_page_price == "yes") {
|
|
|
|
|
$addonJs .= '<script src="' . $apiweb . '/js/mobile-first/getprice.js" defer></script>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//列表js
|
|
|
|
|
if (in_array($meta_ct_page_type, array('daytripindex', 'tourindex', 'attractionindex'))) {
|
|
|
|
|
$addonJs .= '<script src="' . $apiweb . '/js/mobile-first/getlist.js" defer></script>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//天气
|
|
|
|
|
if (in_array($meta_ct_page_type, array('weatherpage'))) {
|
|
|
|
|
$addonJs .= '<script src="' . $apiweb . '/js/mobile-first/getweather.js" defer></script>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//页面传递参数
|
|
|
|
|
$passParam = "";
|
|
|
|
|
if (in_array($meta_ct_page_type, array("daytripindex", "tourindex", "attractionindex", "weatherpage"))) { //一日游和线路列表
|
|
|
|
|
//产品首页
|
|
|
|
|
$meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value');
|
|
|
|
|
|
|
|
|
|
if (in_array($meta_ct_page_type, array("attractionindex"))) {
|
|
|
|
|
//旧信息id,景点等信息类
|
|
|
|
|
$passParam .= '<input type="hidden" name="param_old_pid" id="param_old_pid" value="' . $meta_ct_page_value . '"/>';
|
|
|
|
|
} else {
|
|
|
|
|
//城市名称,产品类用
|
|
|
|
|
$passParam .= '<input type="hidden" name="param_city" id="param_city" value="' . $meta_ct_page_value . '"/>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//加信息平台的is_id
|
|
|
|
|
$passParam .= '<input type="hidden" name="param_parentId" id="param_parentId" value="' . $information->is_id . '"/>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//产品详细页
|
|
|
|
|
$productType = "";
|
|
|
|
|
$productCode = "";
|
|
|
|
|
if ($meta_ct_page_type == "daytripdetail") {
|
|
|
|
|
//一日游
|
|
|
|
|
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)) {
|
|
|
|
|
$productCode = $meta_ct_page_value;
|
|
|
|
|
}
|
|
|
|
|
$addonJs .= '<script src="' . $apiweb . '/js/mobile-first/daytripdetail.js" defer></script>';
|
|
|
|
|
//$addonJs .= '<script src="'.$apiweb.'/js/mobile-first/flatpickr.js"></script>';
|
|
|
|
|
$data["ADDONCSS"] .= '<link href="' . $apiweb . '/css/flatpickr.css" rel="preload" as="style" onload="this.rel=\'stylesheet\'" />';
|
|
|
|
|
|
|
|
|
|
//一日游表单的替换,放到下面的区分PC端和移动端
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if ($meta_ct_page_type == "tourdetail") {
|
|
|
|
|
//线路
|
|
|
|
|
$productType = $meta_ct_page_type;
|
|
|
|
|
$meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value');
|
|
|
|
|
if (!empty($meta_ct_page_value)) {
|
|
|
|
|
$productCode = $meta_ct_page_value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取cli_sn
|
|
|
|
|
$tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/apibj/getCliSn/?param=" . $productCode));
|
|
|
|
|
$data["clisn"] = $tourdata->clisn;
|
|
|
|
|
|
|
|
|
|
//调取模板
|
|
|
|
|
$dataform["TourCode"] = $productCode;
|
|
|
|
|
$dataform["CLI_SN"] = $tourdata->clisn;
|
|
|
|
|
$dataform["TourName"] = $information->ic_title;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//表单页
|
|
|
|
|
if (in_array($meta_ct_page_type, array("customize", "contactus", "pagewithform", "tourdetail"))) {
|
|
|
|
|
$productType = $meta_ct_page_type;
|
|
|
|
|
$addonJs .= '<script src="' . $apiweb . '/js/mobile-first/form.js" defer></script>';
|
|
|
|
|
$data["ADDONCSS"] .= '<link href="' . $apiweb . '/css/flatpickr.css" rel="preload" as="style" onload="this.rel=\'stylesheet\'" />';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($meta_ct_page_type == "daytripform") {
|
|
|
|
|
$productType = $meta_ct_page_type;
|
|
|
|
|
$addonJs .= '<script src="' . $apiweb . '/js/mobile-first/daytrip-form.js" defer></script>';
|
|
|
|
|
//$data["ADDONCSS"] .= '<link href="' . $apiweb . '/css/css3/form.css" rel="preload" as="style" onload="this.rel=\'stylesheet\'" />';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data["productType"] = $productType;
|
|
|
|
|
$data["productCode"] = $productCode;
|
|
|
|
|
|
|
|
|
|
//页面添加的元素
|
|
|
|
|
$data["ADDONJS"] = $addonJs;
|
|
|
|
|
$data["passParam"] = $passParam;
|
|
|
|
|
|
|
|
|
|
//页面详细内容放最后,这样上面都可以进行内容的替换,比如一日游表单
|
|
|
|
|
$data["CUSTOMCONENT"] = $ic_content;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 移动端和PC端差别处理区域
|
|
|
|
|
$arrDevice = array("mobile", "pc");
|
|
|
|
|
foreach ($arrDevice as $device) {
|
|
|
|
|
//顶部全屏大图
|
|
|
|
|
$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 = '<img class="img-responsive" alt="' . $information->ic_title . '" src="' . $meta_addon_picture . '" width="750" height="500">';
|
|
|
|
|
if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) {
|
|
|
|
|
$ImgText = '<div class="carousel-caption"><p class="ads-title"><a href="' . $meta_addon_picture_url . '">' . $meta_addon_picture_text . '</a></p></div>';
|
|
|
|
|
} else if (!empty($meta_addon_picture_text)) {
|
|
|
|
|
$ImgText = '<div class="carousel-caption"><p class="ads-title">' . $meta_addon_picture_text . '</p></div>';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture');
|
|
|
|
|
$bannerImg = '<img class="img-responsive" alt="' . $information->ic_title . '" src="' . $meta_addon_picture . '" width="1920" height="720">';
|
|
|
|
|
if (!empty($meta_addon_picture_url) && !empty($meta_addon_picture_text)) {
|
|
|
|
|
$ImgText = '<div class="carousel-caption"><p class="ads-title"><a href="' . $meta_addon_picture_url . '">' . $meta_addon_picture_text . '</a></p></div>';
|
|
|
|
|
} else if (!empty($meta_addon_picture_text)) {
|
|
|
|
|
$ImgText = '<div class="carousel-caption"><p class="ads-title">' . $meta_addon_picture_text . '</p></div>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 搜索框
|
|
|
|
|
$template_TrainSearch = "";
|
|
|
|
|
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 = "";
|
|
|
|
|
//火车票移动端去掉头部图片,保证搜索框CLS
|
|
|
|
|
if ($device == 'mobile') {
|
|
|
|
|
$meta_addon_picture = "";
|
|
|
|
|
$data["TOPBANNER"] = '<div class="banner">' . $template_TrainSearch . '</div>';
|
|
|
|
|
}
|
|
|
|
|
} else if ($information->ic_url == "/china-flights") {
|
|
|
|
|
//机票首页
|
|
|
|
|
$template_TrainSearch = $this->load->view($template_path . '-flight-index', null, true);
|
|
|
|
|
$ImgText = "";
|
|
|
|
|
//飞机票移动端去掉头部图片,保证搜索框CLS
|
|
|
|
|
if ($device == 'mobile') {
|
|
|
|
|
$meta_addon_picture = "";
|
|
|
|
|
$data["TOPBANNER"] = '<div class="banner">' . $template_TrainSearch . '</div>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($meta_ct_page_type == "daytripdetail") { //一日游产品的表单处理放这里,根据PC和移动端有所区别
|
|
|
|
|
$DayTripData['device'] = $device;
|
|
|
|
|
|
|
|
|
|
/**替换左右结构的线路表单标签 2024-7-4*/
|
|
|
|
|
if (strpos($ic_content, '<!--@DAYTRIP-FORM@-->') !== false) {
|
|
|
|
|
//准备数据
|
|
|
|
|
$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_seo_title;
|
|
|
|
|
//成人,儿童,婴儿的年龄显示信息
|
|
|
|
|
$AdultMsg = $this->infoBokunData_model->getBokunMetaList($information->ic_id, "AdultMsg");
|
|
|
|
|
if ($AdultMsg) {
|
|
|
|
|
foreach ($AdultMsg as $AdultMsgItem) {
|
|
|
|
|
$DayTripData["AdultMsg"] = $AdultMsgItem->ibd_Itemvalue;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$DayTripData["AdultMsg"] = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ChildMsg = $this->infoBokunData_model->getBokunMetaList($information->ic_id, "ChildMsg");
|
|
|
|
|
if ($ChildMsg) {
|
|
|
|
|
foreach ($ChildMsg as $ChildMsgItem) {
|
|
|
|
|
$DayTripData["ChildMsg"] = $ChildMsgItem->ibd_Itemvalue;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$DayTripData["ChildMsg"] = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$InfantMsg = $this->infoBokunData_model->getBokunMetaList($information->ic_id, "InfantMsg");
|
|
|
|
|
if ($InfantMsg) {
|
|
|
|
|
foreach ($InfantMsg as $InfantMsgItem) {
|
|
|
|
|
$DayTripData["InfantMsg"] = $InfantMsgItem->ibd_Itemvalue;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$DayTripData["InfantMsg"] = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//有些接送没有对应的成人及儿童只有一个Other
|
|
|
|
|
$Other_Msg = $this->infoBokunData_model->getBokunMetaList($information->ic_id, "Other_Msg");
|
|
|
|
|
if ($Other_Msg) {
|
|
|
|
|
foreach ($Other_Msg as $Other_MsgItem) {
|
|
|
|
|
$DayTripData["Other_Msg"] = $Other_MsgItem->ibd_Itemvalue;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$DayTripData["Other_Msg"] = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$InfoData = new stdClass(); //传递用来计算的信息平台数据
|
|
|
|
|
$MinTravelers = get_meta($information->ic_id, 'meta_trippest_limitperson');
|
|
|
|
|
$InfoData->MinTravelers = $MinTravelers == null ? 0 : $MinTravelers;
|
|
|
|
|
|
|
|
|
|
$DayTripData["InfoData"] = $InfoData;
|
|
|
|
|
|
|
|
|
|
$linktour = get_meta($information->ic_id, 'meta_trainspread_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));
|
|
|
|
|
$DayTripData["TourData"] = $TourData;
|
|
|
|
|
//替换模板
|
|
|
|
|
$TS_DayTripContent = $ic_content; //因为需要替换,所以要转给零时变量。不然手机端替换完了,PC端就没有了。
|
|
|
|
|
$template_form_daydetail = $this->load->view($template_path . '-daydetail-form', $DayTripData, true); //模板内容
|
|
|
|
|
$TS_DayTripContent = str_replace('<!--@DAYTRIP-FORM@-->', $template_form_daydetail, $TS_DayTripContent);
|
|
|
|
|
$data["CUSTOMCONENT"] = $TS_DayTripContent;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
//一日游产品有自己的图片展示效果
|
|
|
|
|
if (!empty($meta_addon_picture)) {
|
|
|
|
|
if (!empty($meta_addon_picture_url)) {
|
|
|
|
|
$data["TOPBANNER"] = '<div class="banner ban-train"><a href="' . $meta_addon_picture_url . '">' . $bannerImg . ' </a>' . $ImgText . $template_TrainSearch . '</div>';
|
|
|
|
|
} else {
|
|
|
|
|
$data["TOPBANNER"] = '<div class="banner ban-train">' . $bannerImg . $ImgText . $template_TrainSearch . '</div>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//两种设备分别调用两种模板 ,静态化
|
|
|
|
|
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:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成静态文件
|
|
|
|
|
$html_path = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $information->ic_url;
|
|
|
|
|
$html_path = str_replace("\\", "/", $html_path);
|
|
|
|
|
if (substr($html_path, -1, 1) == '/') {
|
|
|
|
|
$html_path = $html_path . 'index.htm';
|
|
|
|
|
}
|
|
|
|
|
$html_path .= $html_path_ext;
|
|
|
|
|
create_folder_by_path(dirname($html_path));
|
|
|
|
|
file_put_contents($html_path, $template, LOCK_EX);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//通过内容找到第一张图片
|
|
|
|
|
|