diff --git a/application/config/config.php b/application/config/config.php
index ffa29776..275104a3 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -402,6 +402,7 @@ $config['site'] = array(
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'https://www.guilinchina.net', 'site_image_url' => '//images.guilinchina.net', 'site_authors' => array('vi', 'sfx'), 'site_user' => ',ycc,vi,bhn,hwt,thf,sfx,J,ZP,lyy,'),
'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'https://www.mybeijingchina.com', 'site_image_url' => '//images.mybeijingchina.com', 'site_authors' => array('vz', 'sfx'), 'site_user' => ',ycc,vz,bhn,hwt,thf,sfx,J,ZP,'),
'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'https://www.chinatravel.com', 'site_image_url' => '//images.chinatravel.com', 'site_authors' => array('ll', 'D'), 'site_user' => ',ycc,vz,bhn,J,wj,ll,D,ZP,lyy,'),
+ 'chinatravel' => array('site_code' => 'chinatravel', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'https://www.chinatravel.com', 'site_image_url' => '//images.chinatravel.com', 'site_authors' => array('ll', 'D'), 'site_user' => ',ycc,vz,bhn,J,wj,ll,D,ZP,lyy,'),
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'https://www.diychinatours.com', 'site_image_url' => '//images.chinahighlights.com', 'site_authors' => array('zzy', 'spt', 'yl', 'gavin'), 'site_user' => ',ycc,lmr, zyh,J,shw,B,zzy,WJJ,Tony,pcf,zxy,wst,wz,S,yyg,yxd,wj,sw,yl,hx,spt,wmr,syt,gavin,zm,htc,yqw,zl,sw,J,qqs,MGZ,'),
'cits' => array('site_code' => 'cits', 'site_id' => 10086, 'site_lgc' => '2', 'site_image_url' => '', 'site_url' => 'https://www.guilincits.com'),
'mct' => array('site_code' => 'mct', 'site_id' => 6, 'site_lgc' => '101', 'site_image_url' => '', 'site_url' => 'https://www.mychinatours.com', 'site_authors' => array('cj')),
@@ -712,6 +713,7 @@ $config['css_source_yz'] = 'https://www.yangtzeriver.org/css/css3/bootstrap/boot
$config['css_source_ah'] = 'https://www.asiahighlights.com/min/?f=/css/global.min.css,/js/bootstrap-datepicker/css/bootstrap-datepicker3.standalone.css,/css/basic.css,/css/homepage.css,/css/contact.css,/css/tailor-make.css,/css/tour.css,/css/tour-detail.css,/css/inquiry-form.css,/css/missing.css';
$config['css_source_gh'] = 'https://www.globalhighlights.com/css/global.css';
$config['css_source_ct'] = 'https://data.chinatravel.com/css/min.php?f=/css/css3/bootstrap/bootstrap.css,/css/css3/style.css,/css/css3/destination-details.css';
+$config['css_source_chinatravel'] = 'https://data.chinatravel.com/css/newcss3/base.css';
$config['css_source_ts'] = 'https://www.trainspread.com/css/bootstrap.min.css';
@@ -724,6 +726,7 @@ $config['cache']['vac']['cache_path'] = 'C:\VHD\Dropbox\wwwcache\viaje-a-china.c
$config['cache']['ru']['cache_path'] = 'C:\VHD\Dropbox\wwwcache\chinahighlights.ru';
$config['cache']['it']['cache_path'] = 'C:\VHD\Dropbox\wwwcache\viaggio-in-cina.it';
$config['cache']['ch']['cache_path'] = 'D:\wwwcache\chinahighlights.com';
+$config['cache']['chinatravel']['cache_path'] = 'D:\wwwcache\mobile-first\chinatravel.com';
//静态文件更新接口
$config['cache']['jp']['cache_api'] = '/info.php/information/update_cache/';
diff --git a/application/controllers/information.php b/application/controllers/information.php
index 266413fc..c3021a80 100644
--- a/application/controllers/information.php
+++ b/application/controllers/information.php
@@ -328,22 +328,33 @@ class Information extends CI_Controller
}
//获取移动优先的模板,如果有的话
- $mobile_first_template_path = 'mobile_first/' . $this->config->item('site_code');
- if (is_file(APPPATH . 'views/' . $mobile_first_template_path . EXT)) {
- $mobile_template_H1 = $this->call_mobile_template_H1($mobile_first_template_path, $data['information']->is_path, $data['information']->ic_author, $data['information']->ic_title, $data['information']->ic_photo);//H1模板替换
- $data['mobile_first_template'] = $this->load->view($mobile_first_template_path, '', TRUE);
- if (empty(get_meta($data['information']->ic_id, 'meta_product_code'))) {
- $data['mobile_first_template'] = str_replace('', $mobile_template_H1, $data['mobile_first_template']);
+ //增加判断站点,每个站点需要读取的模板不一样。 20210311 zp
+ if ($this->config->item('site_code')=="ch"){
+ $mobile_first_template_path = 'mobile_first/' . $this->config->item('site_code');
+ if (is_file(APPPATH . 'views/' . $mobile_first_template_path . EXT)) {
+ $mobile_template_H1 = $this->call_mobile_template_H1($mobile_first_template_path, $data['information']->is_path, $data['information']->ic_author, $data['information']->ic_title, $data['information']->ic_photo);//H1模板替换
+ $data['mobile_first_template'] = $this->load->view($mobile_first_template_path, '', TRUE);
+ if (empty(get_meta($data['information']->ic_id, 'meta_product_code'))) {
+ $data['mobile_first_template'] = str_replace('', $mobile_template_H1, $data['mobile_first_template']);
+ }
+ //主样式表,内联模式
+ $main_css_string=compress_css(GET_HTTP('https://proxy-data.chinahighlights.com/css/mobile-first.css'));
+ $data['mobile_first_template'] = str_replace('', '', $data['mobile_first_template']);
+ //查找是否有静态文件
+ if ($this->html_file_helper('find', $data['information']->ic_url)) {
+ $data['has_html_file'] = true;
+ }
+ } else {
+ $data['mobile_first_template'] = '没有找到移动模板';
}
- //主样式表,内联模式
- $main_css_string=compress_css(GET_HTTP('https://proxy-data.chinahighlights.com/css/mobile-first.css'));
- $data['mobile_first_template'] = str_replace('', '', $data['mobile_first_template']);
+ }
+
+ //CT判断是否生成静态文件
+ if ($this->config->item("site_code")=="chinatravel"){
//查找是否有静态文件
if ($this->html_file_helper('find', $data['information']->ic_url)) {
$data['has_html_file'] = true;
}
- } else {
- $data['mobile_first_template'] = '没有找到移动模板';
}
@@ -499,6 +510,12 @@ class Information extends CI_Controller
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
$this->make_www_cache('mobile', $information_new);
$this->make_www_cache('pc', $information_new);
+ }else if (strcasecmp($site_code, "chinatravel") == 0 && !empty($auto_update_cache)){
+ //chinatravel读取模板生成PC和移动优先文件
+ $information_new = $this->Information_model->Detail($this->input->post('is_id'));
+ $this->make_www_cache_ct('mobile', $information_new);
+ $this->make_www_cache_ct('pc', $information_new);
+
} else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) {
$update_info_log = $this->update_cache($ic_url);
} else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) {
@@ -578,9 +595,15 @@ class Information extends CI_Controller
return false;
}
if ($this->html_file_helper('find', $information->ic_url)) {
- //用于批量更新
- $this->make_www_cache('pc', $information);
- $this->make_www_cache('mobile', $information);
+ //用于批量更新,CH和chinatravel分开 ,20210317 zp
+ if ($this->config->item('site_code') == 'ch'){
+ $this->make_www_cache('pc', $information);
+ $this->make_www_cache('mobile', $information);
+ }else if ($this->config->item('site_code') == 'chinatravel'){
+ $this->make_www_cache_ct('pc', $information);
+ $this->make_www_cache_ct('mobile', $information);
+ }
+
echo json_encode(array('name' => 'yes', 'data' => '更新成功!'));
return true;
} else {
@@ -737,6 +760,225 @@ class Information extends CI_Controller
file_put_contents($html_path, $template, LOCK_EX);
}
+ /**
+ * @description: CT用的生成静态文件方法.有些内容的替换,CT这边不一样,需要单独处理 zp
+ * @param {type} $device='mobile' or 'pc'
+ * @return:
+ * @Date Changed:
+ */
+ function make_www_cache_ct($device,$information){
+ $data = array();
+ //先准备数据,CT采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。
+ $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;
+
+ /* 详细内容 */
+ $ic_content = $information->ic_content;
+ // /**替换详细内容里面的价格
+ /* 直接使用fetch来动态获取价格,这样不用替换标签,直接录标签
+ // * // 一日游价格标签, "" 或者 逗号后面是人数
+ // * //精华线路标签""
+ // */
+ // $ic_content = preg_replace_callback('//i',function($match){
+ // //处理一日游每次配备
+ // $matchItem = $match[1];
+ // return '';;
+ // },$ic_content);
+ // $ic_content = preg_replace_callback('//i',function($match){
+ // //处理精华线路每次配备
+ // $matchItem = $match[1];
+ // return '';;
+ // },$ic_content);
+
+ //$ic_content = '
'.$ic_content.'
'; //兼容拷贝过来的内容样式
+ $data["CUSTOMCONENT"]=$ic_content;
+
+
+
+
+
+ //非产品页面
+ $data["PRODUCTJS"]="";
+ if (empty(get_meta($information->ic_id, 'meta_product_code'))) {
+
+ } else {
+ // $data["PRODUCTJS"] = '';
+ }
+
+ //顶部全屏大图
+ $data["TOPBANNER"] ="";
+ $ImgText = ""; //图文字
+ $meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url');
+ if($device=='mobile'){//移动端读取移动大图
+ $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile');
+ $bannerImg = '
';
+ }else{
+ $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture');
+ $bannerImg = '
';
+ $meta_addon_picture_text = get_meta($information->ic_id,'meta_addon_picture_text');
+ if(!empty($meta_addon_picture_url)){
+ $ImgText = '';
+ }else{
+ $ImgText = ''.$meta_addon_picture_text.'
';
+ }
+ }
+ if (!empty($meta_addon_picture)) {
+ if(!empty($meta_addon_picture_url)){
+ $data["TOPBANNER"] = '';
+ }else{
+ $data["TOPBANNER"] = ''.$bannerImg.$ImgText.'
';
+ }
+ }
+
+ //顶部视频
+ $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"]='';
+ }
+
+
+ //主样式表,内联模式
+ if ($device=="mobile"){
+ $cssUrl = "http://202.103.68.104/css/newcss3/base.css";
+ }else{
+ $cssUrl="http://202.103.68.104/css/newcss3/base.css";
+ }
+ $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)) {
+ //引用方式
+ //$data["ADDONCSS"]= '';
+ //内联方式
+ $meta_addon_css_string=compress_css(GET_HTTP($meta_addon_css));
+ $data["ADDONCSS"]='';
+
+ }
+
+ //总JS:为了方便以后js好维护,必须的把一些公用的JS统计到一个文件。但是又不是所有页面都需要调用这个基础js,所以必须在这里进行判断
+ $addBaseJs = false;
+ $addonJs = "";
+ $meta_ct_page_price = get_meta($information->ic_id, 'meta_ct_page_price'); //是否包含价格
+ $meta_ct_page_type = get_meta($information->ic_id, 'meta_ct_page_type'); //页面类型
+ if ($meta_ct_page_price=="yes"){
+ $addBaseJs=true;
+ }else if ($meta_ct_page_type!==false && $meta_ct_page_type!=""){
+ $addBaseJs=true;
+ }
+
+ if ($addBaseJs){
+ $addonJs='';
+ }
+ /// ----- 总JS判断完成-----
+
+ //额外js
+ $data["ADDONJS"]="";
+ $meta_addon_js = get_meta($information->ic_id, 'meta_addon_js');
+ if (!empty($meta_addon_js)) {
+ $addonJs .='';
+ }
+ //价格js
+ if ($meta_ct_page_price=="yes"){
+ $addonJs .= '';
+ }
+
+ //列表js
+ if ($meta_ct_page_type=="daytripindex" || $meta_ct_page_type=="tourindex"){
+ $addonJs .= '';
+ }
+
+ $data["ADDONJS"]=$addonJs;
+ //社媒分享图片
+ $data["OGIMAGE"]="";
+ if (!empty($information->ic_photo)) {
+ $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo;
+ $data["OGIMAGE"]= '';
+ }
+
+ //结构化标签
+ $data["ConstructionCode"]="";
+ $meta_construction_code = get_meta($information->ic_id,'meta_construction_code');
+ if (!empty($meta_construction_code)){
+ $data["ConstructionCode"]=$meta_construction_code;
+ }
+
+ //页面传递参数
+ $passParam = "";
+ if ($meta_ct_page_type=="daytripindex" || $meta_ct_page_type=="tourindex"){
+ //产品首页
+ $meta_ct_page_value = get_meta($information->ic_id,'meta_ct_page_value');
+ $passParam .= '';
+
+ //加信息平台的is_id
+ $passParam .= '';
+ }
+ $data["passParam"] = $passParam;
+
+
+
+ //两种模板
+ 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);
+
+
+
+
+
+ // //Google广告代码
+ // if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) {
+ // $template = str_replace('', '', $template);
+ // }
+ // if (!empty(get_meta($information->ic_id, 'meta_google_ad_article'))) {
+ // $in_article_google=$this->load->view($template_path.'-google-ad', false,true);
+ // $template = str_replace('', $in_article_google, $template);
+ // }
+
+ // //设置图片尺寸
+ // //$template=$this->html_optimize_lib->set_image_size($template);
+ // // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm
+
+
+ }
+
function call_mobile_template_H1($mobile_first_template_path, $is_path, $ic_author, $ic_title, $ic_photo)
{
$data['infocategory'] = $this->Information_model->get_detail_by_path($is_path, 1);//信息所属分类,获取信息顶级节点内容
diff --git a/application/controllers/welcome.php b/application/controllers/welcome.php
index edbb7e23..1d62ae10 100644
--- a/application/controllers/welcome.php
+++ b/application/controllers/welcome.php
@@ -416,4 +416,18 @@ class Welcome extends CI_Controller {
$this->load->view('bootstrap3/recommendlist', $data);
}
+ /**
+ * @description: 用于生成一个特殊的根结点is_level和is_sort都为0,CT移动优先项目用
+ * @param {type}
+ * @return:
+ * @Date Changed:
+ */
+ public function AddRootNote(){
+ $this->InfoContents_model->Add('', 'NewRootNote', 'root', 'NewRootNote', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', '', '', 0,
+ '','');
+ $this->InfoStructures_model->AddRootNote($this->InfoContents_model->insert_id);
+ $is_id = $this->InfoStructures_model->insert_id;
+ redirect(site_url('information/edit/' . $is_id));
+ }
+
}
diff --git a/application/helpers/info_helper.php b/application/helpers/info_helper.php
index 59801a06..f68bfcee 100644
--- a/application/helpers/info_helper.php
+++ b/application/helpers/info_helper.php
@@ -103,7 +103,7 @@ function is_mobile_first()
{
$CI = &get_instance();
$sitecode = $CI->config->item('site_code');
- if ($sitecode == 'ch' || $sitecode == 'ah') {
+ if ($sitecode == 'ch' || $sitecode == 'ah' || $sitecode='chinatravel') {
return true;
} else {
return false;
diff --git a/application/models/infoStructures_model.php b/application/models/infoStructures_model.php
index e86e796a..ea567fd5 100644
--- a/application/models/infoStructures_model.php
+++ b/application/models/infoStructures_model.php
@@ -221,4 +221,30 @@ class InfoStructures_model extends CI_Model
}
}
+ /**
+ * @description: 用于生成一个特殊的根结点is_level和is_sort都为0,CT移动优先项目用
+ * @param {type}
+ * @return:
+ * @Date Changed:
+ */
+ public function AddRootNote($is_ic_id){
+ $sql = "INSERT INTO infoStructures \n"
+ . " ( \n"
+ . " is_parent_id, is_path, is_level, is_sort, is_sitecode, is_datetime, is_ic_id \n"
+ . " ) \n"
+ . "VALUES \n"
+ . " ( \n"
+ . " ?, ?, ?, ?, ?, getdate(), ? \n"
+ . " )";
+ $query = $this->HT->query($sql, array(-99, '', 0, 0, $this->config->item('site_code'), $is_ic_id));
+ $this->insert_id = $this->HT->last_id('infoStructures');
+ //把自己的ID加到path上
+ $set_sql = "UPDATE infoStructures \n"
+ . "SET is_path = is_path + CONVERT(VARCHAR(200), is_id) + ',' \n"
+ . "WHERE is_id = ?";
+ $query = $this->HT->query($set_sql, array($this->insert_id));
+
+ return $this->insert_id;
+ }
+
}
\ No newline at end of file
diff --git a/application/third_party/ctmobilefirst/controllers/api.php b/application/third_party/ctmobilefirst/controllers/api.php
new file mode 100644
index 00000000..ae3cf24b
--- /dev/null
+++ b/application/third_party/ctmobilefirst/controllers/api.php
@@ -0,0 +1,165 @@
+load->model('api_model');
+ $this->load->library('Currency');
+
+ }
+
+ public function index()
+ {
+ echo("<1>api");
+
+ }
+
+ /**
+ * @description: 返回一日游价格
+ * @param {*} $returntype
+ * @return {*}
+ * @Date Changed:
+ */
+ public function getDaytripsPrice(){
+ if (isset($_GET["param"])){
+ $param = $_GET["param"];
+ if (strpos($param,",")!== false){
+ $pagecode = explode(",",$param)[0];
+ $personnum=explode(",",$param)[1];
+ }else{
+ $pagecode = $param;
+ $personnum=2;
+ }
+ if (isset($_GET["personnum"])){
+ $personnum=$_GET["personnum"];
+ }else{
+ $personnum=2;
+ }
+ $result["status"]="ok";
+ $price = $this->api_model->getDaytripsPrice($pagecode,$personnum);
+ $PKP_AdultSpecialPrice = $price->PKP_AdultSpecialPrice;
+ $PKP_AdultPrice = $price->PKP_AdultPrice;
+ if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
+ $result["price"] = $this->currency->convert_moneny_by_char($PKP_AdultSpecialPrice,"USD");
+ }else{
+ $result["price"] = $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
+ }
+
+ echo json_encode($result);
+ }else {
+ $result["status"]="no param";
+ echo json_encode($result);
+ }
+
+ }
+
+
+ /**
+ * @description: 获取精华线路价格(2人等)
+ * @param {*}
+ * @return {*}
+ * @Date Changed:
+ */
+ public function getTourPrice(){
+ if (isset($_GET["param"])){
+ $param = $_GET["param"];
+ $result["status"]="ok";
+ $price = $this->api_model->getTourPrice($param);
+ $result["pricecn"]=$price;
+ if (is_numeric($price)){
+ $price = $this->currency->calc_show_price($this->currency->convert_moneny_by_char($price,"USD"));
+ }else{
+ $price = "0";
+ }
+
+ $result["price"] = $price;
+ echo json_encode($result);
+ }else{
+ $result["status"]="no param";
+ echo json_encode($result);
+ }
+ }
+
+
+ /**
+ * @description: 获取HT及信息平台的一日游列表数据
+ * @param {*}
+ * @return {*}
+ * @Date Changed:
+ */
+ public function getDaytripList(){
+ //先处理传递过来的参数(逗号隔开两个参数的格式:城市名称,父ID)
+ $whereHT="";
+ $whereInfo="";
+ if (isset($_GET["param"])){
+ $param = str_replace("'","''",$_GET["param"]);
+ if (strpos($param,",")!== false){
+ $city = explode(",",$param)[0];
+ $whereHT = " and (CII2_Name ='".$city."') ";
+ $parentid = explode(",",$param)[1];
+ $whereInfo = " and is_parent_id = '".$parentid."'";
+ }else{
+ $whereHT = " and (CII2_Name ='".$param."') ";
+ $whereInfo = "";
+ }
+ }
+
+
+ $list = $this->api_model->getDaytripList($whereHT,$whereInfo);
+
+ foreach ($list as $row) {
+ //获取价格
+ $price = $this->api_model->getDaytripsPrice($row->code,2);
+ if ($price!=null){
+ $PKP_AdultSpecialPrice = $price->PKP_AdultSpecialPrice;
+ $PKP_AdultPrice = $price->PKP_AdultPrice;
+ if ($PKP_AdultPrice!=$PKP_AdultSpecialPrice && $PKP_AdultSpecialPrice>0){
+ $addPrice = $this->currency->convert_moneny_by_char($PKP_AdultSpecialPrice,"USD");
+ }else{
+ $addPrice= $this->currency->convert_moneny_by_char($PKP_AdultPrice,"USD");
+ }
+ }else{
+ $addPrice=0;
+ }
+
+ //URL
+ if (empty($row->url)){
+ $str_Url = "/china-day-trips/".strtolower($row->code).".htm";
+ $row->url = $str_Url; //更新url
+ }
+
+
+ //图片
+ $imageCdn = "//images.chinatravel.com";//有些HT绑定图片需要加cdn
+ if (!empty($row->pic1)){
+ if (strpos($row->pic1,"chinatravel.com")!== false){
+ $picurl=$row->pic1;
+ }else{
+ $picurl = $imageCdn.$row->pic1;
+ }
+
+ }else if(!empty($row->pic2)){
+ if (strpos($row->pic2,"chinatravel.com")!== false){
+ $picurl=$row->pic2;
+ }else{
+ $picurl = $imageCdn.$row->pic2;
+ }
+ }else{
+ $picurl="//data.chinatravel.com/images/loading2.gif";
+ }
+
+ $row->price = $addPrice; //新增价格属性
+ $row->pic =$picurl; //图片地址
+
+ }
+
+ echo json_encode($list);
+ }
+
+}
+
+/* End of file Api.php */
diff --git a/application/third_party/ctmobilefirst/libraries/Currency.php b/application/third_party/ctmobilefirst/libraries/Currency.php
new file mode 100644
index 00000000..ee25607a
--- /dev/null
+++ b/application/third_party/ctmobilefirst/libraries/Currency.php
@@ -0,0 +1,204 @@
+CI = & get_instance();
+ log_message('debug', "Language Tags Class Initialized");
+ $this->GetCurrencyRate();
+ }
+
+ function GetCurrencyRate() {
+ $this->HT = $this->CI->load->database('HT', TRUE);
+ $sql = "SELECT CRI_BuyIn / 100.00 AS tmpExRate, \n"
+ . " CRI_Code \n"
+ . "FROM tourmanager.dbo.CurrencyRateInfo \n"
+ . "WHERE CRI_Code IN ('USD', 'EUR', 'RUB') \n"
+ . " AND GETDATE() BETWEEN CRI_Start AND CRI_Stop";
+ $query = $this->HT->query($sql);
+ foreach ($query->result() as $item) {
+ switch ($item->CRI_Code) {
+ case 'USD':
+ $this->USD_Rate = $item->tmpExRate;
+ break;
+ case 'EUR':
+ $this->EUR_Rate = $item->tmpExRate;
+ break;
+ case 'RUB':
+ $this->RUB_Rate = $item->tmpExRate;
+ break;
+ }
+ }
+// echo $this->USD_Rate . '
';
+// echo $this->EUR_Rate . '
';
+// echo $this->RUB_Rate . '
';
+ return $query->result();
+ }
+
+ //根据人民币转换成站点对应的货币
+ public function GetSiteMoney($RMB) {
+ if (!is_numeric($RMB))
+ {
+ return $RMB;
+ }
+
+ $result = $RMB;
+ if (is_numeric($RMB)) {
+ switch (CONST_SITE_CURRENCY) {
+ case 'USD':
+ $result = $RMB / $this->USD_Rate;
+ break;
+ case 'EUR':
+ $result = $RMB / $this->EUR_Rate;
+ break;
+ case 'RUB':
+ $result = $RMB / $this->RUB_Rate;
+ break;
+ }
+ }
+ return ceil($result);
+ }
+
+ //把美金转换为人民币
+ public function get_USD_RMB_SUM($USD) {
+
+ if (!is_numeric($USD))return $USD;
+ $result = $USD;
+ $result = $USD * $this->USD_Rate;
+ return ceil($result);
+ }
+
+ /**
+ * 返回站点的汇率。
+ *
+ * @author lmr
+ */
+ public function get_site_currencyrate() {
+ switch (CONST_SITE_CURRENCY) {
+ case 'USD':
+ return $this->USD_Rate;
+ case 'EUR':
+ return $this->EUR_Rate;
+ case 'RUB':
+ return $this->RUB_Rate;
+ default:
+ return 1;
+ }
+ }
+
+ /**
+ * 返回带money_char的价格。
+ *
+ * @param $money Int 价格.
+ * @return String 带货币符号的价格。
+ */
+ public function get_money_char($money='') {
+
+ switch (CONST_SITE_CODE) {
+ case 'JP':
+ return $money.'元';
+ case 'GM':
+ return '€'.$money;
+ case 'VC':
+ return $money.'€';
+ case 'VAC':
+ return '$'.$money;
+ case 'RU':
+ return '$'.$money;
+ case 'IT':
+ return '€'.$money;
+ case 'SHT':
+ return '$'.$money;
+ default:
+ return '$'.$money;
+ }
+ }
+
+ /**
+ * 返回带money_char的价格。
+ *
+ * @param $money Int 价格.
+ * @return String 带货币符号的价格。
+ */
+ public function get_site_money_with_char($money='') {
+ return $this->get_money_char($this->GetSiteMoney($money));
+ }
+
+
+ /**
+ * RMB换算成指定货币。
+ * @param int money RMB
+ * @param string char 货币代号:usd,eur
+ * @return int 换算价格
+ */
+ public function convert_moneny_by_char($money,$char='')
+ {
+ switch (strtolower($char))
+ {
+ case 'usd':
+ return ceil($money/$this->USD_Rate);
+ case 'eur':
+ return ceil($money/$this->EUR_Rate);
+ }
+ return $money;
+ }
+
+ /**
+ * 尾数取"9"的定价规则
+ * 在正负误差值小于或等于16的前提下,
+ * 保证展示价格的个位数和十位数统一取"99"
+ * 当展示价格的个位数和十位数取"99"的正负误差大于16时,
+ * 通过四舍五入加价实现个位数取"9"
+ * 详细规则见GitLab issue #12 统一网前展示价格的标准
+ */
+ public function calc_show_price($value=0) {
+ if (empty($value)) return 0;
+ if (!is_numeric($value)) return $value;
+
+ $val_len = strlen($value);
+
+ if ($val_len == 1) return 9;
+
+ $discount = 16;
+ $val_pow = pow(10, $val_len - 1);
+
+ $min_val = $val_pow - 1;
+ $max_val = $min_val + $val_pow;
+ $max_diff = abs($value - $max_val);
+ $min_diff = abs($value - $min_val);
+
+ if (min($max_diff, $min_diff) > $discount) {
+ $calc_val = floor($value / 10) * 10 + 9;
+ } else {
+ $calc_val = $max_diff > $min_diff ? $min_val : $max_val;
+ }
+ return $calc_val;
+ }
+
+ /**
+ * 获取设置的信用卡卡费
+ */
+ public function cardfee(){
+ $sql = "SELECT TOP 1 * FROM dbo.SystemSettingInfo WHERE (SSI_Code = 1021001)";
+
+ $this->HT = $this->CI->load->database('HT', TRUE);
+ $query = $this->HT->query($sql);
+ $row = $query->row();
+ if (isset($row)){
+ return $row->SSI_UserValue;
+ }else{
+ return 0;
+ }
+
+ }
+}
diff --git a/application/third_party/ctmobilefirst/models/api_model.php b/application/third_party/ctmobilefirst/models/api_model.php
new file mode 100644
index 00000000..11d5b39a
--- /dev/null
+++ b/application/third_party/ctmobilefirst/models/api_model.php
@@ -0,0 +1,276 @@
+HT = $this->load->database('HT', TRUE);
+
+ }
+
+ var $dei_sn = 17; //组别ID
+ var $CTLGC = 104; //语种
+
+ /**
+ * @description: 根据一日游code获取对应人数的成人价格
+ * @param {string} $pagecode 线路代码
+ * @param int $personnum 人数
+ * @return:
+ */
+ function getDaytripsPrice($pagcode, $personnum)
+ {
+ $sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
+ ,PAG_DefaultVEI_SN
+ from BIZ_PackagePrice
+ inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
+ and BIZ_PackagePrice.PKP_VEI_SN = BIZ_PackageInfo.PAG_DefaultVEI_SN
+ where (BIZ_PackageInfo.PAG_Code = ?) AND (pag_dei_sn= ? )
+ and ? between PKP_PersonStart and PKP_PersonStop and CONVERT(varchar(12),getdate(),111) between pkp_validdate and pkp_invaliddate
+ order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc,PKP_PriceGrade ";
+ $param = array($pagcode,$this->dei_sn, $personnum);
+
+ $query = $this->HT->query($sql, $param);
+ if ($query->num_rows() > 0) {
+ return $query->row();
+ } else {
+ //'第二种有默认供应商但是没有当前日期价格的时候
+ $sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
+ ,PAG_DefaultVEI_SN
+ from BIZ_PackagePrice
+ inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
+ and BIZ_PackagePrice.PKP_VEI_SN = BIZ_PackageInfo.PAG_DefaultVEI_SN
+ where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
+ and ? between PKP_PersonStart and PKP_PersonStop
+ order by pkp_invaliddate desc,PKP_PriceGrade ";
+ $query = $this->HT->query($sql, $param);
+ if ($query->num_rows() > 0) {
+ return $query->row();
+ }else{
+ //'第三种没有默认供应商但是有当前日期价格的时候
+ $sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
+ ,PAG_DefaultVEI_SN
+ from BIZ_PackagePrice
+ inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
+ where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
+ and ? between PKP_PersonStart and PKP_PersonStop and CONVERT(varchar(12),getdate(),111) between pkp_validdate and pkp_invaliddate
+ order by isnull( BIZ_PackageInfo.PAG_DefaultVEI_SN,0) desc,PKP_PriceGrade ";
+ $query = $this->HT->query($sql, $param);
+ if ($query->num_rows() > 0) {
+ return $query->row();
+ }else{
+ //'第四种无默认供应商无当前日期价格
+ $sql = "select top 1 isnull(PKP_AdultPrice,0) as PKP_AdultPrice,isnull(PKP_AdultSpecialPrice,0) as PKP_AdultSpecialPrice
+ ,PAG_DefaultVEI_SN
+ from BIZ_PackagePrice
+ inner join BIZ_PackageInfo on BIZ_PackageInfo.PAG_SN = BIZ_PackagePrice.PKP_PAG_SN
+ where (BIZ_PackageInfo.PAG_Code = ? ) AND (pag_dei_sn= ? )
+ and ? between PKP_PersonStart and PKP_PersonStop
+ order by pkp_invaliddate desc,PKP_PriceGrade ";
+ if ($query->num_rows() > 0) {
+ return $query->row();
+ }else {
+ return null;
+ }
+ }
+ }
+ }
+
+ }
+
+ /**
+ * @description: 获取精华线路价格,2人等
+ * @param {*}
+ * @return {*}
+ * @Date Changed:
+ */
+ function getTourPrice($cli_no){
+ $CLI_SN = "";
+ $reust = "";
+ //'新的GP没有设置以前的2-5人等价格,导致读不出价格。把Gp价格放前面计算
+ $sql = "select top 1 CLI_SN,CLI_PackageClass from CustomerLineInfo
+ where CLI_NO=? and CLI_State=1005004
+ AND (CLI_DEI_SN= ? )";
+ $query = $this->HT->query($sql,array($cli_no,$this->dei_sn));
+ if (!$query->num_rows()>0){
+ return null;
+ }else{
+ $row = $query->row();
+ if (isset($row)){
+ $CLI_SN = $row->CLI_SN;
+ }
+
+ //'获取线路是否有travelbuddy,也就是有固定的发团日期
+ $fut_sql = "SELECT count(*) as CountBuddy FROM FixedGroupDate WHERE FGD_CLI_SN='".$CLI_SN."'";
+ $futQuery = $this->HT->query($fut_sql);
+ $futrow = $futQuery->row();
+ $fut_CountBuddy = $futrow->CountBuddy;
+
+ if ($fut_CountBuddy>0){
+ //读取GP价格
+ $gpSql ="SELECT TOP 1 FGD_AdultPrice,FGD_Departure,
+ isnull(FGD_ProAdultPrice,0) as FGD_ProAdultPrice
+ FROM FixedGroupDate
+ WHERE (FGD_Departure >= GETDATE())
+ AND (FGD_CLI_SN = ".$CLI_SN.") AND (FGD_State = 1) ORDER BY FGD_AdultPrice";
+ $gpquery = $this->HT->query($gpSql);
+ if ($gpquery->num_rows()>0){
+ $gpRow = $gpquery->row();
+ $FGD_AdultPrice = $gpRow->FGD_AdultPrice;
+ $FGD_ProAdultPrice = $gpRow->FGD_ProAdultPrice;
+ if ($FGD_ProAdultPrice>0){
+ $reust = $FGD_ProAdultPrice; //促销价
+ }else{
+ $reust=$FGD_AdultPrice;
+ }
+ }
+
+ }else {
+ //普通线路价格
+ $sql = "select top 1
+ CLI_SN,CLP_TwoToFiveAdultPrice,CLI_PackageClass
+ FROM CustomerLineInfo INNER JOIN
+ CustomerLinePrice ON CustomerLineInfo.CLI_SN = CustomerLinePrice.CLP_CLI_SN INNER JOIN
+ CustomerLineInfo2 ON CustomerLineInfo.CLI_SN = CustomerLineInfo2.CLI2_CLI_SN
+ where CLI_SN= ? and CLI2_LGC=? and (CLP_Area=1 or CLP_Area=2)
+ and CLI_State = 1005004 ORDER BY CLP_TwoToFiveAdultPrice";
+ $query = $this->HT->query($sql,array($CLI_SN,$this->CTLGC));
+ if ($query->num_rows()>0){
+ $reust = $query->row()->CLP_TwoToFiveAdultPrice;
+ }
+
+ }
+ }
+
+ return $reust;
+ }
+
+
+ /**
+ * @description: 一日游列表,包含信息平台和HT
+ * @param {*} $whereHT HT的查询条件
+ * @param {*} $whereInfo 信息平台的查询条件
+ * @return {*}
+ * @Date Changed:
+ */
+ function getDaytripList($whereHT="",$whereInfo=""){
+ $sql = "select * from(
+
+ select * from(
+ SELECT p2.PAG2_Name as title
+ ,P1.PAG_Code as code
+ ,'' as url
+ ,isnull(p2.PAG2_ImageURL,'') as pic1
+ ,isnull((select top 1 PAP_ImageURL from BIZ_PackagePic where PAP_PII_SN=p2.PAG2_PII_SN),'') as pic2
+ ,'2' as sortby
+ FROM dbo.BIZ_PackageInfo P1
+ INNER JOIN dbo.BIZ_PackageInfo2 p2 ON P1.PAG_SN = p2.PAG2_PAG_SN
+ INNER JOIN dbo.CItyInfo2 ON P1.PAG_CII_SN = dbo.CItyInfo2.CII2_CII_SN AND dbo.CItyInfo2.CII2_LGC = 1
+ WHERE (p2.PAG2_LGC = 104)
+ AND (p1.pag_dei_sn = 17)
+ AND (p2.PAG2_Check = 2)
+ AND (isnull(P1.DeleteFlag,0) <>1) ".$whereHT."
+ ) Tmp
+
+ UNION ALL
+
+ SELECT * from (
+ select ic_url_title as title
+ ,(select top 1 im_value from infoMetas where im_key='meta_product_code' and im_ic_id=ic_id) as code
+ ,ic_url as url , ic_photo as pic1
+ ,(select top 1 im_value from infoMetas where im_key='meta_addon_picture_mobile' and im_ic_id=ic_id) as pic2
+ ,'1' as sortby
+ FROM dbo.infoContents
+ inner join infoStructures on ic_id=is_ic_id
+ WHERE is_sitecode='chinatravel' ".$whereInfo."
+ --and ic_status=1
+ ) as t
+ ) tball
+ where 1=1
+ ORDER BY tball.sortBy ASC
+ ";
+
+ $query = $this->HT->query($sql);
+ return $query->result();
+ }
+
+
+ /**
+ * @description: HT获取一日游列表
+ * @param {*} $city 一日游城市 ,默认必须有城市,不然太多
+ * @param {*} $where 其它条件
+ * @return {*}
+ * @Date Changed:
+ */
+ function getDaytripListHT($city="beijing",$where=""){
+ $sql = " select * from(
+ SELECT p2.PAG2_Name
+ ,p2.PAG2_Intro
+ ,P1.PAG_NeedTime
+ ,P1.PAG_SN
+ ,P1.PAG_Leve
+ ,p2.PAG2_Order
+ ,P1.PAG_Code
+ ,p2.PAG2_Attraction
+ ,CItyInfo2.CII2_Name
+ ,isnull((select top 1 PAP_ImageURL from BIZ_PackagePic where PAP_PII_SN=p2.PAG2_PII_SN),'') as NewListImage
+ ,isnull(p2.PAG2_ImageURL,'') as NewListImage2
+ ,dbo.GetFullPathByPII_SN(p2.PAG2_PII_SN, 2) AS picpath
+ ,p2.PAG2_Title
+ ,p1.PAG_Type
+ ,pag2_summary
+ FROM dbo.BIZ_PackageInfo P1
+ INNER JOIN dbo.BIZ_PackageInfo2 p2 ON P1.PAG_SN = p2.PAG2_PAG_SN
+ INNER JOIN dbo.CItyInfo2 ON P1.PAG_CII_SN = dbo.CItyInfo2.CII2_CII_SN AND dbo.CItyInfo2.CII2_LGC = 1
+ WHERE (p2.PAG2_LGC = ?)
+ AND (p1.pag_dei_sn = ?)
+ AND (p2.PAG2_Check = 2)
+ AND (isnull(P1.DeleteFlag,0) <>1)
+ ) Tmp
+ where 1=1 ";
+ if ($city!=""){
+ $sql .= " AND (CII2_Name ='".$city."')";
+ }
+ // $sql .= "and PAG_Code in ('SHALC-1','SHALC-7')";
+ $sql .= " order by isnull(pag2_order,0) desc,pag_code ";
+ // echo ($sql);
+ $param = array($this->CTLGC,$this->dei_sn);
+ $query = $this->HT->query($sql,$param);
+ return $query->result();
+
+ }
+
+
+ /**
+ * @description: 获取子类信息列表
+ * @param {type} $parentid,父类的Id
+ * @return:
+ * @Date Changed:
+ */
+ function getGuideList($parentid){
+ if ($parentid < 0 ) {
+ return null;
+ }
+
+
+ $sql = "
+ SELECT is_sort,ic_url,ic_url_title,ic_title, substring(convert(nvarchar(2000),ic_content),0,1000) as ic_summary,ic_photo
+ ,(select top 1 im_value from infoMetas where im_key='meta_addon_picture' and im_ic_id=ic_id) as pic2
+ FROM dbo.infoContents
+ inner join infoStructures on ic_id=is_ic_id
+ WHERE is_sitecode='chinatravel'
+ and is_parent_id = ?
+
+ ";
+ //and ic_status=1
+
+ $qurey = $this->HT->query($sql,array($parentid));
+ return $qurey->result();
+ }
+
+}
+
+/* End of file Api_model.php */
diff --git a/application/views/bootstrap3/information_edit.php b/application/views/bootstrap3/information_edit.php
index 05514eb6..1aae2bfe 100644
--- a/application/views/bootstrap3/information_edit.php
+++ b/application/views/bootstrap3/information_edit.php
@@ -849,6 +849,94 @@
value="ic_id, 'meta_addon_picture_url'); ?>"/>
+ ic_sitecode == 'chinatravel') {
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2163,7 +2251,7 @@
忽略URL重复
- config->item('site_code'), array('ch', 'cht', 'gm', 'ah', 'ct'))) { ?>
+ config->item('site_code'), array('ch', 'cht', 'gm', 'ah', 'ct','chinatravel'))) { ?>