merge master

feature/trippest
lyt 7 years ago
commit 50222a91d2

5
.gitignore vendored

@ -1,9 +1,12 @@
.idea
.phpintel
.svn/*
*/logs/log*
/web.config
/kcfinder/upload/*
/kcfinder/cache/*
*/cache/*
/author/document/*
*/statement_files/*
*/paypal_activities/*
/author/document/*
/application/libraries/composer

@ -563,42 +563,6 @@ $config['InfoType_citizen'] = array(
'产品' => 'product'
);
//可选模板
$config['templates'] = array(
'通用内容模板' => 'guide_info_detail',
'城市-列表模板' => 'city_info_list',
'城市-首页模板' => 'city_info_index',
'城市-首页模板[简]' => 'city_info_s_index',
'城市-景点列表模板' => 'city_info_attractions_list',
'城市-景点列表模板[简]' => 'city_info_s_attractions_list',
'城市-景点详细模板' => 'city_attractions',
'城市-特色产品模板' => 'city_info_diytour',
'城市-一线城市首页' => 'city_info_index_one',
'省份-首页' => "area_info_index",
'省份-列表模板' => 'area_info_list',
'省份-通用内容模板' => 'area_info_detail',
'文化模板 [列表式]' => "culture_info_detail_just_list",
'文化模板 [单页式]' => 'culture_info_detail_one_page',
'文化模板 [导航式]' => 'culture_info_detail_with_category',
'信息专题模板' => 'guide_top_series',
'火车专题模板' => 'train_top_series',
'旅游攻略' => 'travel_story',
'节庆-详细模板' => 'festival_detail',
'节庆-列表模板' => 'festival_list',
'大使馆-详细页' => 'embassy_info_detail',
'城市-线路详细' => 'city_circuit',
'专题模板(大)' => 'guide_big_series',
'[国际站]响应式-空白模板' => 'r_tpl_empty',
'[国际站]响应式-专题首页' => 'r_tpl_empty_navi0',
'[国际站]响应式-专题列表页' => 'r_tpl_empty_navi1',
'[国际站]响应式-专题列表页+' => 'r_tpl_empty_navi1p',
'[国际站]响应式-专题详细页' => 'r_tpl_empty_navi2',
'[-------已废弃-------]空白模板' => 'tpl_empty',
'[-------已废弃-------]专题-温暖' => 'warm',
'[-------已废弃-------]专题-庄重' => 'solemn',
'[-------已废弃-------]专题-节庆' => 'festival',
'[-------已废弃-------]专题-线路促销' => 'promotion_tour'
);
//可选模板
$config['templates_i'] = array(
@ -607,7 +571,9 @@ $config['templates_i'] = array(
'[城市]C首页模板' => 'city_info_index',
'[城市]C景点列表模板' => 'city_info_attractions_list',
'[城市]C景点详细模板' => 'city_attractions',
'[专题]T0空白模板' => 'r_tpl_empty',
'[专题]T0空白' => 'r_tpl_empty',
'[专题]T0空白HTML构建工具' => 'r_empty_container',
'[专题]T0空白H1+面包屑)' => 'r_empty2',
'----------二级目录----------' => '------2------',
'[专题]T2首页' => 'r_t2_index',
'[专题]T2详细' => 'r_t2_detail',
@ -651,6 +617,7 @@ $config['area_type'] = array(
'大使馆' => 'y',
'公民游' => 'z',
'交换链接' => 'k',
'首页' => 'h',
'FAQ' => 'q'
);
@ -696,21 +663,22 @@ $config['check_access'] = TRUE;
$config['access_super_manage'] = array('ycc', 'lmr');
//编辑器预览样式路径
$config['css_source_cht'] = '<link href="http://data.chinahighlights.com/css/min.php?f=/public/css/global.min.css,/css/festival-detail.css" rel="stylesheet">';
$config['css_source_cht'] = '<link href="https://data.chinahighlights.com/css/min.php?f=/public/css/global.min.css,/css/festival-detail.css" rel="stylesheet">';
$config['css_source_gm'] = '<link rel="stylesheet" href="http://data.chinarundreisen.com/public/pkg/css/baselAlRkXMnl750806T065919409Z.css">';
$config['css_source_gm'] = '<link rel="stylesheet" href="//data.chinarundreisen.com/public/pkg/css/baselAlRkXMnl750806T065919409Z.css">';
$config['css_source_vc'] = '<link href="http://data.voyageschine.com/information-view/tools/min/?v=20150611&amp;f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-vc.css" rel="stylesheet" type="text/css">';
$config['css_source_vac'] = '<link href="http://data.viaje-a-china.com/information-view/tools/min/?v=20150611&amp;f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-vac.css" rel="stylesheet" type="text/css">';
$config['css_source_ru'] = '<link href="http://data.chinahighlights.ru/information-view/tools/min/?v=20150611&amp;f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-ru.css" rel="stylesheet" type="text/css">';
$config['css_source_it'] = '<link href="http://data.viaggio-in-cina.it/information-view/tools/min/?v=20150611&amp;f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-it.css" rel="stylesheet" type="text/css">';
$config['css_source_jp'] = '<link href="http://data.arachina.com/information-view/tools/min/?v=20150611&amp;f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-jp.css" rel="stylesheet" type="text/css">';
$config['css_source_vc'] = '<link href="//data.voyageschine.com/information-view/tools/min/?v=20150611&amp;f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-vc.css" rel="stylesheet" type="text/css">';
$config['css_source_vac'] = '<link href="//data.viaje-a-china.com/information-view/tools/min/?v=20150611&amp;f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-vac.css" rel="stylesheet" type="text/css">';
$config['css_source_ru'] = '<link href="//data.chinahighlights.ru/information-view/tools/min/?v=20150611&amp;f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-ru.css" rel="stylesheet" type="text/css">';
$config['css_source_it'] = '<link href="//data.viaggio-in-cina.it/information-view/tools/min/?v=20150611&amp;f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-it.css" rel="stylesheet" type="text/css">';
$config['css_source_jp'] = '<link href="//data.arachina.com/information-view/tools/min/?v=20150611&amp;f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-jp.css" rel="stylesheet" type="text/css">';
$config['css_source_sht'] = '<link href="http://www.shanghaihighlights.com/css/css3/bootstrap/bootstrap.css" rel="stylesheet"><link href="http://www.shanghaihighlights.com/css/css3/style.css" rel="stylesheet"><link href="http://www.shanghaihighlights.com/css/css3/facts.css" rel="stylesheet">';
$config['css_source_gl'] = '<link href="http://www.guilinchina.net/css/css3/bootstrap/bootstrap.css" rel="stylesheet"><link href="http://www.guilinchina.net/css/css3/style.css" rel="stylesheet"><link href="http://www.guilinchina.net/css/css3/destination.css" rel="stylesheet">';
$config['css_source_tbt'] = '<link href="http://www.tibetguru.com/css/style.css" rel="stylesheet"><link href="http://www.tibetguru.com/css/guide.css" rel="stylesheet">';
$config['css_source_mbj'] = '<link href="http://www.mybeijingchina.com/css/layout.css" rel="stylesheet"><link type="text/css" href="http://www.mybeijingchina.com/css/travelguide.css" rel="stylesheet"><link href="http://www.mybeijingchina.com/css/css/attractions.css" rel="stylesheet" type="text/css">';
$config['css_source_yz'] = '<link href="http://www.yangtzeriver.org/css/css3/bootstrap/bootstrap.css" rel="stylesheet" type="text/css"><link href="http://www.yangtzeriver.org/css/css3/bootstrap/style.css" rel="stylesheet" type="text/css"><link href="http://www.yangtzeriver.org/css/css3/bootstrap/facts.css" rel="stylesheet" type="text/css">';
$config['css_source_sht'] = '<link href="//www.shanghaihighlights.com/css/css3/bootstrap/bootstrap.css" rel="stylesheet"><link href="//www.shanghaihighlights.com/css/css3/style.css" rel="stylesheet"><link href="//www.shanghaihighlights.com/css/css3/facts.css" rel="stylesheet">';
$config['css_source_gl'] = '<link href="//www.guilinchina.net/css/css3/bootstrap/bootstrap.css" rel="stylesheet"><link href="//www.guilinchina.net/css/css3/style.css" rel="stylesheet"><link href="//www.guilinchina.net/css/css3/destination.css" rel="stylesheet">';
$config['css_source_tbt'] = '<link href="//www.tibetguru.com/css/style.css" rel="stylesheet"><link href="//www.tibetguru.com/css/guide.css" rel="stylesheet">';
$config['css_source_mbj'] = '<link href="//www.mybeijingchina.com/css/layout.css" rel="stylesheet"><link type="text/css" href="//www.mybeijingchina.com/css/travelguide.css" rel="stylesheet"><link href="//www.mybeijingchina.com/css/css/attractions.css" rel="stylesheet" type="text/css">';
$config['css_source_yz'] = '<link href="//www.yangtzeriver.org/css/css3/bootstrap/bootstrap.css" rel="stylesheet" type="text/css"><link href="//www.yangtzeriver.org/css/css3/bootstrap/style.css" rel="stylesheet" type="text/css"><link href="//www.yangtzeriver.org/css/css3/bootstrap/facts.css" rel="stylesheet" type="text/css">';
$config['css_source_ah'] = '<link href="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" rel="stylesheet">';
@ -900,11 +868,45 @@ $config['InfoType_citizen'] = array(
'产品' => 'product'
);
//ct站点用到了
$config['InfoType_ct'] = array(
'不设置' => 'none',
'首页' => 'root',
'简介' => 'c_overview',
'关于' => 'c_about',
'食物' => 'c_food',
'食物详细' => 'c_food_detail',
'餐饮' => 'c_restaurant',
'餐饮详细' => 'c_restaurant_detail',
'历史' => 'c_history',
'Facts信息' => 'c_facts',
'旅游' => 'c_travel',
'交通' => 'c_transport',
'交通详细' => 'c_transport_detail',
'地图' => 'c_map',
'地图详细' => 'c_map_detail',
'天气' => 'c_weather',
'天气详细' => 'c_weather_detail',
'购物' => 'c_shopping',
'夜生活' => 'c_nightlife',
'旅游建议' => 'c_tips',
'景点概述' => 'c_attraction',
'景点详细' => 'c_attraction_detail',
'推荐做的' => 'c_toptodo',
'城市article' => 'c_article',
'产品' => 'c_product',
'产品详细' => 'c_product_detail',
'游记' => 'story',
'一地线路详细' => 'c_single_circuit',
'一日游线路详细' => 'c_day_tour'
);
//可选模板
$config['templates'] = array(
'通用内容模板' => 'guide_info_detail',
'城市-列表模板' => 'city_info_list',
'城市-首页模板' => 'city_info_index',
'城市-首页模板(GM)' => 'city_info_index_new',
'城市-首页模板[简]' => 'city_info_s_index',
'城市-景点列表模板' => 'city_info_attractions_list',
'城市-景点列表模板[简]' => 'city_info_s_attractions_list',
@ -940,6 +942,47 @@ $config['templates'] = array(
'food列表' => 'food_list'
);
//德语信息模板
$config['templates_gm'] = array(
'通用内容模板' => 'guide_info_detail',
'城市-首页模板(GM)' => 'city_info_index',
'文化模板 [单页式]' => 'culture_info_detail_one_page',
'文化模板 [导航式]' => 'culture_info_detail_with_category',
'信息专题模板' => 'guide_top_series',
'列表式' => 'guide_info_list',
'空白模板'=>'none'
);
// CHT 信息模板
$config['templates_cht'] = array(
'通用内容模板' => 'guide_info_detail',
'城市-列表模板' => 'city_info_list',
'城市-首页模板' => 'city_info_index',
'城市-首页模板[简]' => 'city_info_s_index',
'城市-景点列表模板' => 'city_info_attractions_list',
'城市-景点列表模板[简]' => 'city_info_s_attractions_list',
'城市-特色产品模板' => 'city_info_diytour',
'城市-一线城市首页' => 'city_info_index_one',
'省份-首页' => "area_info_index",
'省份-列表模板' => 'area_info_list',
'省份-通用内容模板' => 'area_info_detail',
'文化模板 [列表式]' => "culture_info_detail_just_list",
'文化模板 [单页式]' => 'culture_info_detail_one_page',
'文化模板 [导航式]' => 'culture_info_detail_with_category',
'信息专题模板' => 'guide_top_series',
'火车专题模板' => 'train_top_series',
'旅游攻略' => 'travel_story',
'节庆-详细模板' => 'festival_detail',
'节庆-列表模板' => 'festival_list',
'大使馆-详细页' => 'embassy_info_detail',
'城市-线路详细' => 'city_circuit',
'专题模板(大)' => 'guide_big_series',
'三峡游船' => 'yangtze',
'城市article列表' => 'city_article_list',
'food列表' => 'food_list',
'FAQ模板' => 'faq_detail'
);
//产品管理板块模板
$config['templates_product'] = array(
'空白模板' => 'none',
@ -947,6 +990,7 @@ $config['templates_product'] = array(
//产品管理板块模板(国际站使用)
$config['templates_product_i'] = array(
'空白模板HTML构建工具' => 'r_empty_container',
'空白模板(新)' => 'r_tpl_empty_2017',
'空白模板(旧)' => 'r_tpl_empty',
);
@ -1031,9 +1075,6 @@ $config['media_image_url_org'] = 'http://photo.chtcdn.com:3581/upload';
$config['media_image_url_remote'] = 'http://photo.chtcdn.com/upload';
$config['media_image_url_remote2'] = 'http://116.251.217.48:3581/upload';
//编辑器预览样式路径
$config['css_source_cht'] = '<link href="http://data.chinahighlights.com/css/min.php?f=/public/css/global.min.css,/css/festival-detail.css&amp;v=20140915" rel="stylesheet">';
$config['css_source_ah'] = '<link href="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" rel="stylesheet">';
/* End of file config.php */
/* Location: ./application/config/config.php */

@ -0,0 +1,59 @@
<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class CT_Amp_Loader extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('information_model');
$this->load->model('InfoMetas_model');
//$this->load->library('Tags_analysis');
}
// http://localhost:8002/guide-use.php/amp_loader/test/?info_url=/yangtzecruise/
/**
* 加载已经发布的页面
*/
public function load() {
$info_url = $this->input->get_post('info_url');
$webcode = $this->input->get_post('webcode');
if(!isset($webcode) ) {
$webcode="ct";
}
// $info_url="/yangtzecruise/";
// $webcode="cht";
$information_detail = $this->information_model->ct_get_by_url($info_url, $webcode);
$ic_id = $information_detail->ic_id;
$meta_amp_status = $this->InfoMetas_model->get($ic_id, 'AMP_STATUS');
if ($meta_amp_status) {
$meta_amp_html = $this->InfoMetas_model->get($ic_id, 'AMP');
//$include_price_html = $this->tags_analysis->replace_price_tag($meta_amp_html);
echo $meta_amp_html;
} else {
header('HTTP/1.1 404 Not Found');
header("status: 404 Not Found");
show_404();
exit;
}
}
// http://localhost:8002/guide-use.php/amp_loader/test/?info_url=/yangtzecruise/
/**
* 测试保存的页面
*/
public function test() {
// $info_url = $this->input->get_post('info_url');
$info_url = "/yangtzecruise/";
$information_detail = $this->information_model->ct_get_by_url($info_url, "cht");
if (empty($information_detail)) {
echo $info_url.'没有信息类型';
}
$ic_id = $information_detail->ic_id;
$meta_amp_html = $this->InfoMetas_model->get($ic_id, 'AMP');
//$include_price_html = $this->tags_analysis->replace_price_tag($meta_amp_html);
echo $meta_amp_html;
}
}

@ -11,52 +11,25 @@ class Amp extends CI_Controller {
//$this->output->enable_profiler(TRUE);
$this->load->model('Information_model');
$this->load->model('InfoMetas_model');
$this->load->library('Amplib');
}
public function index() {
$data = array();
$this->load->view('bootstrap3/header', $data);
$this->load->view('amp_editor');
$this->load->view('bootstrap3/footer');
}
public function edit($ic_id) {
$data = array();
$data['information'] = $this->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
show_404();
}
$this->load->view('bootstrap3/header', $data);
$this->load->view('amp_editor');
$this->load->view('bootstrap3/footer');
$this->amplib->edit($ic_id);
}
public function auto_create($ic_id) {
echo $this->amplib->auto_create($ic_id);
}
public function edit_save() {
$data = array();
$ic_id = $this->input->post('ic_id');
$textarea_htmlcode = $this->input->post('textarea_htmlcode');
$amp_status = $this->input->post('amp_status');
$data['information'] = $this->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
show_404();
}
$amp = $this->InfoMetas_model->get($ic_id, 'AMP');
if ($amp === false) {
$this->InfoMetas_model->add($ic_id, 'AMP', $textarea_htmlcode);
} else {
$this->InfoMetas_model->update($ic_id, 'AMP', $textarea_htmlcode);
}
$amp_status_value = $this->InfoMetas_model->get($ic_id, 'AMP_STATUS');
if ($amp_status_value === false) {
$this->InfoMetas_model->add($ic_id, 'AMP_STATUS', $amp_status);
} else {
$this->InfoMetas_model->update($ic_id, 'AMP_STATUS', $amp_status);
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'));
echo json_encode($data);
echo $this->amplib->edit_save();
}
}

@ -0,0 +1,42 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Home extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
}
//站点首页
public function index()
{
$home_id=1;
//查询结构根节点,当为空则建立
$rootStructure = $this->Information_model->GetRoot('h', $home_id);
if ($rootStructure == FALSE)
{
$this->InfoContents_model->Add('', 'HomePage', 'root', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', $home_id, 'h', 0,
'','');
$this->InfoStructures_model->Add(0, $this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
}
else
{
$is_id = $rootStructure->is_id;
}
redirect(site_url('information/edit/' . $is_id));
}
}

@ -12,60 +12,86 @@ class Info_amp extends CI_Controller
//$this->permission->is_admin();
$this->load->model('InfoMetas_model');
$this->load->model('InfoContents_model');
$this->load->model('Information_model');
$this->site_code = $this->config->item('site_code');
//CORS TEST
header('Access-Control-Allow-Origin:*');
//CORS
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:GET,PUT,POST,DELETE,OPTIONS');
header('Access-Control-Allow-Headers:Content-Type,Authorization,Content-Length,X-Requested-With,Accept,x-csrf-token,origin');
}
public function save_amp()
{
$icid = $this->input->post('icid');
$json = $this->input->post('json');
$html = $this->input->post('html');
$css = $this->input->post('css');
$schema = $this->input->post('schema');
$script = $this->input->post('script');
$status = $this->input->post('status');
$icid = $this->input->get_post('icid');
$json = $this->input->get_post('json');
$html = $this->input->get_post('html');
$pc_html = $this->input->get_post('pc_html');
$pc_css = $this->input->get_post('pc_css');
$css = $this->input->get_post('css');
$schema = $this->input->get_post('schema');
$script = $this->input->get_post('script');
$status = $this->input->get_post('status');
//如果源信息的内容为空,则插入内容。
$info = $this->InfoContents_model->get_ic_contents2($icid);
if ($info && empty($info->ic_content)) {
$this->InfoContents_model->force_update($icid, '<style>'.$pc_css.'</style>'.$pc_html);
}
if ($icid && $json && $html) {
try {
//html
$meta = $this->InfoMetas_model->get($icid, 'AMP_BODY');
if ($meta === false) {
if ($meta === FALSE) {
$this->InfoMetas_model->add($icid, 'AMP_BODY', $html);
} else {
$this->InfoMetas_model->update($icid, 'AMP_BODY', $html);
}
//pc_html
$meta = $this->InfoMetas_model->get($icid, 'AMP_BODY_PC');
if ($meta === FALSE) {
$this->InfoMetas_model->add($icid, 'AMP_BODY_PC', $pc_html);
} else {
$this->InfoMetas_model->update($icid, 'AMP_BODY_PC', $pc_html);
}
//pc_css
$meta = $this->InfoMetas_model->get($icid, 'AMP_CSS_PC');
if ($meta === FALSE) {
$this->InfoMetas_model->add($icid, 'AMP_CSS_PC', $pc_css);
} else {
$this->InfoMetas_model->update($icid, 'AMP_CSS_PC', $pc_css);
}
//json
$meta = $this->InfoMetas_model->get($icid, 'AMP_JSON');
if ($meta === false) {
if ($meta === FALSE) {
$this->InfoMetas_model->add($icid, 'AMP_JSON', $json);
} else {
$this->InfoMetas_model->update($icid, 'AMP_JSON', $json);
}
//css
$meta = $this->InfoMetas_model->get($icid, 'AMP_CSS');
if ($meta === false) {
if ($meta === FALSE) {
$this->InfoMetas_model->add($icid, 'AMP_CSS', $css);
} else {
$this->InfoMetas_model->update($icid, 'AMP_CSS', $css);
}
//script
$meta = $this->InfoMetas_model->get($icid, 'AMP_SCRIPT');
if ($meta === false) {
if ($meta === FALSE) {
$this->InfoMetas_model->add($icid, 'AMP_SCRIPT', $script);
} else {
$this->InfoMetas_model->update($icid, 'AMP_SCRIPT', $script);
}
//schema
$meta = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA');
if ($meta === false) {
if ($meta === FALSE) {
$this->InfoMetas_model->add($icid, 'AMP_SCHEMA', $schema);
} else {
$this->InfoMetas_model->update($icid, 'AMP_SCHEMA', $schema);
}
//status
$meta = $this->InfoMetas_model->get($icid, 'AMP_STATUS');
if ($meta === false) {
if ($meta === FALSE) {
$this->InfoMetas_model->add($icid, 'AMP_STATUS', $status);
} else {
$this->InfoMetas_model->update($icid, 'AMP_STATUS', $status);
@ -89,7 +115,7 @@ class Info_amp extends CI_Controller
public function load_amp()
{
$icid = $this->input->post('icid');
$icid = $this->input->get_post('icid');
if (!$icid) {
echo json_encode(array(
"succ" => false,
@ -97,6 +123,42 @@ class Info_amp extends CI_Controller
));
return false;
}
//信息~返回信息
$ic = $this->InfoContents_model->get_ic_contents2($icid);
if (empty($ic)) {
echo json_encode(array(
"succ" => false,
"message" => "load_amp() -> 无信息"
));
return false;
}
switch (strtolower($ic->ic_sitecode)) {
case 'vac':
$site = 'https://www.viaje-a-china.com';
break;
case 'vc':
$site = 'https://www.voyageschine.com';
break;
case 'jp':
$site = 'https://www.arachina.com';
break;
case 'ru':
$site = 'https://www.chinahighlights.ru';
break;
case 'it':
$site = 'https://www.viaggio-in-cina.it';
break;
case 'cht':
$site = 'https://www.chinahighlights.com';
break;
case 'gm':
$site = 'https://www.chinarundreisen.com/';
break;
default:
$site = '';
break;
}
$json = $this->InfoMetas_model->get($icid, 'AMP_JSON');
$status = $this->InfoMetas_model->get($icid, 'AMP_STATUS');
$schema = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA');
@ -104,6 +166,7 @@ class Info_amp extends CI_Controller
echo json_encode(array(
"succ" => true,
"icid" => $icid,
"icurl" => $site.$ic->ic_url,
"json" => $json,
"schema" => $schema,
"status" => $status
@ -116,17 +179,142 @@ class Info_amp extends CI_Controller
}
}
public function list_amp()
{
$site = $this->input->get_post('site');
switch ($site) {
case 'https://www.viaje-a-china.com':
$site_code = 'vac';
break;
case 'https://www.voyageschine.com':
$site_code = 'vc';
break;
case 'https://www.arachina.com':
$site_code = 'jp';
break;
case 'https://www.chinahighlights.ru':
$site_code = 'ru';
break;
case 'https://www.viaggio-in-cina.it':
$site_code = 'it';
break;
case 'https://www.chinahighlights.com':
$site_code = 'cht';
break;
case 'https://www.chinarundreisen.com/':
$site_code = 'gm';
break;
default:
$site_code = false;
break;
}
if (!$site_code) {
echo json_encode(array(
"succ" => false,
"message" => "list_amp() -> 参数传递错误。"
));
return false;
}
$rs = $this->InfoMetas_model->list_amp($site_code);
if (!empty($rs)) {
echo json_encode($rs);
} else {
echo json_encode(array(
"succ" => false,
"message" => "load_amp() -> 无数据返回。"
));
}
}
public function list_info_children()
{
$site = $this->input->get_post('site');
switch ($site) {
case 'https://www.viaje-a-china.com':
$site_code = 'vac';
break;
case 'https://www.voyageschine.com':
$site_code = 'vc';
break;
case 'https://www.arachina.com':
$site_code = 'jp';
break;
case 'https://www.chinahighlights.ru':
$site_code = 'ru';
break;
case 'https://www.viaggio-in-cina.it':
$site_code = 'it';
break;
case 'https://www.chinahighlights.com':
$site_code = 'cht';
break;
case 'https://www.chinarundreisen.com/':
$site_code = 'gm';
break;
default:
$site_code = false;
break;
}
$is_path = $this->input->get_post('is_path'); // '25693,278002094,'
if (!$site_code || !$is_path) {
echo json_encode(array(
'succ' => false,
'message' => 'list_info_children() -> 参数传递错误。'
));
return false;
}
$rs = $this->InfoMetas_model->list_info_by_path_with_meta($is_path, $site_code);
if (!empty($rs)) {
$newrs = array();
foreach ($rs as $info) {
$show_photo_meta = $this->InfoMetas_model->get($info->ic_id, 'meta_use_list_picture');
if ($show_photo_meta == 'no') {
$use_photo = '';
} else {
$use_photo = $this->config->item('site_image_url').$info->ic_photo;
}
if ($info->ic_type === 'c_attraction' || $info->ic_template === 'city_info_attractions_list' || $info->ic_template === 'r_tpl_empty_navi1p') {
$list_info = true;
} else {
$list_info = false;
}
if ($list_info || !empty($info->ic_content) && !empty($info->ic_url) && stripos($info->ic_url, '/test/')===false) {
array_push($newrs, array(
'is_path' => $info->is_path,
'ic_url' => $info->ic_url,
'ic_id' => $info->ic_id,
'title' => $info->ic_title,
'photo' => $use_photo,
'im_id' => $info->im_id
));
}
}
echo json_encode($newrs);
} else {
echo json_encode(array(
"succ" => false,
"message" => "list_info_children() -> 无数据返回。"
));
}
}
public function load_info()
{
$icid = $this->input->post('icid');
$icid = $this->input->get_post('icid');
if ($icid) {
$ic = $this->InfoContents_model->get_ic_contents2($icid);
if ($ic) {
$show_photo_meta = $this->InfoMetas_model->get($icid, 'meta_use_list_picture');
if ($show_photo_meta == 'no') {
$use_photo = '';
} else {
$use_photo = $this->config->item('site_image_url').$ic->ic_photo;
}
echo json_encode(array(
"succ" => true,
"info" => $ic->ic_content,
"info" => $ic->ic_content ? $ic->ic_content : "<p>".$ic->ic_seo_description."</p>",
"title" => $ic->ic_title,
"photo" => $this->config->item('site_image_url').$ic->ic_photo,
"photo" => $use_photo,
"url" => $ic->ic_url,
"site" => $this->config->item('site_url')
));
@ -144,5 +332,180 @@ class Info_amp extends CI_Controller
}
}
}
public function handel_png_source() {
//ini_set('memory_limit', '50M');
$png_base64 = $this->input->post('png_base64');
//$png_base64 = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
$file = md5($png_base64).'.jpg';
$path = realpath('../cht-system/views/information/word_img').'/'.$file;
$png_base64 = str_replace('data:image/png;base64,', '', $png_base64);
$png_base64 = str_replace('data:image/jpg;base64,', '', $png_base64);
$png_base64 = base64_decode($png_base64);
$im = imagecreatefromstring($png_base64);
//保存图像
imagejpeg($im, $path);
//释放内存
imagedestroy($im);
$size = getimagesize($path);
if($png_base64 && $size) {
echo(json_encode(array(
'status' => 'success',
'path' => '/information-view/information/word_img/'.$file,
'width' => $size[0],
'height' => $size[1]
)));
} else {
echo(json_encode(array(
'status' => 'error'
)));
}
}
public function handel_image_source() {
@ini_set('memory_limit', '256M');
$file = $_FILES['file'];
if (!$file) {
echo(json_encode(array(
'status' => 'error',
'msg' => "图片上传失败。"
)));
return;
}
$usr = $this->input->post('usr');
$icid = $this->input->post('icid');
//转移文件
$md5_file = md5($usr.$icid.$file['name']);
//ext
$ext = mb_strtolower(strrchr($file["name"],'.'));
if ($ext != '.jpg') {
echo(json_encode(array(
'status' => 'error',
'msg' => '只能接收(.jpg)图片。',
'filename' => $file["name"]
)));
return;
}
$md5_name = $md5_file.$ext;
//临时docx文件
$image_path = realpath('../cht-system/views/information/word_img').'/'.basename($md5_name);
$html = 'to use mammoth';
if (move_uploaded_file($file['tmp_name'], $image_path)) {
//图片处理
$im = imagecreatefromjpeg($image_path);
imagejpeg($im, $image_path);
imagedestroy($im);
$size = getimagesize($image_path);
if($size) {
echo(json_encode(array(
'status' => 'success',
'path' => '/information-view/information/word_img/'.$md5_name,
'width' => $size[0],
'height' => $size[1]
)));
} else {
echo(json_encode(array(
'status' => 'error'
)));
}
} else {
echo(json_encode(array(
'status' => 'error',
'msg' => "图片文件解析失败。"
)));
}
}
public function handel_word_source() {
@ini_set('memory_limit', '256M');
$file = $_FILES['file'];
if (!$file) {
echo(json_encode(array(
'status' => 'error',
'msg' => "文件上传失败。"
)));
return;
}
$usr = $this->input->post('usr');
$icid = $this->input->post('icid');
//转移文件
$md5_file = md5($usr.$icid.$file['name']);
//ext
$ext = mb_strtolower(strrchr($file["name"],'.'));
if ($ext != '.docx') {
echo(json_encode(array(
'status' => 'error',
'msg' => '只能接收word(.docx)文档。'
)));
return;
}
$md5_name = $md5_file.$ext;
//临时docx文件
$docx_path = realpath('../cht-system/views/information/word_source').'/'.basename($md5_name);
$html = 'to use mammoth';
if (move_uploaded_file($file['tmp_name'], $docx_path)) {
$docx_dir = realpath('../cht-system/views/information/word_source');
//图片及html目录
$img_dir = $docx_dir.'/'.$md5_file;
is_dir($img_dir) || mkdir($img_dir, 0777);
//临时html文件
$docx_parh = $img_dir.'/'.$md5_name;
$html_parh = str_ireplace('.docx', '.html', $docx_parh);
//运行docx转化插件
if ($_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '202.103.68.62') {
$yarnbin = 'C:\Users\cht77\AppData\Local\Yarn\bin\mammoth ';
$test_host = '//202.103.68.62:9096';
} else {
$yarnbin = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth ';
$test_host = '';
}
$command = $yarnbin.$docx_path.' --output-dir='.$img_dir. ' 2>&1';
//$command = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth -h 2>&1';
exec($command, $rs, $st);
//图片处理
$scan_img = scandir($img_dir);
$tmp = '';
foreach($scan_img as $f) {
$tmp_ext = mb_strtolower(strrchr($f, '.'));
if ($tmp_ext == '.jpeg') {
$tmp_img = $img_dir.'/'.$f;
$tmp_jpg = str_ireplace('.jpeg', '.jpg', $tmp_img);
$im = imagecreatefromjpeg($tmp_img);
imagejpeg($im, $tmp_jpg);
imagedestroy($im);
//删除临时图片
@unlink($tmp_img);
//$tmp .= $f . ' # ';
}
}
//html处理
if (file_exists($html_parh)) {
$html = file_get_contents($html_parh);
} else {
echo(json_encode(array(
'status' => 'error',
'html' => $command.' # '.$html_parh,
'rs' => print_r($rs, true).' # '.$st
)));
return;
}
$html = preg_replace('/src="([\d]+).jpeg"/i', 'src="'.$test_host.'/information-view/information/word_source/'.$md5_file.'/$1.jpg"', $html);
//删除临时html
@unlink($html_parh);
//删除docx文档
@unlink($docx_path);
if ($html) {
echo(json_encode(array(
'status' => 'success',
'path' => $docx_path,
'html' => $html
)));
}
} else {
echo(json_encode(array(
'status' => 'error',
'msg' => "word文件解析失败。"
)));
}
}
}

File diff suppressed because it is too large Load Diff

@ -15,9 +15,6 @@ class Keyworlds extends CI_Controller {
}
public function index($kw_is_id = '') {
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
$this->permission->is_admin();
//查询结构列表信息
$data['keyworldsList'] = $this->Keywords_model->get_structure_list();

@ -61,10 +61,6 @@ class Login extends CI_Controller {
$admin_info = $this->session->userdata('session_admin');
if ($this->accesscheck->check_access($site_code)) {
$this->session->set_userdata('session_site', $site_item);
$this->session->unset_userdata('access_module');
$this->session->unset_userdata('access_read_list');
$this->session->unset_userdata('access_write_list');
$this->session->unset_userdata('access_sitecode');
}
}
//跳转到指定页面。

@ -34,7 +34,9 @@ class Look_order extends CI_Controller {
//显示订单数量,如果大于阈值就显示错误
public function status() {
$data = array();
$data['tour_count'] = $this->Orders_model->tour_count();
$tour_count = $this->Orders_model->tour_count();
$biz_count = $this->Orders_model->biz_count();
$data['tour_count'] = $tour_count + $biz_count;
if ($data['tour_count'] >= 550) {
$this->output->set_status_header(500);
}

@ -16,8 +16,7 @@ class Payment extends CI_Controller
{
$data=array();
if ($this->input->post('price')) {
$data['payurl']='
<a href="https://www.chinahighlightstravel.com/payment/payment-center.asp?'.
$data['payurl'] = '<a href="https://www.chinahighlights.com/securepayment/?'.
'Site_Language=en_us&'.
'Site_CurrencyType=USD&'.
'Site_ACD=100-200-300&'.

@ -19,8 +19,6 @@ class Province extends CI_Controller
public function index($province_id=0)
{
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
//查询不到省份信息则显示错误
$data['province'] = $this->Area_model->get_province($province_id);
if ($data['province'] == FALSE)

@ -14,8 +14,6 @@ class Seo extends CI_Controller {
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
$this->load->model('InfoSEOs_model');
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
}
public function index() {

@ -11,6 +11,7 @@ class Tools extends CI_Controller
$this->load->model('Area_model');
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->load->model('InfoMetas_model');
$this->site_code = $this->config->item('site_code');
}
@ -52,6 +53,29 @@ class Tools extends CI_Controller
$this->load->view('tools/old', $data);
}
}
/**
*
* 公有函数AMP转化表格。
*
* 必要参数:
* @param String $site_code
*
*/
public function amp_check()
{
$data['amp'] = $this->input->get_post('amp');
if (!$data['amp']) $data['amp'] = 'yes';
//AMP转化列表
if ($data['amp'] == 'yes') {
$data['info'] = $this->InfoMetas_model->list_amp($this->site_code);
} else {
$data['info'] = $this->InfoMetas_model->list_no_amp($this->site_code);
}
//视图
$this->load->view('tools/amp_check', $data);
}
/**
* 导出CSV文件

@ -26,7 +26,7 @@ class Welcome extends CI_Controller {
$data['last_city_list'] = $this->Area_model->get_last_edit_city();
if ($this->config->item('site_code') == 'pgr') {
$data['countryList'] = $this->Area_model->get_country_list_for_site("'589','645'");
$data['countryList'] = $this->Area_model->get_country_list_for_site("'589','645','632','517','31','28','609','630','9','708','709'");
}
$this->load->view('bootstrap/header', $data);
@ -65,29 +65,24 @@ class Welcome extends CI_Controller {
$this->load->view('bootstrap/footer');
}
//获取所有信息+产品url
public function create_all_urls() {
//获取所有信息URL,用来批量静态化更新
public function create_all_urls($view=false) {
set_time_limit(0);
$this->output->enable_profiler(false);
$this->Information_model->topNum = false;
$data['all_information'] = $this->Information_model->GetList('ic_status,ic_url,ic_sitecode');
//系列站产品连接
$site_code = strtoupper($this->config->item('site_code'));
if (!empty($site_code)) {
$this->load->helper('file');
$path = APPPATH . '/views/product_urls/updateCache' . $site_code . '.txt';
if (file_exists($path)) {
$data['product_urls'] = read_file($path);
$domain = $this->config->item('site_url');
$data['product_urls'] = str_replace("\n", '<br/>', $data['product_urls']);
$data['product_urls'] = str_replace($domain, $domain . '/index.php/welcome/update_cache/?static_html_url=', $data['product_urls']);
}
$data['all_information'] = $this->Information_model->GetList('ic_status,ic_id,ic_url,ic_sitecode,is_id');
if ($view == 'amp') {
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/refresh_amp_urls');
$this->load->view('bootstrap3/footer');
} else {
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/cache_url', $data);
$this->load->view('bootstrap/footer');
}
$this->load->view('none_urls', $data);
}
//获取某个信息节点和子节点url
public function create_infomation_urls($is_parent_id) {
public function create_infomation_urls($is_parent_id, $view = false) {
$this->output->enable_profiler(FALSE);
$structure = $this->InfoStructures_model->Detail($is_parent_id);
if (empty($structure)) {
@ -95,9 +90,15 @@ class Welcome extends CI_Controller {
return false;
}
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/cache_url', $data);
$this->load->view('bootstrap/footer');
if ($view == 'amp') {
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/refresh_amp_urls');
$this->load->view('bootstrap3/footer');
} else {
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/cache_url', $data);
$this->load->view('bootstrap/footer');
}
}
public function get_infomation_urls($is_parent_id) {
@ -118,37 +119,37 @@ class Welcome extends CI_Controller {
$last_backup = $this->Logs_model->get_last_backup($info_id);
if (empty($last_backup)) {
$this->echo_json(array(
'status' => 'error',
'logId' => 0,
'datetime' => 0,
'username' => 0
));
'status' => 'error',
'logId' => 0,
'datetime' => 0,
'username' => 0
));
} else {
$this->echo_json(array(
'status' => 'success',
'logId' => $last_backup->log_id,
'datetime' => $last_backup->log_datetime,
'username' => $last_backup->log_ht_username
));
'status' => 'success',
'logId' => $last_backup->log_id,
'datetime' => $last_backup->log_datetime,
'username' => $last_backup->log_ht_username
));
}
}
public function change_static_url($info_id) {
$information = $this->Information_model->Detail($info_id);
$htm_doc = new DOMDocument();
$htm_doc->encoding='UTF-8';
$htm_doc->encoding = 'UTF-8';
libxml_use_internal_errors(true);
$htm_doc->strictErrorChecking = false;
if (empty($information->ic_content)) {
$this->echo_json(array(
'status' => 'error',
'infoId' => $info_id,
'message' => 'info content is empty'
));
'status' => 'error',
'infoId' => $info_id,
'message' => 'info content is empty'
));
return;
}
$htm_doc->loadHTML(
mb_convert_encoding($information->ic_content, 'HTML-ENTITIES', 'UTF-8'));
mb_convert_encoding($information->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$img_list = $htm_doc->getElementsByTagName('img');
foreach ($img_list as $img) {
@ -157,87 +158,166 @@ class Welcome extends CI_Controller {
$img->setAttribute('src', $img_src);
}
$information->ic_content = $htm_doc->saveHTML();
$this->InfoContents_model->Update(
$information->ic_id,
$information->ic_url,
$information->ic_url_title,
$information->ic_type,
$information->ic_title,
$information->ic_content,
$information->ic_summary,
$information->ic_seo_title,
$information->ic_seo_description,
$information->ic_seo_keywords,
$information->ic_show_bread_crumbs,
$information->ic_status,
$information->ic_template,
$information->ic_photo,
$information->ic_photo_width,
$information->ic_photo_height,
$information->ic_recommend_tours,
$information->ic_recommend_packages,
$information->ic_ht_area_id,
$information->ic_ht_area_type,
$information->ic_ht_product_id,
$information->ic_ht_product_type,
$information->ic_author);
$this->echo_json(array(
'status' => 'ok',
'infoId' => $info_id,
'message' => 'success',
'date' => date('Y-m-d h:i:s')
));
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_href = $anchor->getAttribute('href');
echo 'a.href: ' . $a_href . '<br>';
$match_result = array();
preg_match('/^http:\/\/www.chinahighlights.com(.*)/', $a_href, $match_result);
$result_count = count($match_result);
if ($result_count == 2) {
$result = '//www.chinahighlights.com' . $match_result[1];
$anchor->setAttribute('href', $result);
echo $result . '<br>';
}
}
// $information->ic_content = $htm_doc->saveHTML();
// $this->InfoContents_model->Update(
// $information->ic_id,
// $information->ic_url,
// $information->ic_url_title,
// $information->ic_type,
// $information->ic_title,
// $information->ic_content,
// $information->ic_summary,
// $information->ic_seo_title,
// $information->ic_seo_description,
// $information->ic_seo_keywords,
// $information->ic_show_bread_crumbs,
// $information->ic_status,
// $information->ic_template,
// $information->ic_photo,
// $information->ic_photo_width,
// $information->ic_photo_height,
// $information->ic_recommend_tours,
// $information->ic_recommend_packages,
// $information->ic_ht_area_id,
// $information->ic_ht_area_type,
// $information->ic_ht_product_id,
// $information->ic_ht_product_type,
// $information->ic_author);
// $this->echo_json(array(
// 'status' => 'ok',
// 'infoId' => $info_id,
// 'message' => 'success',
// 'date' => date('Y-m-d h:i:s')
// ));
}
public function count_redirect_nofollow() {
$include_redirece_info = $this->Information_model->search_all_text('&t=78002', 2000);
echo 'redirect count: ' . count($include_redirece_info) . '<br/>';
$redirect_nofollow_list = array();
$htm_doc = new DOMDocument();
$htm_doc->encoding = 'UTF-8';
libxml_use_internal_errors(true);
$htm_doc->strictErrorChecking = false;
foreach ($include_redirece_info as $info) {
$htm_doc->loadHTML(
mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_href = $anchor->getAttribute('href');
$a_rel = $anchor->getAttribute('rel');
$match_result = array();
preg_match('/.*&t=78002$/', $a_href, $match_result);
$result_count = count($match_result);
if ($result_count > 0 && $a_rel != 'nofollow') {
echo $info->ic_url . ' | ' . '(' . $info->ic_id . ',' . $info->is_id . ')' . '<br/>';
echo 'a.href: ' . $a_href . '; rel: ' . $a_rel . '<br>';
$redirect_nofollow_list[] = $info;
}
}
}
echo 'nofollow_count: ' . count($redirect_nofollow_list) . '<br/>';
return $redirect_nofollow_list;
}
public function transform_redirect_nofollow() {
$redirect_nofollow_list = $this->count_redirect_nofollow();
$htm_doc = new DOMDocument();
$htm_doc->encoding = 'UTF-8';
libxml_use_internal_errors(true);
$htm_doc->strictErrorChecking = false;
foreach ($redirect_nofollow_list as $info) {
$htm_doc->loadHTML(
mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_rel = $anchor->getAttribute('rel');
$anchor->setAttribute('rel', 'nofollow');
$this->Logs_model->backup($info->is_id, $info->ic_content);
$info->ic_content = $htm_doc->saveHTML();
$this->InfoContents_model->Update(
$info->ic_id, $info->ic_url, $info->ic_url_title, $info->ic_type, $info->ic_title, $info->ic_content, $info->ic_summary, $info->ic_seo_title, $info->ic_seo_description, $info->ic_seo_keywords, $info->ic_show_bread_crumbs, $info->ic_status, $info->ic_template, $info->ic_photo, $info->ic_photo_width, $info->ic_photo_height, $info->ic_recommend_tours, $info->ic_recommend_packages, $info->ic_ht_area_id, $info->ic_ht_area_type, $info->ic_ht_product_id, $info->ic_ht_product_type, $info->ic_author);
}
}
echo 'update_nofollow_count: ' . count($redirect_nofollow_list) . '<br/>';
}
public function count_http_of_href() {
$data['all_information'] = $this->Information_model->search_all_text('http://www.chinahighlights.com/', 2000);
echo 'count: ' . count($data['all_information']) . '<br/>';
var_dump($data['all_information']);
}
public function transform_href_to_https() {
$http_host = 'http://www.chinahighlights.com/';
$https_host = 'https://www.chinahighlights.com/';
$data['all_information'] = $this->Information_model->search_all_text($http_host, 200);
echo 'count: ' . count($data['all_information']) . '<br/>';
if (empty($data['all_information'])) {
echo 'nothing transform to https';
} else {
foreach ($data['all_information'] as $item) {
if (empty($item->ic_url)) {
echo '<span style="color: red;">[' . $item->ic_title . '] [' . $item->ic_url . ']</span> <br/>';
continue;
} else {
echo $item->ic_url . ' | ' . $item->ic_title . '<br/>';
}
$this->Logs_model->backup($item->is_id, $item->ic_content);
$item->ic_content = str_replace($http_host, $https_host, $item->ic_content);
$this->InfoContents_model->Update(
$item->ic_id, $item->ic_url, $item->ic_url_title, $item->ic_type, $item->ic_title, $item->ic_content, $item->ic_summary, $item->ic_seo_title, $item->ic_seo_description, $item->ic_seo_keywords, $item->ic_show_bread_crumbs, $item->ic_status, $item->ic_template, $item->ic_photo, $item->ic_photo_width, $item->ic_photo_height, $item->ic_recommend_tours, $item->ic_recommend_packages, $item->ic_ht_area_id, $item->ic_ht_area_type, $item->ic_ht_product_id, $item->ic_ht_product_type, $item->ic_author
);
}
}
}
private function echo_json($obj) {
$this->output
->set_content_type('application/json')
->set_output(json_encode($obj));
->set_content_type('application/json')
->set_output(json_encode($obj));
}
//批量替换二级域名如图片或者data域名
function replace_hostname($topnum){
$data=array();
$find_host='http://data.chinarundreisen.com/'; //http://bilder.chinarundreisen.com/
$new_host='//data.chinarundreisen.com/';
$data['all_information'] = $this->Information_model->search_all_text($find_host,$topnum);
if($data['all_information']){
foreach($data['all_information'] as $item){
echo $item->ic_url.'<br/>';
$item->ic_content=str_replace($find_host, $new_host,$item->ic_content);
$this->InfoContents_model->Update(
$item->ic_id,
$item->ic_url,
$item->ic_url_title,
$item->ic_type,
$item->ic_title,
$item->ic_content,
$item->ic_summary,
$item->ic_seo_title,
$item->ic_seo_description,
$item->ic_seo_keywords,
$item->ic_show_bread_crumbs,
$item->ic_status,
$item->ic_template,
$item->ic_photo,
$item->ic_photo_width,
$item->ic_photo_height,
$item->ic_recommend_tours,
$item->ic_recommend_packages,
$item->ic_ht_area_id,
$item->ic_ht_area_type,
$item->ic_ht_product_id,
$item->ic_ht_product_type,
$item->ic_author
);
}
}else{
echo 'all done';
}
}
//批量替换二级域名如图片或者data域名
function replace_hostname($topnum) {
$data = array();
$find_host = 'http://data.chinarundreisen.com/'; //http://bilder.chinarundreisen.com/
$new_host = '//data.chinarundreisen.com/';
$data['all_information'] = $this->Information_model->search_all_text($find_host, $topnum);
if ($data['all_information']) {
foreach ($data['all_information'] as $item) {
echo $item->ic_url . '<br/>';
$item->ic_content = str_replace($find_host, $new_host, $item->ic_content);
$this->InfoContents_model->Update(
$item->ic_id, $item->ic_url, $item->ic_url_title, $item->ic_type, $item->ic_title, $item->ic_content, $item->ic_summary, $item->ic_seo_title, $item->ic_seo_description, $item->ic_seo_keywords, $item->ic_show_bread_crumbs, $item->ic_status, $item->ic_template, $item->ic_photo, $item->ic_photo_width, $item->ic_photo_height, $item->ic_recommend_tours, $item->ic_recommend_packages, $item->ic_ht_area_id, $item->ic_ht_area_type, $item->ic_ht_product_id, $item->ic_ht_product_type, $item->ic_author
);
}
} else {
echo 'all done';
}
}
private function check_url($subject) {
$result = $subject;
@ -261,7 +341,7 @@ class Welcome extends CI_Controller {
preg_match($pattern, $subject, $match_result);
$result_count = count($match_result);
if ($result_count == 2) {
$result = $replace.$match_result[1];
$result = $replace . $match_result[1];
}
return $result;
}
@ -282,7 +362,7 @@ class Welcome extends CI_Controller {
$parent_path = str_replace('-', ',', $parent_path);
$parent_path = trim($parent_path, ',');
if ($parent_path != '')
$parent_path.=',';
$parent_path .= ',';
$this->load->model('Import_model');
$this->Import_model->set_path($is_id, $parent_path);
echo 'ok';

@ -312,6 +312,11 @@ function get_content_by_url($url) {
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if($httpCode>=400){//页面状态如果大于400说明页面打不开
log_message('error', " curl {$httpCode} {$url} ");
return false;
}
$errno = curl_errno($curl);
if ($errno !== 0) {
return false;

@ -18,16 +18,9 @@ class Accesscheck extends CI_Controller
return true;
}
if ($this->session->userdata('access_module') === false){
$this->init_accessdata();
}
$this->session->set_userdata('access_sitecode', $this->Access_model->get_user_site_list($userdata['OPI_Code']));
//用户拥有权限de站点、模块&需要权限认证的模块
$access_module = $this->session->userdata('access_module');
$user_controller = $access_module['user_controller'];
$user_action = $access_module['user_action'];
$iaa_controller_list = $access_module['iaa_controller_list'];
$iaa_action_list = $access_module['iaa_action_list'];
$user_site_list = $this->session->userdata('access_sitecode');
$user_site_list = $this->session->userdata('access_sitecode');
//检测用户是否能访问当前站点,如果不能,则跳转到该用户有权限的站点
if($site_code=='')$site_code=$this->config->item('site_code');
@ -35,86 +28,9 @@ class Accesscheck extends CI_Controller
header('Location: '.$_SERVER['HTTP_REFERER']);
exit();
}
//判断当前操作是否需要认证
$flag=true;
if ($module!='') {
$module_array=explode('/', trim($module));
$this->router->class= $module_array[0];
$this->router->method= $module_array[1];
}
//判断当前模块是否需要认证
if (in_array($this->router->class, $iaa_controller_list)) {
//如果需要认证,判断是否有权限操作当前模块
if (in_array($this->router->class,$user_controller)) {
//判断是否能编辑不同省份信息
/*if($this->router->class=='province'){
$province=str_replace('/province/', '', $this->uri->uri_string());
$province=trim($province);
if (!isset($user_action[$this->router->class]) || !in_array($province, $user_action[$this->router->class])) {
$flag = false;//没有权限查看当前省份!
}
}
//判断当前方法是否需要认证
else*/
if (isset($iaa_action_list[$this->router->class]) && in_array($this->router->method, $iaa_action_list[$this->router->class])) {
//如果当前方法需要认证,则判断是否有权限
if (!isset($user_action[$this->router->class]) || !in_array($this->router->method, $user_action[$this->router->class])) {
$flag = false;//没有权限执行当前方法!
}
}
}else {
$flag = false;//没有权限执行当前控制器模块!
}
}
if ($module =='' && !$flag) {
redirect(site_url('Login/refuse'));
exit();
}
return $flag;
return true;
}
public function init_accessdata(){
$userdata=$this->session->userdata('session_admin');
//根据usercode获取用户角色、可读、可写列表
$user_access=$this->Access_model->get_user_access($userdata['OPI_Code'],$this->config->item('site_code'));
//根据角色字符串获取用户有权限的操作
$user_node=$this->Access_model->get_node_list($user_access->iao_role.'0');
//把用户拥有的所有角色id组装成一个数组集合
$node_str='';
foreach ($user_node as $node) {
$node_str.=$node->ian_iaa_id;
}
$node_array=explode(',', substr($node_str, 0,-1));
//用户拥有权限de站点、模块&需要权限认证的模块
$user_controller = array();
$user_action = array();
$iaa_controller_list = array();
$iaa_action_list = array();
//所有需要认证的模块、方法
$action_list=$this->Access_model->get_action_list();
foreach ($action_list as $a) {
//用户拥有的权限模块、方法
if (in_array($a->iaa_id, $node_array) && $a->iaa_controller!='') {
$user_controller[] = $a->iaa_controller;
$user_action[$a->iaa_controller][] = $a->iaa_action;
}
//需要认证的控制器和方法
if(!empty($a->iaa_controller))$iaa_controller_list[]=$a->iaa_controller;
if(!empty($a->iaa_action))$iaa_action_list[$a->iaa_controller][]=$a->iaa_action;
}
$access_module['user_controller'] = $user_controller;
$access_module['user_action'] = $user_action;
$access_module['iaa_controller_list'] = $iaa_controller_list;
$access_module['iaa_action_list'] = $iaa_action_list;
$this->session->set_userdata('access_read_list', $user_access->iao_read);
$this->session->set_userdata('access_write_list', $user_access->iao_write);
$this->session->set_userdata('access_sitecode', $this->Access_model->get_user_site_list($userdata['OPI_Code']));
$this->session->set_userdata('access_module', $access_module);
}
//获取角色等级(角色树形结构的等级)
public function get_role_level($site_code='',$author=''){

@ -0,0 +1,130 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/*
* AMP的相关方法
*/
class Amplib {
var $CI;
public function __construct() {
$this->CI = & get_instance();
$this->CI->load->model('Information_model');
$this->CI->load->model('InfoMetas_model');
$this->CI->load->model('Logs_model');
}
public function edit($ic_id) {
$data = array();
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
show_404();
}
$this->CI->load->view('bootstrap3/header', $data);
$this->CI->load->view('amp_editor');
$this->CI->load->view('bootstrap3/footer');
}
public function auto_create($ic_id) {
$data = array();
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
return json_encode(array('result' => 'no', 'data' => '找不到这个页面'));
}
//144.76.185.44:8029
//根据站点不同,配置不同参数
$site_code = strtolower($this->CI->config->item('site_code'));
switch ($site_code) {
case 'ah':
//websitehost是表示资源下载的域名在网页代码中有/css/xxx.css之类的路径程序需要添加域名组成完整URL去下载文件一般是data域名或者www域名
$websitehost = 'https://data.asiahighlights.com';
$html_source_url = 'https://www.asiahighlights.com/index.php/information/detail/?no_cache=true&static_html_url=' . $data['information']->ic_url;
break;
case 'cht':
$websitehost = 'https://data.chinahighlights.com';
$html_source_url = 'http://192.155.224.195:2222' . $data['information']->ic_url;
break;
case 'gm':
$websitehost = 'https://data.chinarundreisen.com';
$html_source_url = 'http://144.76.185.44:8029' . $data['information']->ic_url;
break;
case 'ct':
$websitehost = 'https://data.chinatravel.com';
$html_source_url = 'http://158.85.210.78:2222' . $data['information']->ic_url;
break;
default:
$websitehost = $this->CI->config->item('site_url');
$html_source_url = $this->CI->config->item('site_url') . $data['information']->ic_url;
}
//获取网页当前源码,然后发送到信息平台
$html_source = GET_HTTP($html_source_url);
if (!empty($html_source)) {
$post_data = array('websitehost' => $websitehost, 'template_name' => $site_code, 'create_amp' => 'true', 'htmlsource' => $html_source);
//德语站点走另外一个控制器,其他站点还是走原来的流程
if($site_code == 'gm'){
return GET_HTTP(site_url('/apps/htmlcompressor/index_gm/choose_way'), $post_data, 'POST');
}else{
return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
}
}
return json_encode(array('result' => 'no', 'data' => '不知道哪里错了,看代码'));
}
public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false) {
$data = array();
if ($ic_id === false) {
$ic_id = $this->CI->input->post('ic_id');
}
if ($textarea_htmlcode === false) {
$textarea_htmlcode = $this->CI->input->post('textarea_htmlcode');
}
if ($amp_status === false) {
$amp_status = $this->CI->input->post('amp_status');
}
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
show_404();
}
//CH的页面没有canonical内容在这里帮补上
$textarea_htmlcode = str_replace('<!--@CANONICAL@-->', $this->CI->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode);
//备份修改的代码
$this->CI->Logs_model->write('backup_amp', $ic_id, $textarea_htmlcode);
//AMP格式验证
if ($amp_status !== '0') {//只有发布的时候才需要验证
//把AMP网页内容到purifycss处理内置了AMP-Validator
$purifycss_server = 'http://184.172.113.216:33033/';
if ($this->CI->config->item('site_code' == 'gm')) {//德语站点使用自己的css处理服务器
$purifycss_server = 'http://158.177.67.52:33033/';
}
$validator_result = GET_HTTP($purifycss_server, 'amp_source=' . urlencode($textarea_htmlcode), 'POST');
$validator_result = json_decode($validator_result);
if ($validator_result->status == 'FAIL') {
return json_encode(array('name' => 'no', 'value' => $validator_result->errors));
}
}
$amp = $this->CI->InfoMetas_model->get($ic_id, 'AMP');
if ($amp === false) {
$this->CI->InfoMetas_model->add($ic_id, 'AMP', $textarea_htmlcode);
} else {
$this->CI->InfoMetas_model->update($ic_id, 'AMP', $textarea_htmlcode);
}
$amp_status_value = $this->CI->InfoMetas_model->get($ic_id, 'AMP_STATUS');
if ($amp_status_value === false) {
$this->CI->InfoMetas_model->add($ic_id, 'AMP_STATUS', $amp_status);
} else {
$this->CI->InfoMetas_model->update($ic_id, 'AMP_STATUS', $amp_status);
}
return json_encode(array('name' => 'ok', 'value' => $this->CI->lang->line('form_info_success')));
}
}

@ -0,0 +1,15 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* ??MY_Composer
*
* @author lmr
*/
class MY_Composer
{
function __construct()
{
include("C:/VHD/icht-ga/vendor/autoload.php");
}
}

@ -0,0 +1,555 @@
<?php
//============================================================+
// File name : class.wordphp.php
// Begin : 2014-03-09
// Last Update : 2018-06-22
// Version : 1.1
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2014 Ricardo Pinto
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
//
// Description : PHP class to read DOCX file into HTML format
//
// Author: Ricardo Pinto
//
// (c) Copyright:
// Ricardo Pinto
//============================================================+
class WordPHP
{
private $debug = false;
private $file;
private $rels_xml;
private $doc_xml;
private $doc_media = array();
private $last = 'none';
private $encoding = 'UTF-8';
private $tmpDir = 'tmp';
//图片目录和前缀
public $img_dir = '';
public $img_prex = '';
/**
* CONSTRUCTOR
*
* @param Boolean $debug Debug mode or not
* @return void
*/
public function __construct($debug_=null, $encoding=null)
{
if($debug_ != null) {
$this->debug = $debug_;
}
if ($encoding != null) {
$this->encoding = $encoding;
}
$this->tmpDir = dirname(__FILE__);
}
/**
* Sets the tmp directory where images will be stored
*
* @param string $tmp The location
* @return void
*/
private function setTmpDir($tmp)
{
$this->tmpDir = $tmp;
}
/**
* READS The Document and Relationships into separated XML files
*
* @param var $object The class variable to set as DOMDocument
* @param var $xml The xml file
* @param string $encoding The encoding to be used
* @return void
*/
private function setXmlParts(&$object, $xml, $encoding)
{
$object = new DOMDocument();
$object->encoding = $encoding;
$object->preserveWhiteSpace = false;
$object->formatOutput = true;
$object->loadXML($xml);
$object->saveXML();
}
/**
* READS The Document and Relationships into separated XML files
*
* @param String $filename The filename
* @return void
*/
private function readZipPart($filename)
{
$zip = new ZipArchive();
$_xml = 'word/document.xml';
$_xml_rels = 'word/_rels/document.xml.rels';
if (true === $zip->open($filename)) {
if (($index = $zip->locateName($_xml)) !== false) {
$xml = $zip->getFromIndex($index);
}
//Get the relationships
if (($index = $zip->locateName($_xml_rels)) !== false) {
$xml_rels = $zip->getFromIndex($index);
}
// load all images if they exist
for ($i=0; $i<$zip->numFiles;$i++) {
$zip_element = $zip->statIndex($i);
if(preg_match("([^\s]+(\.(?i)(jpg|jpeg|png|gif|bmp))$)",$zip_element['name'])) {
$this->doc_media[$zip_element['name']] = $zip_element['name'];
}
}
$zip->close();
} else die('non zip file');
$enc = mb_detect_encoding($xml);
$this->setXmlParts($this->doc_xml, $xml, $enc);
$this->setXmlParts($this->rels_xml, $xml_rels, $enc);
if($this->debug) {
echo "<textarea style='width:100%; height: 200px;'>";
echo $this->doc_xml->saveXML();
echo "</textarea>";
echo "<textarea style='width:100%; height: 200px;'>";
echo $this->rels_xml->saveXML();
echo "</textarea>";
}
}
/**
* CHECKS THE FONT FORMATTING OF A GIVEN ELEMENT
* Currently checks and formats: bold, italic, underline, background color and font family
*
* @param XML $xml The XML node
* @return String HTML formatted code
*/
private function checkFormating(&$xml)
{
$node = trim($xml->readOuterXML());
$t = '';
// add <br> tags
if (mb_strstr($node,'<w:br ')) $t = '<br>';
// look for formatting tags
$f = "<span style='";
$reader = new XMLReader();
$reader->XML($node);
$img = null;
while ($reader->read()) {
if($reader->name == "w:b") {
$f .= "font-weight: bold,";
}
if($reader->name == "w:i") {
$f .= "text-decoration: underline,";
}
if($reader->name == "w:color") {
$f .="color: #".$reader->getAttribute("w:val").",";
}
if($reader->name == "w:rFont") {
$f .="font-family: #".$reader->getAttribute("w:ascii").",";
}
if($reader->name == "w:shd" && $reader->getAttribute("w:val") != "clear" && $reader->getAttribute("w:fill") != "000000") {
$f .="background-color: #".$reader->getAttribute("w:fill").",";
}
$temp_rx = $reader->readInnerXml();
if($reader->name == 'w:drawing' && !empty($temp_rx)) {
$r = $this->checkImageFormating($reader);
$img = $r !== null ? "<image src='".$r."' />" : null;
}
}
$f = rtrim($f, ',');
$f .= "'>";
$t .= ($img !== null ? $img : htmlentities($xml->expand()->textContent));
return $f.$t."</span>";
}
/**
* CHECKS THE ELEMENT FOR UL ELEMENTS
* Currently under development
*
* @param XML $xml The XML node
* @return String HTML formatted code
*/
private function getListFormating(&$xml)
{
$node = trim($xml->readOuterXML());
$reader = new XMLReader();
$reader->XML($node);
$ret="";
$close = "";
while ($reader->read()){
if($reader->name == "w:numPr" && $reader->nodeType == XMLReader::ELEMENT ) {
}
if($reader->name == "w:numId" && $reader->hasAttributes) {
switch($reader->getAttribute("w:val")) {
case 1:
$ret['open'] = "<ol><li>";
$ret['close'] = "</li></ol>";
break;
case 2:
$ret['open'] = "<ul><li>";
$ret['close'] = "</li></ul>";
break;
}
}
}
return $ret;
}
/**
* CHECKS IF THERE IS AN IMAGE PRESENT
* Currently under development
*
* @param XML $xml The XML node
* @return String The location of the image
*/
private function checkImageFormating(&$xml)
{
$content = trim($xml->readInnerXml());
if (!empty($content)) {
$relId;
$notfound = true;
$reader = new XMLReader();
$reader->XML($content);
while ($reader->read() && $notfound) {
if ($reader->name == "a:blip") {
$relId = $reader->getAttribute("r:embed");
$notfound = false;
}
}
// image id found, get the image location
if (!$notfound && $relId) {
$reader = new XMLReader();
$reader->XML($this->rels_xml->saveXML());
while ($reader->read()) {
if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name=='Relationship') {
if($reader->getAttribute("Id") == $relId) {
$link = "word/".$reader->getAttribute('Target');
break;
}
}
}
$zip = new ZipArchive();
$im = null;
if (true === $zip->open($this->file)) {
$im = $this->createImage($zip->getFromName($link), $relId, $link);
}
$zip->close();
return $im;
}
}
return null;
}
/**
* Creates an image in the filesystem
*
* @param objetc $image The image object
* @param string $relId The image relationship Id
* @param string $name The image name
* @return Array With HTML open and closing tag definition
*/
private function createImage($image, $relId, $name)
{
$arr = explode('.', $name);
$l = count($arr);
$ext = mb_strtolower($arr[$l-1]);
$im = imagecreatefromstring($image);
if (empty($this->img_dir)) {
$fname = $this->tmpDir.'/tmp/'.$relId.'.'.$ext;
} else {
$ext = str_ireplace('jpeg', 'jpg', $ext);
$fname = $this->img_dir.'/'.$this->img_prex.'_'.mb_strtolower($relId).'.'.$ext;
}
switch ($ext) {
case 'png':
imagepng($im, $fname);
break;
case 'bmp':
imagebmp($im, $fname);
break;
case 'gif':
imagegif($im, $fname);
break;
case 'jpeg':
case 'jpg':
imagejpeg($im, $fname);
break;
default:
return null;
}
return $fname;
}
/**
* CHECKS IF ELEMENT IS AN HYPERLINK
*
* @param XML $xml The XML node
* @return Array With HTML open and closing tag definition
*/
private function getHyperlink(&$xml)
{
$ret = array('open'=>'<ul>','close'=>'</ul>');
$link ='';
if($xml->hasAttributes) {
$attribute = "";
while($xml->moveToNextAttribute()) {
if($xml->name == "r:id")
$attribute = $xml->value;
}
if($attribute != "") {
$reader = new XMLReader();
$reader->XML($this->rels_xml->saveXML());
while ($reader->read()) {
if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name=='Relationship') {
if($reader->getAttribute("Id") == $attribute) {
$link = $reader->getAttribute('Target');
break;
}
}
}
}
}
if($link != "") {
$ret['open'] = "<a href='".$link."' target='_blank'>";
$ret['close'] = "</a>";
}
return $ret;
}
/**
* PROCESS TABLE CONTENT
*
* @param XML $xml The XML node
* @return THe HTML code of the table
*/
private function checkTableFormating(&$xml)
{
$table = "<table><tbody>";
while ($xml->read()) {
if ($xml->nodeType == XMLREADER::ELEMENT && $xml->name === 'w:tr') { //table row
$tc = $ts = "";
$tr = new XMLReader;
$tr->xml(trim($xml->readOuterXML()));
while ($tr->read()) {
if ($tr->nodeType == XMLREADER::ELEMENT && $tr->name === 'w:tcPr') { //table element properties
$ts = $this->processTableStyle(trim($tr->readOuterXML()));
}
if ($tr->nodeType == XMLREADER::ELEMENT && $tr->name === 'w:tc') { //table column
$tc .= $this->processTableRow(trim($tr->readOuterXML()));
}
}
$table .= '<tr style="'.$ts.'">'.$tc.'</tr>';
}
}
$table .= "</tbody></table>";
return $table;
}
/**
* PROCESS THE TABLE ROW STYLE
*
* @param string $content The XML node content
* @return THe HTML code of the table
*/
private function processTableStyle($content)
{
/*border-collapse:collapse;
border-bottom:4px dashed #0000FF;
border-top:6px double #FF0000;
border-left:5px solid #00FF00;
border-right:5px solid #666666;*/
$tc = new XMLReader;
$tc->xml($content);
$style = "border-collapse:collapse;";
while ($tc->read()) {
if ($tc->name === "w:tcBorders") {
$tc2 = new SimpleXMLElement($tc->readOuterXML());
foreach ($tc2->children('w',true) as $ch) {
if (in_array($ch->getName(), array('left','top','botom','right'))) {
$line = $this->convertLine($ch['val']);
$style .= " border-".$ch->getName().":".$ch['sz']."px $line #".$ch['color'].";";
}
}
$tc->next();
}
}
return $style;
}
private function convertLine($in)
{
if (in_array($in, array('dotted')))
return "dashed";
if (in_array($in, array('dotDash','dotdotDash','dotted','dashDotStroked','dashed','dashSmallGap')))
return "dashed";
if (in_array($in, array('double','triple','threeDEmboss','threeDEngrave','thick')))
return "double";
if (in_array($in, array('nil','none')))
return "none";
return "solid";
}
/**
* PROCESS THE TABLE ROW
*
* @param string $content The XML node content
* @return THe HTML code of the table
*/
private function processTableRow($content)
{
$tc = new XMLReader;
$tc->xml($content);
$ct = "";
while ($tc->read()) {
if ($tc->name === "w:r") {
$ct .= "<td>".$this->checkFormating($tc)."</td>";
$tc->next();
}
}
return $ct;
}
/**
* READS THE GIVEN DOCX FILE INTO HTML FORMAT
*
* @param String $filename The DOCX file name
* @return String With HTML code
*/
public function readDocument($filename)
{
$this->file = $filename;
$this->readZipPart($filename);
$reader = new XMLReader();
$reader->XML($this->doc_xml->saveXML());
$text = ''; $list_format="";
$formatting['header'] = 0;
// loop through docx xml dom
while ($reader->read()) {
// look for new paragraphs
$paragraph = new XMLReader;
$p = $reader->readOuterXML();
//return $p;
if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name === 'w:p') {
// set up new instance of XMLReader for parsing paragraph independantly
$paragraph->xml($p);
preg_match('/<w:pStyle w:val="(Heading.*?[1-6])"/',$p,$matches);
if(isset($matches[1])) {
switch($matches[1]){
case 'Heading1': $formatting['header'] = 1; break;
case 'Heading2': $formatting['header'] = 2; break;
case 'Heading3': $formatting['header'] = 3; break;
case 'Heading4': $formatting['header'] = 4; break;
case 'Heading5': $formatting['header'] = 5; break;
case 'Heading6': $formatting['header'] = 6; break;
default: $formatting['header'] = 0; break;
}
}
// open h-tag or paragraph
$text .= ($formatting['header'] > 0) ? '<h'.$formatting['header'].'>' : '<p>';
// loop through paragraph dom
while ($paragraph->read()) {
// look for elements
if ($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:r') {
if($list_format == "")
$text .= $this->checkFormating($paragraph);
else {
$text .= $list_format['open'];
$text .= $this->checkFormating($paragraph);
$text .= $list_format['close'];
}
$list_format ="";
$paragraph->next();
}
else if($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:pPr') { //lists
$list_format = $this->getListFormating($paragraph);
$paragraph->next();
}
else if($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:drawing') { //images
$text .= $this->checkImageFormating($paragraph);
$paragraph->next();
}
else if ($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:hyperlink') {
$hyperlink = $this->getHyperlink($paragraph);
$text .= $hyperlink['open'];
$text .= $this->checkFormating($paragraph);
$text .= $hyperlink['close'];
$paragraph->next();
}
}
$text .= ($formatting['header'] > 0) ? '</h'.$formatting['header'].'>' : '</p>';
}
else if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name === 'w:tbl') { //tables
$paragraph->xml($p);
$text .= $this->checkTableFormating($paragraph);
$reader->next();
}
}
$reader->close();
if($this->debug) {
echo "<div style='width:100%; height: 200px;'>";
echo mb_convert_encoding($text, $this->encoding);
echo "</div>";
}
return mb_convert_encoding($text, $this->encoding);
}
}

@ -85,6 +85,14 @@ class InfoContents_model extends CI_Model
return $query;
}
//删除信息
function force_update($ic_id, $ic_content)
{
$sql = "UPDATE infoContents SET ic_content = N? WHERE ic_id = ?";
$query = $this->HT->query($sql, array($ic_content, $ic_id));
return $query;
}
//删除信息
function Delete($ic_id)
{
@ -126,7 +134,7 @@ class InfoContents_model extends CI_Model
public function get_ic_contents2($ic_id)
{
$sql="SELECT top 1 ic_id, ic_content, ic_title, ic_url, ic_photo from infoContents where ic_id=?";
$sql="SELECT top 1 ic_id, ic_content, ic_title, ic_url, ic_photo, ic_sitecode, ic_seo_description from infoContents where ic_id=?";
$query=$this->HT->query($sql,array($ic_id));
if ($query->result())
{

@ -16,7 +16,7 @@ class InfoMetas_model extends CI_Model {
. " ( \n"
. " ?, ?, N? \n"
. " )";
return $this->HT->query($sql, array($im_ic_id, $im_key, $im_value));
return $this->HT->query($sql, array($im_ic_id, $im_key, (string)$im_value));
}
function get_list($im_ic_id, $im_key) {
@ -33,6 +33,102 @@ class InfoMetas_model extends CI_Model {
$query = $this->HT->query($sql, array($im_ic_id, $im_key));
return $query->result();
}
function get_list_by_key($im_key) {
$sql = "
SELECT im.im_id
,im.im_ic_id
,im.im_key
,im.im_value
FROM infoMetas im
WHERE im.im_ic_id = ?
AND im.im_key = ?
ORDER BY im.im_id ASC
";
$query = $this->HT->query($sql, array($im_ic_id, $im_key));
return $query->result();
}
//列表所有含AMPmeta的信息。
public function list_amp($site_code) {
$sql = "
SELECT im.im_id
,im.im_ic_id
,c.ic_url
,c.ic_id
,empty_tpl = case when c.ic_template in ('r_tpl_empty', 'r_empty_container', 'r_empty2', 'r_tpl_empty_2017', 'tpl_empty', 'tpl_empty_h1', 'tpl_empty_navi_h1') then 'yes' else 'no' end
FROM infoMetas im
INNER JOIN infoContents c
ON c.ic_id = im.im_ic_id
LEFT JOIN infoMetas im2
ON im2.im_ic_id = im.im_ic_id AND im2.im_key = 'AMP_STATUS'
LEFT JOIN infoMetas im3
ON im3.im_ic_id = im.im_ic_id AND im2.im_key = 'AMP_SCHEMA'
WHERE im.im_key = 'AMP_JSON'
AND c.ic_sitecode = ?
AND c.ic_status = 1
AND CONVERT(varchar, im2.im_value) = '1'
";
$query = $this->HT->query($sql, array($site_code));
return $query->result();
}
//列表所有不含AMPmeta的信息。
public function list_no_amp($site_code) {
$sql = "
SELECT c0.ic_id, c0.ic_url
FROM infoContents c0
WHERE c0.ic_id not in (
SELECT c.ic_id
FROM infoMetas im
LEFT JOIN infoContents c
ON c.ic_id = im.im_ic_id
LEFT JOIN infoMetas im2
ON im2.im_ic_id = im.im_ic_id AND im2.im_key = 'AMP_STATUS'
LEFT JOIN infoMetas im3
ON im3.im_ic_id = im.im_ic_id AND im2.im_key = 'AMP_SCHEMA'
WHERE im.im_key = 'AMP_JSON'
AND c.ic_sitecode = ?
AND c.ic_status = 1
AND CONVERT(varchar, im2.im_value) = '1'
)
AND c0.ic_sitecode = ?
AND c0.ic_status = 1
AND c0.ic_url <> ''
AND datalength(c0.ic_content) > 0
AND CHARINDEX('search', c0.ic_url) = 0
AND CHARINDEX('faq', c0.ic_url) = 0
AND CHARINDEX('feedback', c0.ic_url) = 0
AND CHARINDEX('test', c0.ic_url) = 0
";
$query = $this->HT->query($sql, array($site_code, $site_code));
return $query->result();
}
//按节点列表信息含meta数据
function list_info_by_path_with_meta($is_path, $site_code) {
$sql = "SELECT is1.is_id, \n"
. " is1.is_path, \n"
. " ic.ic_id, \n"
. " ic.ic_url, \n"
. " ic.ic_status, \n"
. " ic.ic_template, \n"
. " ic.ic_sitecode, \n"
. " ic.ic_content, \n"
. " ic.ic_photo, \n"
. " ic.ic_title, \n"
. " ic.ic_type, \n"
. " im.im_id \n"
. " FROM infoStructures is1 \n"
. " INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id \n"
. " AND ic.ic_sitecode = is1.is_sitecode \n"
. " LEFT JOIN infoMetas im ON im.im_ic_id = ic.ic_id AND im.im_key=?"
. " WHERE is1.is_path LIKE '$is_path%' AND is_sitecode = ? AND ic_status = 1"
. " ORDER BY is1.is_level, is1.is_sort, is1.is_path";
$query = $this->HT->query($sql, array('AMP_JSON', $site_code));
//print_r($this->HT->queries);
return $query->result();
}
function get($im_ic_id, $im_key) {
$sql = "SELECT im.im_value \n"
@ -81,7 +177,7 @@ class InfoMetas_model extends CI_Model {
. "SET im_value = N? \n"
. "WHERE im_ic_id = ? \n"
. " AND im_key = ?";
return $this->HT->query($sql, array($im_value, $im_ic_id, $im_key));
return $this->HT->query($sql, array((string)$im_value, $im_ic_id, $im_key));
}
function delete($im_ic_id, $im_key) {

@ -74,14 +74,14 @@ class Information_model extends CI_Model {
}
//根据根节点路径获取子节点列表
function get_list_by_path($path, $level = false) {
function get_list_by_path($path, $level = false, $site_code = false) {
$this->init();
if ($level !== false) {
$this->level = " AND is1.is_level= '$level' ";
}
$this->path = " AND is1.is_path LIKE '$path%' ";
$this->orderBy = ' ORDER BY is1.is_level ASC, is1.is_sort ASC,is1.is_path ASC ';
return $this->GetList();
return $this->GetList('', $site_code);
}
//根据路径获取某一级别节点详细页
@ -129,7 +129,7 @@ class Information_model extends CI_Model {
return $this->GetList();
}
function GetList($filed = "") {
function GetList($filed = "", $site_code = "") {
$this->topNum ? $sql = "SELECT TOP " . $this->topNum : $sql = "SELECT ";
if (empty($filed)) {
$sql .= " is1.is_id, \n"
@ -164,10 +164,14 @@ class Information_model extends CI_Model {
. " ic.ic_ht_area_type, \n"
. " ic.ic_ht_product_id, \n"
. " ic.ic_ht_product_type, \n"
. " ic.SRMS_SIC_Code, \n"
. " ic.SRMS_SIIT_Code, \n"
. " ic.ic_author \n";
} else {
$sql.=" $filed ";
}
//添加查询AMP发布状态
$sql.=",isnull((select top 1 CONVERT(varchar, im_value) from infoMetas where im_ic_id=ic_id and im_key='AMP_STATUS'),0) as amp_status ";
$sql.="FROM infoStructures is1 \n"
. " INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id \n"
. " AND ic.ic_sitecode = is1.is_sitecode \n"
@ -187,7 +191,7 @@ class Information_model extends CI_Model {
$this->orderBy ? $sql.=$this->orderBy : false;
$query = $this->HT->query($sql, array($this->config->item('site_code')));
$query = $this->HT->query($sql, array($site_code ? $site_code : $this->config->item('site_code')));
//print_r($this->HT->queries);
if ($this->topNum === 1) {
if ($query->num_rows() > 0) {
@ -357,4 +361,54 @@ class Information_model extends CI_Model {
return $query->result();
}
//ct
function ct_get_by_url($ic_url,$webcode)
{
$this->ic_url_is_id=" AND ic.ic_url = N".$this->HT->escape($ic_url);
$sql = "SELECT is1.is_id, \n"
. " is1.is_parent_id, \n"
. " is1.is_path, \n"
. " is1.is_level, \n"
. " is1.is_sort, \n"
. " is1.is_sitecode, \n"
. " is1.is_datetime, \n"
. " is1.is_ic_id, \n"
. " ic.ic_id, \n"
. " ic.ic_url, \n"
. " ic.ic_url_title, \n"
. " ic.ic_type, \n"
. " ic.ic_title, \n"
. " ic.ic_content, \n"
. " ic.ic_summary, \n"
. " ic.ic_seo_title, \n"
. " ic.ic_seo_description, \n"
. " ic.ic_seo_keywords, \n"
. " ic.ic_show_bread_crumbs, \n"
. " ic.ic_status, \n"
. " ic.ic_template, \n"
. " ic.ic_photo, \n"
. " ic.ic_photo_width, \n"
. " ic.ic_photo_height, \n"
. " ic.ic_sitecode, \n"
. " ic.ic_recommend_tours, \n"
. " ic.ic_recommend_packages, \n"
. " ic.ic_datetime, \n"
. " ic.ic_ht_area_id, \n"
. " ic.ic_ht_area_type, \n"
. " ic.ic_ht_product_id, \n"
. " ic.ic_ht_product_type, \n"
. " ic.ic_author \n"
. " FROM infoStructures is1 \n"
. " INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id \n"
. " AND ic.ic_sitecode = is1.is_sitecode \n"
. " WHERE is1.is_sitecode = ? ";
$sql .= $this->ic_url_is_id;
$query = $this->HT->query($sql, $webcode);
// print_r($this->HT->queries);
return $query->row();
}
}

@ -59,6 +59,24 @@ class Orders_model extends CI_Model {
}
}
//获取当天商务订单
function biz_count() {
$date_start = date('Y-m-d', time() - 86400);//减一天
$date_end = date('Y-m-d', time() + 86400);//加一天
$sql = "
SELECT COUNT(1) AS CLI_COUNT
FROM BIZ_ConfirmLineInfo bcli
WHERE bcli.COLI_ApplyDate BETWEEN '$date_start 00:00:00' AND '$date_end 23:59:59'
";
$query = $this->HT->query($sql);
if ($query->num_rows() > 0) {
$row = $query->row();
return $row->CLI_COUNT;
} else {
return FALSE;
}
}
//获取当天商务订单
function get_biz_info($sitecode) {
$sql = "SELECT bcli.COLI_ID, n"

@ -0,0 +1,301 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
//数据接口
define("DATAUSER","guilintravel");
define("DATAKEY","0dbf1652763c2289533e27437a971854");
//订单接口
define("ORDERUSER","guilintravel");
define("ORDERKEY","07f811fe29f04008a8fcc86e81c012b9");
//数据返回格式地址
define("JSONRETURN","http://m.ctrip.com/restapi/soa2/12976/json/");
define("XMLRETURN","http://m.ctrip.com/restapi/soa2/12976/xml/");
class ctrip_train extends CI_Controller{
public function __construct(){
parent::__construct();
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST, GET');
header('Access-Control-Max-Age:0');
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
header('Access-Control-Allow-Credentials:true');
$this->load->helper('ctrip');
$this->load->model("ctrip_model");
date_default_timezone_set('PRC');
}
public function index(){
exit('hello ctrip');
}
//查询车次余票
public function search(){
//接收参数
$date = $this->input->get_post('date');
$from = $this->input->get_post('from');
$to = $this->input->get_post('to');
$TrainNo = $this->input->get_post('TrainNo');
if(!$date || !$from || !$to){
header("HTTP/1.1 404 Not Found");
exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}');
}else{
$isCache = false;
$iseven = false;
$cachedata = false;
$now_time = time();
$differ = (strtotime($date) - $now_time) / 86400;
if($differ > 29){
$date = date('Y-m-d',strtotime('+7day'));
$iseven = true;
}
//转换三字码为中文
$FromName = $this->ctrip_model->ReplaceCodeToName($from);
$ToName = $this->ctrip_model->ReplaceCodeToName($to);
if(!$FromName || !$ToName){
header("HTTP/1.1 404 Not Found");
exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}');
}else{
$from = $FromName->station_name;
$to = $ToName->station_name;
}
//生成请求链接
$TimeStamp = time();
$Sign = md5($TimeStamp.DATAKEY);
$url = JSONRETURN.'SearchS2S/?From='.urlencode($from).'&To='.urlencode($to).'&DepartDate='.$date.'&User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign;
$api_start_time = microtime(true);
//获取数据
$ResponseJson = post_ctrip($url,'','GET');
$api_end_time = microtime(true);
$ResponseData = json_decode($ResponseJson);
$api_responsive_time = $api_end_time - $api_start_time;
//print_r($ResponseData);die();
if(empty($ResponseData->Trains)){
log_message('error','ctrip_trian|status:trains is empty |相应时间:'.$api_responsive_time);
}else{
log_message('error','ctrip_trian|status:'.$ResponseData->ResponseStatus->Ack.'|相应时间:'.$api_responsive_time);
}
//定义返回的json
$ReturnData = new stdClass();
$ReturnData->httpstatus = 200;
$ReturnData->data = new stdClass();
$ReturnData->data->seven = $iseven;
$ReturnData->data->cache = $isCache;
$ReturnData->data->result = array();
$ReturnData->data->map = new stdClass();
$obj = array();
$i = 0;
$PriceStr = '';
//数据解析
if(!empty($ResponseData->Trains)){
foreach ($ResponseData->Trains as $TrainInfo){
$obj[$TrainInfo->FromTelcode] = $TrainInfo->FromStationName;
$obj[$TrainInfo->ToTelcode] = $TrainInfo->ToStationName;
$SeaType = '';
$gjrwNum = $rwNum = $rzNum = $tdzNum = $wzNum = $yzNum = $edzNum = $ydzNum = $swzNum = $ywNum = $dwNum = null;
foreach($TrainInfo->Seats as $Seats){
if($Seats->SeatName == '高级软卧下'){
$gjrwXiaPrice = $Seats->Price * 10;
$SeaType .= '"6":"'.$gjrwXiaPrice.'","A6":"¥'.$Seats->Price.'",';
$gjrwNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '软卧下'){
$rwPrice = $Seats->Price * 10;
$SeaType .= '"4":"'.$rwPrice.'","A4":"¥'.$Seats->Price.'",';
$rwNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '软座'){
$rzPrice = $Seats->Price * 10;
$SeaType .= '"2":"'.$rzPrice.'","A2":"¥'.$Seats->Price.'",';
$rzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '特等座'){
$SeaType .= '"P":"¥'.$Seats->Price.'",';
$tdzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '无座'){
$SeaType .= '"WZ":"¥'.$Seats->Price.'",';
$wzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '硬座'){
$yzPrice = $Seats->Price * 10;
$SeaType .= '"1":"'.$yzPrice.'","A1":"¥'.$Seats->Price.'",';
$yzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '二等座'){
$SeaType .= '"O":"¥'.$Seats->Price.'",';
$edzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '一等座'){
$SeaType .= '"M":"¥'.$Seats->Price.'",';
$ydzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '商务座'){
$swzPrice = $Seats->Price * 10;
$SeaType .= '"9":"'.$swzPrice.'","A9":"¥'.$Seats->Price.'",';
$swzNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '硬卧下'){
$ywPrice = $Seats->Price * 10;
$SeaType .= '"3":"'.$ywPrice.'","A3":"¥'.$Seats->Price.'",';
$ywNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '动卧下'){
$SeaType .= '"F":"¥'.$Seats->Price.'",';
$dwNum = $Seats->TicketLeft;
}
$PriceStr = $SeaType.'"train_no":'.'"'.$TrainInfo->TrainNo.'"';
}
//对返回的数据进行容错处理
$gjrwNum = isset($gjrwNum) ? ticket_exchange($gjrwNum,$iseven) : '';
$rwNum = isset($rwNum) ? ticket_exchange($rwNum,$iseven) : '';
$rzNum = isset($rzNum) ? ticket_exchange($rzNum,$iseven) : '';
$tdzNum = isset($tdzNum) ? ticket_exchange($tdzNum,$iseven) : '';
$wzNum = isset($wzNum) ? ticket_exchange($wzNum,$iseven) : '';
$ywNum = isset($ywNum) ? ticket_exchange($ywNum,$iseven) : '';
$yzNum = isset($yzNum) ? ticket_exchange($yzNum,$iseven) : '';
$edzNum = isset($edzNum) ? ticket_exchange($edzNum,$iseven) : '';
$ydzNum = isset($ydzNum) ? ticket_exchange($ydzNum,$iseven) : '';
$swzNum = isset($swzNum) ? ticket_exchange($swzNum,$iseven) : '';
$dwNum = isset($dwNum) ? ticket_exchange($dwNum,$iseven) : '';
$runMin = $TrainInfo->DurationMinutes % 60;
$runHour = ($TrainInfo->DurationMinutes - $runMin) / 60;
$ReturnData->data->result[$i] = '|预定|'.$TrainInfo->Train12306No.'|'.$TrainInfo->TrainNo.'|'.$TrainInfo->FromStationName.'|'.$TrainInfo->ToStationName.'|'.$TrainInfo->FromTelcode.'|'.$TrainInfo->ToTelcode.'|'.$TrainInfo->StartTime.'|'.$TrainInfo->ArriveTime.'|'.$runHour.':'.$runMin.'|'.$TrainInfo->CanWebBuy.'||'.date('Ymd',strtotime($date)).'||||||||'.$gjrwNum.'||'.$rwNum.'|'.$rzNum.'|'.$tdzNum.'|'.$wzNum.'||'.$ywNum.'|'.$yzNum.'|'.$edzNum.'|'.$ydzNum.'|'.$swzNum.'|'.$dwNum.'||';
$data = '{"validateMessagesShowId":"_validatorMessage","status":true,"httpstatus":200,"data":{'.$PriceStr.'},"messages":[],"validateMessages":{}}';
$ReturnData->data->price[$i] = $data;
$i++;
}
}
//print_r($ResponseData);
$ReturnData->data->map = (object)$obj;
print_r(json_encode($ReturnData));
}
}
//查询经停站
public function getstopstation(){
//接收参数
$DepartDate = $this->input->get_post('DepartDate');
$TrainNo = $this->input->get_post('TrainNo');
if(!$DepartDate || !$TrainNo){
exit('传参错误!');
}else{
//生成请求链接
$TimeStamp = time();
$Sign = md5($TimeStamp.DATAKEY);
$url = JSONRETURN.'GetStopStations/?DepartDate='.$DepartDate.'&TrainNo='.$TrainNo.'&User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign;
$ResponseJson = post_ctrip($url,'','GET');
$ResponseData = json_decode($ResponseJson);
//构造12306格式
$ReturnData = array();
$ReturnData['validateMessagesShowId'] = '_validatorMessage';
$ReturnData['status'] = true;
$ReturnData['httpstatus'] = 200;
$ReturnData['data'] = array();
$i = 0;
$Last_num = count($ResponseData->StopStations);
foreach($ResponseData->StopStations as $items){
if($i == 0){
$ReturnData['data']['data'][$i]['start_station_name'] = $items->StationName;
$ReturnData['data']['data'][$i]['station_train_code'] = $TrainNo;
$ReturnData['data']['data'][$i]['end_station_name'] = $ResponseData->StopStations[$Last_num-1]->StationName;
}
$ReturnData['data']['data'][$i]['arrive_time'] = $items->ArrivalTime;
$ReturnData['data']['data'][$i]['station_name'] = $items->StationName;
$ReturnData['data']['data'][$i]['start_time'] = $items->StartTime;
$ReturnData['data']['data'][$i]['stopover_time'] = $items->StopMinutes;
$ReturnData['data']['data'][$i]['station_no'] = $items->StationNo;
$ReturnData['data']['data'][$i]['isEnabled'] = true;
$i++;
}
$ReturnData['messages'] = array();
$ReturnData['validateMessages'] = new stdClass();
print_r(json_encode($ReturnData));
}
}
//获取所有站点信息
public function getallstation(){
//生成请求参数
$TimeStamp = time();
$Sign = md5($TimeStamp.DATAKEY);
$url = JSONRETURN.'/GetAllStations/?&User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign;
$ResponseJson = post_ctrip($url,'','GET');
$ResponseData = json_decode($ResponseJson);
$data = array();
foreach ($ResponseData->Stations as $items){
$data['StationName'] = isset($items->StationName) ? checkNull($items->StationName) : '';
$data['PinYin'] = isset($items->PinYin) ? checkNull($items->PinYin) : '';
$data['Telecode'] = isset($items->Telecode) ? checkNull($items->Telecode) : '';
$data['Address'] = isset($items->Address) ? checkNull($items->Address) : '';
$data['Geography'] = isset($items->Geography) ? checkNull($items->Geography) : '';
$this->ctrip_model->AddOrUpdate($data);
}
}
//查询中转方案
public function gettraintrainsfer(){
$FromCode = $this->input->get_post('FromCode');
$ToCode = $this->input->get_post('ToCode');
$DepartDate = $this->input->get_post('DepartDate');
if(!$FromCode || !$ToCode || !$DepartDate){
exit('传参错误!');
}else{
$TimeStamp = time();
$Sign = md5($TimeStamp.DATAKEY);
$FromName = $this->ctrip_model->ReplaceCodeToName($FromCode);
$ToName = $this->ctrip_model->ReplaceCodeToName($ToCode);
$From = $FromName->station_name;
$To = $ToName->station_name;
$url = JSONRETURN.'GetTrainTransfer?User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign.'&From='.urlencode($From).'&To='.urlencode($To).'&DepartDate='.$DepartDate;
$ResponseJson = post_ctrip($url,'','GET');
//$ResponseData = json_decode($ResponseJson);
print_r($ResponseJson);
}
}
}

@ -0,0 +1,81 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//中文转换为座位简码
/*
硬座、软座、二等座、一等座、特等座、商务座、硬卧、软卧、高级软卧、棚车、包厢硬卧、一等软座、二等软座、高级动卧、混编硬座、混编硬卧、包厢软座、特等软座、动卧、二人软包、一人软包、一等双软、二等双软、混编软座、混编软卧、观光座、一等包座、无座、硬卧上、硬卧中、硬卧下、软卧上、软卧下、高级软卧上、高级软卧下、高级动卧上、高级动卧下、动卧上、动卧下
*/
function ReplaceToCode($SeatName){
}
//验证站点信息是否为空
function checkNull($info){
if(empty($info)){
return '';
}else{
return $info;
}
}
//验证参数是否存在并且是否为数字
function checkNum($num){
if(isset($num)){
if(is_numeric($num)){
return true;
}else{
return false;
}
}else{
return false;
}
}
//余票转换
function ticket_exchange($num,$iseven){
if($iseven){
return '有';
}else{
if(is_numeric($num)){
if($num == 0){
return '无';
}elseif($num >= 99){
return '有';
}else{
return $num;
}
}
}
}
//发送请求函数
function post_ctrip($url, $data = '', $method = 'GET') {
$user_agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1";
if(isset($_SERVER['HTTP_USER_AGENT'])) {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
}
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_USERAGENT, $user_agent); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
if ($method == 'POST' && !empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
}
curl_setopt($curl, CURLOPT_TIMEOUT, 40); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_TIMEOUT_MS, 40000); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作
$errno = curl_errno($curl);
if ($errno !== 0) {
log_message('error', 'ctripost'.$errno.curl_error($curl));
}
curl_close($curl); //关闭CURL会话
return $tmpInfo; //返回数据
}
?>

@ -0,0 +1,68 @@
<?php
class ctrip_model extends CI_Model {
function __construct() {
parent::__construct();
$this->INFO = $this->load->database('INFO', TRUE);
}
//新增或更新缓存
public function AddOrUpdate($data){
$sql = "IF NOT EXISTS(
SELECT 1
FROM train_stations
WHERE
station_telecode = '{$data['Telecode']}'
) BEGIN
INSERT INTO train_stations
(
station_name,
station_telecode,
station_geography,
station_pinyin,
station_address
)
VALUES
(
'{$data['StationName']}','{$data['Telecode']}','{$data['Geography']}','{$data['PinYin']}','{$data['Address']}'
)
END
ELSE
BEGIN
UPDATE train_stations
SET station_name = '{$data['StationName']}',
station_geography = '{$data['Geography']}',
station_pinyin = '{$data['PinYin']}',
station_address = '{$data['Address']}'
WHERE
station_telecode = '{$data['Telecode']}'
END
";
$query = $this->INFO->query($sql);
return $query;
}
//获取缓存的火车信息
//如果读取到缓存是7天以前的数据就不返回任何数据并且将其删除。
public function get_train_cache($tpc_from_station,$tpc_to_station){
$sql = "SELECT
*
FROM
TrainPriceCache
WHERE
tpc_from_station = '$tpc_from_station'
AND
tpc_to_station = '$tpc_to_station'";
$query = $this->INFO->query($sql);
return $query->row();
}
//根据三字码获取车站中文名
public function ReplaceCodeToName($code){
$sql = "SELECT station_name from train_stations where station_telecode = '{$code}'";
$query = $this->INFO->query($sql);
return $query->row();
}
}
?>

@ -1,146 +1,334 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Index extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('simple_html_dom_lib');
}
public function index() {
$this->load->view('welcome');
}
public function optimize() {
$htmlsource = $this->input->post('htmlsource');
$websitehost = $this->input->post('websitehost');
if (empty($htmlsource) || empty($websitehost)) {
$this->output->set_status_header(500);
echo 'error:htmlsource or websitehost is empty!';
log_message('error', "htmlsource or websitehost is empty! " . $websitehost);
return false;
}
//域名后面不能有/
if (substr($websitehost, -1, 1) == '/') {
$websitehost = substr($websitehost, 0, -1);
}
$html_object = str_get_html($htmlsource);
if (!empty($html_object)) {
//提取和下载所有CSS样式包括链接文件和页面样式
$link_css_array = array();
$css_content = '';
foreach ($html_object->find('link') as $link_css) {
if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//print_r($link_css_array);
foreach ($link_css_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content.=$get_http_temp;
}
foreach ($html_object->find('style') as $style_css) {
if ($style_css->type == "text/css") {
$css_content .= $style_css->innertext;
}
}
// echo $css_content;
// echo $html_object;die();
//
//提取和下载所有JS脚本包括链接文件和页面脚本
$link_js_array = array();
$js_inline_content = '';
$js_jquery_content = '';
foreach ($html_object->find('script') as $link_script) {
if (!empty($link_script->src)) {
if(empty($link_script->defer) && empty($link_script->async)){ //没有defer标记的才处理否则让js延后加载
$link_js_array[] = $link_script->src;
$link_script->outertext = ''; //删除链接,移动到页底
}
} else {
//网页内的js不需要提取
//$js_content.= $link_script->innertext;//js的内容
// $js_content.= $link_script;//js的内容包含<script>
//含有$表示调用了jquery的函数添加延迟加载defer
if (strpos($link_script, '$') !== FALSE) {
$js_jquery_content.= $link_script->innertext;
} else {
$js_inline_content.= $link_script; //js的内容包含<script>
}
$link_script->outertext = ''; //删除js移动到页底
}
}
$js_scr_content = '';
foreach ($link_js_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'JS文件下载错误';
log_message('error', "optimize js文件下载错误! " . $item);
return FALSE;
}
$js_scr_content.=$get_http_temp;
}
//echo $js_content;
//把网页内容和css提交到purifycss处理
$optimize_css = GET_HTTP('http://184.172.113.219:33033/', 'html_source=' . urlencode($htmlsource) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
//把精简的css添加到head前面
$html_object = str_replace('</head>', '<style type="text/css">' . $optimize_css . "</style></head>", $html_object);
//删除多余空格和换行符
$html_object = str_replace(array(" ", "\t", "\n", "\r"), " ", $html_object);
//循环n次把双空格替换为一个空格
for ($i = 0; $i <= 4; $i++) {
$html_object = str_replace(" ", " ", $html_object);
}
//在最后加载原始css文件和js文件
//把css移动到页面底部延迟加载
$lastload_js = '<noscript id="deferred-styles">';
foreach ($link_css_array as $item) {
$lastload_js.='<link rel="stylesheet" type="text/css" href="' . $item . '"/>';
}
$lastload_js.='</noscript><script>var loadDeferredStyles=function(){var addStylesNode=document.getElementById("deferred-styles");var replacement=document.createElement("div");replacement.innerHTML=addStylesNode.textContent;document.body.appendChild(replacement);addStylesNode.parentElement.removeChild(addStylesNode)};var raf=requestAnimationFrame||mozRequestAnimationFrame||webkitRequestAnimationFrame||msRequestAnimationFrame;if(raf){raf(function(){window.setTimeout(loadDeferredStyles,0)})}else{window.addEventListener("load",loadDeferredStyles)};</script>';
$js_content = $js_scr_content . $js_jquery_content;
//延迟加载js需要把返回的js代码保存到一个文件中然后替换占位符以便加载js文件
$lastload_js.='<script async src="##DEFERSCRIPTDEFER##"></script>';
$lastload_js.=$js_inline_content;
$html_object = str_replace('</body>', $lastload_js . '</body>', $html_object);
}
echo json_encode(array('result' => 'ok', 'data' => array('html_object' => $html_object, 'js_content' => $js_content)));
}
//格式化url保证请求的URL有域名//更换为对应的域名路径
function format_url($url, $host = '') {
if (substr($url, 0, 8) == 'https://' || substr($url, 0, 7) == 'http://') {
return urldecode($url);
}
if (substr($url, 0, 2) == '//') { //https或http
return urldecode(str_replace('//', 'http://', $url));
}
return urldecode($host . $url);
}
}
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Index extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->library('simple_html_dom_lib');
}
public function index()
{
$this->load->view('welcome');
}
public function optimize()
{
$htmlsource = $this->input->post('htmlsource');
$websitehost = $this->input->post('websitehost');
$template_name = $this->input->post('template_name');
$create_amp = $this->input->post('create_amp');
$debug = $this->input->post('debug');
if (empty($htmlsource) || empty($websitehost)) {
$this->output->set_status_header(500);
echo 'error:htmlsource or websitehost is empty!';
log_message('error', "htmlsource or websitehost is empty! " . $websitehost);
return false;
}
//域名后面不能有/
if (substr($websitehost, -1, 1) == '/') {
$websitehost = substr($websitehost, 0, -1);
}
$html_object = str_get_html($htmlsource);
if (!empty($html_object)) {
//提取和下载所有CSS样式包括链接文件和页面样式
$link_css_array = array();
$css_content = '';
foreach ($html_object->find('link') as $link_css) {
if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//print_r($link_css_array);
foreach ($link_css_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
foreach ($html_object->find('style') as $style_css) {
if ($style_css->type == "text/css") {
$css_content .= $style_css->innertext;
}
}
// echo $css_content;
// echo $html_object;die();
//
//提取和下载所有JS脚本包括链接文件和页面脚本
$link_js_array = array();
$js_inline_content = '';
$js_jquery_content = '';
foreach ($html_object->find('script') as $link_script) {
if (!empty($link_script->src)) {
if (empty($link_script->defer) && empty($link_script->async)) { //没有defer标记的才处理否则让js延后加载
$link_js_array[] = $link_script->src;
$link_script->outertext = ''; //删除链接,移动到页底
}
} else {
//网页内的js不需要提取
//$js_content.= $link_script->innertext;//js的内容
// $js_content.= $link_script;//js的内容包含<script>
//含有$表示调用了jquery的函数添加延迟加载defer
//包含gtm的js引入就跳出本次循环
if(strpos($link_script, 'https://www.googletagmanager.com/gtm.js')){
continue;
}
if (strpos($link_script, '$') !== FALSE) {
$js_jquery_content .= $link_script->innertext;
} else {
$js_inline_content .= $link_script; //js的内容包含<script>
}
$link_script->outertext = ''; //删除js移动到页底
}
}
$js_scr_content = '';
foreach ($link_js_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'JS文件下载错误';
log_message('error', "optimize js文件下载错误! " . $item);
return FALSE;
}
$js_scr_content .= $get_http_temp;
}
//echo $js_content;
//把网页内容和css提交到purifycss处理
$purifycss_server = 'http://184.172.113.216:33033/';
if (strpos($websitehost, 'chinarundreisen.com') !== false) {//德语站点使用自己的css处理服务器
$purifycss_server = 'http://158.177.67.52:33033/';
}
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($htmlsource) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
//把精简的css添加到head前面
$html_object = str_replace('</head>', '<style type="text/css">' . $optimize_css . "</style></head>", $html_object);
//删除多余空格和换行符
$html_object = str_replace(array(" ", "\t", "\n", "\r"), " ", $html_object);
//循环n次把双空格替换为一个空格
for ($i = 0; $i <= 4; $i++) {
$html_object = str_replace(" ", " ", $html_object);
}
//在最后加载原始css文件和js文件
//把css移动到页面底部延迟加载
$lastload_js = '<noscript id="deferred-styles">';
foreach ($link_css_array as $item) {
$lastload_js .= '<link rel="stylesheet" type="text/css" href="' . $item . '"/>';
}
$lastload_js .= '</noscript><script>var loadDeferredStyles=function(){var addStylesNode=document.getElementById("deferred-styles");var replacement=document.createElement("div");replacement.innerHTML=addStylesNode.textContent;document.body.appendChild(replacement);addStylesNode.parentElement.removeChild(addStylesNode)};var raf=requestAnimationFrame||mozRequestAnimationFrame||webkitRequestAnimationFrame||msRequestAnimationFrame;if(raf){raf(function(){window.setTimeout(loadDeferredStyles,0)})}else{window.addEventListener("load",loadDeferredStyles)};</script>';
$js_content = $js_scr_content . $js_jquery_content;
//延迟加载js需要把返回的js代码保存到一个文件中然后替换占位符以便加载js文件
$lastload_js .= '<script async src="##DEFERSCRIPTDEFER##"></script>';
$lastload_js .= $js_inline_content;
$html_object = str_replace('</body>', $lastload_js . '</body>', $html_object);
}
//只返回AMP代码
if (!empty($create_amp)) {
$amp = $this->create_amp($html_object, $template_name, $websitehost,$debug);
echo json_encode(array('result' => 'ok', 'data' => array('amp' => $amp)));
return;
}
echo json_encode(array('result' => 'ok', 'data' => array('html_object' => $html_object, 'js_content' => $js_content)));
}
//格式化url保证请求的URL有域名//更换为对应的域名路径
function format_url($url, $host = '')
{
if (substr($url, 0, 8) == 'https://' || substr($url, 0, 7) == 'http://') {
$url = str_replace('http://', 'https://', $url);//http要改为https
return urldecode($url);
}
if (substr($url, 0, 2) == '//') { //https或http
return urldecode('https://'.substr($url, 2, strlen($url)-2)); //只替换开头的//部分url不规范有//在url中间
}
return urldecode($host . $url);
}
//生成AMP版本 用移动端版本生成
/*
1.加载站点AMP模板模板只有导航、头部、底部
2.删除全部js引用和内链代码
3.删除全部css引用内联css放入<style amp-custom>
4.图片全部替换成amp-img设置宽高设置layout="responsive"
5.去掉所有元素中的style
6.去掉样式表中的!important
7.替换读取源文件title description keywords canonical
8.todo:增加application/ld+json
要求: 图片文件必须带有域名,否则的获取尺寸会出错,如 https://data.asiahighlights.com/pic/abc.jpg
*/
//$htmlsource 移动端版本的HTML对象 $cache_path AMP文件保存路径
function create_amp($htmlsource, $site_code, $websitehost,$debug=false)
{
$html_object = str_get_html($htmlsource);
//读取站点的AMP模板
$amp_template = $this->load->view('amp-template/' . $site_code, null, true);
//生成移动版本,删除多余元素
foreach ($html_object->find('.hidden-xs') as $hidden_item) {
$hidden_item->outertext = '';
}
foreach ($html_object->find('title') as $title) {
$amp_template = str_replace('<!--@TITLE@-->', $title->innertext, $amp_template);
}
foreach ($html_object->find('meta') as $meta) {
if ($meta->name == 'description') {
$amp_template = str_replace('<!--@DESCRIPTION@-->', $meta->content, $amp_template);
}
if ($meta->name == 'keywords') {
$amp_template = str_replace('<!--@KEYWORDS@-->', $meta->content, $amp_template);
}
}
foreach ($html_object->find('script') as $script) {
$script->outertext = '';
}
foreach ($html_object->find('noscript') as $noscript) {
$noscript->outertext = '';
}
foreach ($html_object->find('link') as $link) {
if ($link->rel == 'stylesheet' && !empty($link->href)) {
$link->outertext = '';
}
if ($link->rel == 'canonical' && !empty($link->href)) {
$amp_template = str_replace('<!--@CANONICAL@-->', $link->href, $amp_template);
}
}
$style_content = '';
foreach ($html_object->find('style') as $style) {
$style_content .= $style->innertext;
$style->outertext = '';
}
$style_content = str_replace('!important', '', $style_content);
$style_content = str_replace('@charset "utf-8";', '', $style_content);
$amp_template = str_replace('/*@CUSTOM-CSS@*/', $style_content, $amp_template);
//获取图片尺寸AMP要求必须填写width和height
//格式化图片URL
foreach ($html_object->find('img') as $image) {
if (!empty($image->src)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) {
$img_src_host = $websitehost;
}
$image->src = $this->format_url($image->src, $img_src_host);
}
if (!empty($image->originalsrc)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) {
$img_src_host = $websitehost;
}
$image->originalsrc = $this->format_url($image->originalsrc, $img_src_host);
}
}
//拼接请求的图片url如 https://data.asiahighlights.com/imagesize.php?photo=/pic/logo-ah.png,/pic/ah-slide-logo.png
$request_size = array();
foreach ($html_object->find('img') as $image) {
$img_src = $image->src;
if (!empty($image->originalsrc)) {
$img_src = $image->originalsrc;
}
if (strpos($img_src, 'facebook.com') !== false || strpos($img_src, 'dmca.com') !== false) {//facebook dmca会添加一个跟踪代码需要删除掉否则获取图片尺寸会报错
$image->outertext = '';
continue;
}
$img_src_urls = parse_url($img_src);
$request_size[$img_src_urls['host']][] = $img_src_urls['path'];
}
if($debug){
print_r($request_size);
}
//请求图片尺寸
$image_sizes = array();
foreach ($request_size as $host => $path) {
$parse_url = "https://{$host}/imagesize.php?photo=" . implode(',', $path);
$size_data = GET_HTTP($parse_url);
if (!empty($size_data)) {
$size_data = json_decode($size_data);
foreach ($size_data as $size_item) {
$size_item->photo = "https://{$host}" . $size_item->photo;
$image_sizes[$size_item->photo] = $size_item;
}
}
}
if($debug){
print_r($image_sizes);
}
//获取图片尺寸 end
foreach ($html_object->find('img') as $image) {
$img_src = $image->src;
if (!empty($image->originalsrc)) {
$img_src = $image->originalsrc;
}
if(empty($image_sizes[$img_src])){
//如果尺寸不存在则跳过
continue;
}
$img_size = $image_sizes[$img_src];
$img_alt = $image->alt;
$img_class = $image->class;
if (!empty($img_size)) {
//添加webp图片支持
$img_src_webp='';
if(substr($img_src, -4) == '.jpg'){
$img_src_jpg=" <amp-img fallback layout=\"responsive\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
$img_src_webp=substr($img_src, 0, strlen($img_src) - 4).'.webp';
$img_src_webp = " <amp-img layout=\"responsive\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src_webp}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\">{$img_src_jpg}</amp-img>";
}
if(!empty($img_src_webp)){
$image->outertext =$img_src_webp;
}else{
$image->outertext = " <amp-img layout=\"responsive\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
}
}
}
foreach ($html_object->find('#content_main') as $content_main) {
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
}
//替换掉写在组件上的样式
$amp_template = preg_replace('/style=.+?[\'|"]/i', '', $amp_template);
return $amp_template;
}
}

@ -0,0 +1,394 @@
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Index_gm extends CI_Controller
{
public function __construct(){
parent::__construct();
$this->load->library('simple_html_dom_lib');
}
public function index(){
$this->load->view('welcome');
}
//选择处理方式
public function choose_way(){
$this->htmlsource = $this->input->post('htmlsource');
$this->websitehost = $this->input->post('websitehost');
$this->template_name = $this->input->post('template_name');
$this->create_amp = $this->input->post('create_amp');
$this->debug = $this->input->post('debug');
/*$this->htmlsource = file_get_contents('aa.htm');
$this->websitehost = 'https://data.chinarundreisen.com';
$this->create_amp = 'true';
$this->template_name = 'gm';*/
if (empty($this->htmlsource) || empty($this->websitehost)) {
$this->output->set_status_header(500);
echo 'error:htmlsource or websitehost is empty!';
log_message('error', "htmlsource or websitehost is empty! " . $this->websitehost);
return false;
}
//域名后面不能有/
if (substr($this->websitehost, -1, 1) == '/') {
$this->websitehost = substr($this->websitehost, 0, -1);
}
//进行页面解析
$this->html_object = str_get_html($this->htmlsource);
//PC或AMP的构造方式
if (!empty($this->create_amp)) {
echo $this->create_amp();
return;
}else{
echo $this->optimize();
return;
}
}
//html优化处理
function optimize(){
//提取css样式地址
$link_css_array = array();
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
//找出所有style写的内置样式
foreach ($this->html_object->find('style') as $style_css) {
if ($style_css->type == "text/css") {
$css_content .= $style_css->innertext;
}
}
//提取和下载所有JS脚本包括链接文件和页面脚本
$link_js_array = array();
$js_inline_content = '';
$js_jquery_content = '';
foreach ($this->html_object->find('script') as $link_script) {
if (!empty($link_script->src)) {
if (empty($link_script->defer) && empty($link_script->async)) { //没有defer标记的才处理否则让js延后加载
$link_js_array[] = $link_script->src;
$link_script->outertext = ''; //删除链接,移动到页底
}
} else {
//网页内的js不需要提取
//$js_content.= $link_script->innertext;//js的内容
// $js_content.= $link_script;//js的内容包含<script>
//含有$表示调用了jquery的函数添加延迟加载defer
//包含gtm的js引入就跳出本次循环
if(strpos($link_script, 'https://www.googletagmanager.com/gtm.js')){
continue;
}
if (strpos($link_script, '$') !== FALSE) {
$js_jquery_content .= $link_script->innertext;
} else {
$js_inline_content .= $link_script; //js的内容包含<script>
}
$link_script->outertext = ''; //删除js移动到页底
}
}
$js_scr_content = '';
foreach ($link_js_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'JS文件下载错误';
log_message('error', "optimize js文件下载错误! " . $item);
return FALSE;
}
$js_scr_content .= $get_http_temp;
}
//把网页内容和css提交到purifycss处理
$purifycss_server = 'http://184.172.113.216:33033/';
if (strpos($this->websitehost, 'chinarundreisen.com') !== false) {//德语站点使用自己的css处理服务器
$purifycss_server = 'http://158.177.67.52:33033/';
}
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($this->htmlsource) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
//把精简的css添加到head前面
$this->html_object = str_replace('</head>', '<style type="text/css">' . $optimize_css . "</style></head>", $this->html_object);
//删除多余空格和换行符
$this->html_object = str_replace(array(" ", "\t", "\n", "\r"), " ", $this->html_object);
//循环n次把双空格替换为一个空格
for ($i = 0; $i <= 4; $i++) {
$this->html_object = str_replace(" ", " ", $this->html_object);
}
//在最后加载原始css文件和js文件
//把css移动到页面底部延迟加载
$lastload_js = '<noscript id="deferred-styles">';
foreach ($link_css_array as $item) {
$lastload_js .= '<link rel="stylesheet" type="text/css" href="' . $item . '"/>';
}
$lastload_js .= '</noscript><script>var loadDeferredStyles=function(){var addStylesNode=document.getElementById("deferred-styles");var replacement=document.createElement("div");replacement.innerHTML=addStylesNode.textContent;document.body.appendChild(replacement);addStylesNode.parentElement.removeChild(addStylesNode)};var raf=requestAnimationFrame||mozRequestAnimationFrame||webkitRequestAnimationFrame||msRequestAnimationFrame;if(raf){raf(function(){window.setTimeout(loadDeferredStyles,0)})}else{window.addEventListener("load",loadDeferredStyles)};</script>';
$js_content = $js_scr_content . $js_jquery_content;
//延迟加载js需要把返回的js代码保存到一个文件中然后替换占位符以便加载js文件
$lastload_js .= '<script async src="##DEFERSCRIPTDEFER##"></script>';
$lastload_js .= $js_inline_content;
$this->html_object = str_replace('</body>', $lastload_js . '</body>', $this->html_object);
echo json_encode(array('result' => 'ok', 'data' => array('html_object' => $this->html_object, 'js_content' => $js_content)));
}
//生成AMP版本 用移动端版本生成
/*
1.加载站点AMP模板模板只有导航、头部、底部
2.删除全部js引用和内链代码
3.删除全部css引用内联css放入<style amp-custom>
4.图片全部替换成amp-img设置宽高设置layout="responsive"
5.去掉所有元素中的style
6.去掉样式表中的!important
7.替换读取源文件title description keywords canonical
8.todo:增加application/ld+json
要求: 图片文件必须带有域名,否则的获取尺寸会出错,如 https://data.asiahighlights.com/pic/abc.jpg
*/
function create_amp(){
//读取站点的AMP模板
$amp_template = $this->load->view('amp-template/' . $this->template_name, null, true);
//生成移动版本,删除多余元素
foreach ($this->html_object->find('.hidden-xs') as $hidden_item) {
$hidden_item->outertext = '';
}
foreach ($this->html_object->find('title') as $title) {
$amp_template = str_replace('<!--@TITLE@-->', $title->innertext, $amp_template);
}
foreach ($this->html_object->find('meta') as $meta) {
if ($meta->name == 'description') {
$amp_template = str_replace('<!--@DESCRIPTION@-->', $meta->content, $amp_template);
}
if ($meta->name == 'keywords') {
$amp_template = str_replace('<!--@KEYWORDS@-->', $meta->content, $amp_template);
}
}
foreach ($this->html_object->find('script') as $script) {
$script->outertext = '';
}
foreach ($this->html_object->find('noscript') as $noscript) {
$noscript->outertext = '';
}
foreach ($this->html_object->find('link') as $link) {
if ($link->rel == 'stylesheet' && !empty($link->href)) {
$link->outertext = '';
}
if ($link->rel == 'canonical' && !empty($link->href)) {
$amp_template = str_replace('<!--@CANONICAL@-->', $link->href, $amp_template);
}
}
//获取图片尺寸AMP要求必须填写width和height
//格式化图片URL
foreach ($this->html_object->find('img') as $image) {
if (!empty($image->src)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) {
$img_src_host = $this->websitehost;
}
$image->src = $this->format_url($image->src, $img_src_host);
}
if (!empty($image->originalsrc)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) {
$img_src_host = $websitehost;
}
$image->originalsrc = $this->format_url($image->originalsrc, $img_src_host);
}
}
//拼接请求的图片url如 https://data.asiahighlights.com/imagesize.php?photo=/pic/logo-ah.png,/pic/ah-slide-logo.png
$request_size = array();
foreach ($this->html_object->find('img') as $image) {
$img_src = $image->src;
if (!empty($image->originalsrc)) {
$img_src = $image->originalsrc;
}
if (strpos($img_src, 'facebook.com') !== false || strpos($img_src, 'dmca.com') !== false) {//facebook dmca会添加一个跟踪代码需要删除掉否则获取图片尺寸会报错
$image->outertext = '';
continue;
}
$img_src_urls = parse_url($img_src);
$request_size[$img_src_urls['host']][] = $img_src_urls['path'];
}
//请求图片尺寸
$image_sizes = array();
foreach ($request_size as $host => $path) {
$parse_url = "https://{$host}/imagesize.php?photo=" . urlencode(implode(',', $path));
$size_data = GET_HTTP($parse_url);
if (!empty($size_data)) {
$size_data = json_decode($size_data);
foreach ($size_data as $size_item) {
$size_item->photo = "https://{$host}" . $size_item->photo;
$image_sizes[$size_item->photo] = $size_item;
}
}
}
//获取图片尺寸 end
foreach ($this->html_object->find('img') as $image) {
$img_src = $image->src;
if (!empty($image->originalsrc)) {
$img_src = $image->originalsrc;
}
if(empty($image_sizes[$img_src])){
//如果尺寸不存在则跳过
continue;
}
$img_size = $image_sizes[$img_src];
$img_alt = $image->alt;
$img_class = $image->class;
if (!empty($img_size)) {
//添加webp图片支持
$img_src_webp='';
$layout = 'responsive';
if(substr($img_src, -4) == '.jpg'){
if($img_size->width < 400){
$layout = 'fixed';
}
$img_src_jpg=" <amp-img fallback layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
$img_src_webp=substr($img_src, 0, strlen($img_src) - 4).'.webp';
$img_src_webp = " <amp-img layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src_webp}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\">{$img_src_jpg}</amp-img>";
}
if(!empty($img_src_webp)){
$image->outertext =$img_src_webp;
}else{
$image->outertext = " <amp-img layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
}
}
}
//只将中间主要部分用于css精简提高速度
foreach ($this->html_object->find('#content_main') as $content_main) {
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
}
//产品页面多做一些特殊的处理
foreach ($this->html_object->find('.tab-nav') as $tabnav) {
$amp_template = str_replace($tabnav, '', $amp_template);
}
//产品页面删除表单
foreach ($this->html_object->find('.sticky') as $sticky) {
$amp_template = str_replace($sticky, '@AMPFOOTER-BUTTON@', $amp_template);
}
foreach ($this->html_object->find('form') as $form) {
$amp_template = str_replace($form, '', $amp_template);
}
if(!empty($form)){
$replace_text = '<script async="" custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script><style amp-custom>';
$amp_template = str_replace('<style amp-custom>',$replace_text, $amp_template);
}
//产品页面处理结束
$link_css_array = array();
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
//排除一定不会用到的css提高精简的速度
if(strpos($item,'base.css')){
$item = 'https://data.chinarundreisen.com/min/?f=/css/base.css';
}
if(strpos($item,'reiseroute.css')){
$item = 'https://data.chinarundreisen.com/min/?f=/css/reiseroute-amp.css';
}
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
foreach ($this->html_object->find('style') as $style) {
$css_content .= $style->innertext;
$style->outertext = '';
}
//把网页内容和css提交到purifycss处理
$purifycss_server = 'http://158.177.67.52:33033/';
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($content_main) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
$optimize_css = str_replace('!important', '', $optimize_css);
$optimize_css = str_replace('@charset "utf-8";', '', $optimize_css);
$amp_template = str_replace('/*@CUSTOM-CSS@*/', $optimize_css, $amp_template);
//替换掉写在组件上的样式
$amp_template = preg_replace('/style=.+?[\'|"]/i', '', $amp_template);
echo json_encode(array('result' => 'ok', 'data' => array('amp' => $amp_template)));
}
//格式化url保证请求的URL有域名//更换为对应的域名路径
function format_url($url, $host = ''){
if (substr($url, 0, 8) == 'https://' || substr($url, 0, 7) == 'http://') {
$url = str_replace('http://', 'https://', $url);//http要改为https
return urldecode($url);
}
if (substr($url, 0, 2) == '//') { //https或http
return urldecode('https://'.substr($url, 2, strlen($url)-2)); //只替换开头的//部分url不规范有//在url中间
}
return urldecode($host . $url);
}
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,136 @@
<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<title><!--@TITLE@--></title>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<meta name="description" content="<!--@DESCRIPTION@-->">
<link rel="shortcut icon" href="https://data.chinahighlights.com/favicon.ico" />
<link rel="canonical" href="<!--@CANONICAL@-->">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<script async custom-element="amp-addthis" src="https://cdn.ampproject.org/v0/amp-addthis-0.1.js"></script>
<link rel="shortcut icon" href="https://data.asiahighlights.com/favicon.ico" />
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js" async></script>
<script async custom-element="amp-accordion" src="https://cdn.ampproject.org/v0/amp-accordion-0.1.js"></script>
<style amp-custom>
body{margin:0;font-family:'Open Sans',Arial,Helvetica,sans-serif;font-size:14px;color:#545454;background:#fff}sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;top:-5px}a{color:#545454}a:hover{text-decoration:none;color:#a31022}h1{font-size:25px;font-weight:400;margin:0 0 25px 0}h2{font-size:25px;font-weight:400;margin-bottom:15px;margin-top:50px}h3{font-size:20px;font-weight:normal}p{line-height:30px;margin-bottom:20px;font-size:18px}ul.drop1{display:block;padding-left:0;margin-left:0}ul.drop1 li{list-style:none;line-height:20px;margin-bottom:10px;font-size:16px;background:url(https://data.chinahighlights.com/pic/square.png) no-repeat left;padding-left:20px}footer{background:#444;color:#fff}footer a{color:#fff;text-decoration:none}@media(max-width:376px){.brand{width:54%;font-size:14px}}@media(min-width:400px){.brand{width:60%;font-size:16px}}.brand{display:inline-block;text-align:center;color:#fff;font-weight:300;text-transform:uppercase;margin-top:15px}.ampstart-headerbar .ampstart-navbar-trigger{background:#a31022;position:fixed;width:100%;z-index:9999;margin-top:-5px;height:60px}.customizeBtn{font-size:12px;border:1px solid #d1d1d1;border-radius:2px;padding:2px 8px;display:inline-block;height:25px;line-height:19px;float:right;margin:20px 15px 0 0}.customizeBtn a{color:#fff;text-decoration:none}#crumbNav{font-size:12px;color:#a31022;position:relative;margin:0 0 20px}#crumbNav a{text-decoration:none;padding:2px 8px 4px 0;color:#444}#crumbNav a:after{content:"";margin-left:5px;font-size:16px}#crumbNav a:hover{color:#a31022;text-decoration:none}@font-face{font-family:FontAwesome;src:url(https://data.chinahighlights.com/public/fonts/fontawesome-webfont.eot?v=4.7.0);src:url(https://data.chinahighlights.com/public/fonts/fontawesome-webfont.eot?#iefix&v=4.7.0) format('embedded-opentype'),url(https://data.chinahighlights.com/public/fonts/fontawesome-webfont.woff2?v=4.7.0) format('woff2'),url(https://data.chinahighlights.com/public/fonts/fontawesome-webfont.woff?v=4.7.0) format('woff'),url(https://data.chinahighlights.com/public/fonts/fontawesome-webfont.ttf?v=4.7.0) format('truetype'),url(https://data.chinahighlights.com/public/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular) format('svg');font-weight:400;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-facebook-square:before{content:"\f082"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-tripadvisor:before{content:"\f262"}.fa-500px:before{content:"\f26e"}.fa-angle-down:before{content:"\f107"}.fa-square-o:before{content:"\f096"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-facebook-square:before{content:"\f082"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-twitter:before{content:"\f099"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-tripadvisor:before{content:"\f262"}.fa-500px:before{content:"\f26e"}.fa-angle-down:before{content:"\f107"}.fa-square-o:before{content:"\f096"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9";color:#fff;margin:5px 0 0 15px;font-size:22px}
.fa-google-plus::before{content:"\f0d5"}.ampstart-headerbar{background-color:#fff;color:#000;z-index:999;box-shadow:0 0 5px 2px rgba(0,0,0,.1)}.ampstart-headerbar+:not(amp-sidebar),.ampstart-headerbar-nav .ampstart-nav-item{padding:0 1rem;background:transparent;opacity:.8}.ampstart-headerbar-nav{line-height:3.5rem}.ampstart-nav-item:active,.ampstart-nav-item:focus,.ampstart-nav-item:hover{opacity:1}.ampstart-navbar-trigger:focus{outline:0}.ampstart-nav a,.ampstart-navbar-trigger,.ampstart-sidebar-faq a{cursor:pointer;text-decoration:none}.ampstart-nav .ampstart-label{color:inherit;padding-left:0}.ampstart-navbar-trigger{line-height:3.5rem;font-size:2.2rem}.ampstart-headerbar-nav{-webkit-box-flex:1;-ms-flex:1;flex:1}.ampstart-nav-search{-webkit-box-flex:.5;-ms-flex-positive:.5;flex-grow:.5}.ampstart-headerbar .ampstart-nav-search:active,.ampstart-headerbar .ampstart-nav-search:focus,.ampstart-headerbar .ampstart-nav-search:hover{box-shadow:none}.ampstart-nav-dropdown{min-width:200px}.ampstart-nav-dropdown amp-accordion header{background-color:#fff;border:0}.ampstart-nav-dropdown amp-accordion ul{background-color:#fff}.ampstart-nav-dropdown .ampstart-dropdown-item,.ampstart-nav-dropdown .ampstart-dropdown>section>header{background-color:#fff;color:#000}.ampstart-nav-dropdown .ampstart-dropdown-item{color:#f88}.ampstart-sidebar{background-color:#555;color:#000;min-width:300px;width:300px}.ampstart-sidebar .ampstart-icon{fill:#f88}.ampstart-sidebar-header{line-height:3.5rem;min-height:3.5rem}.ampstart-sidebar .ampstart-dropdown-item,.ampstart-sidebar .ampstart-dropdown header,.ampstart-sidebar .ampstart-faq-item,.ampstart-sidebar .ampstart-nav-item,.ampstart-sidebar .ampstart-social-follow{margin:0 0 2rem}.ampstart-sidebar .ampstart-nav-dropdown{margin:0}.ampstart-sidebar .ampstart-navbar-trigger{line-height:inherit;text-align:right;margin-right:15px;color:#999}.ampstart-navbar-trigger svg{pointer-events:none;margin:15px 0 0 15px;color:#fff}.ampstart-headerbar{color:#f88;padding-right:1rem;background-color:#fff;height:3.5rem;box-shadow:none;border-bottom:1px solid #f3f3f3}.ampstart-headerbar .ampstart-navbar-trigger{color:#222;font-size:1.38rem;padding-right:0}.ampstart-navbar-trigger:focus{outline:5px auto -webkit-focus-ring-color}.ampstart-sidebar-nav-image{width:120px}.ampstart-icon,.ampstart-sidebar .ampstart-icon{fill:#222}.ampstart-sidebar-header{position:relative;z-index:1}.ampstart-nav{margin-bottom:2rem}.ampstart-nav-item{color:#222;border-bottom:1px solid #777;list-style:none;padding-bottom:8px}.ampstart-sidebar .ampstart-nav-item{margin-bottom:1rem;padding-left:30px}.ampstart-nav-link{font-size:16px;font-weight:400;line-height:normal;display:inline-block;margin-bottom:5px;position:relative;color:#fff;padding-bottom:3px}.ampstart-nav-link .fa{position:absolute;right:20px;top:3px}.amp-mode-mouse .ampstart-nav-link:after{left:0;position:absolute;-webkit-transform:scaleX(0);transform:scaleX(0);-webkit-transform-origin:left center;transform-origin:left center;-webkit-transition:-webkit-transform .3s cubic-bezier(.19,1,.22,1);transition:-webkit-transform .3s cubic-bezier(.19,1,.22,1);transition:transform .3s cubic-bezier(.19,1,.22,1);transition:transform .3s cubic-bezier(.19,1,.22,1),-webkit-transform .3s cubic-bezier(.19,1,.22,1);width:100%;bottom:0;height:2px;content:"";display:block}.ampstart-dropdown-items{padding-left:0}.ampstart-dropdown-items li{font-size:14px;text-transform:capitalize;line-height:35px;border-bottom:1px solid #777;margin-right:30px;padding-left:20px;padding-bottom:5px;list-style:none}.ampstart-dropdown-items li a{color:#fff}.ampstart-dropdown-items li:last-child{border-bottom:0}.ampstart-social-follow{-webkit-box-pack:initial;-ms-flex-pack:initial;justify-content:initial;display:inline-block}.ampstart-social-follow li{display:inline-block;margin-right:0}.footerLink{display:block;padding:20px 0 0;text-align:center}.footerLink a{margin:0 10px}.copyright{display:block;padding:20px 0;text-align:center}.socialLink{text-align:center;display:block;margin-top:50px}.socialLink a{text-decoration:none}.socialLink .fa{font-size:150%;margin:0 20px;color:#fff}.logo{text-align:center}.amphtml-accordion-header{background:0;border:0;margin-bottom:0}.clearfix{clear:both}.amp-tailor { display: block; margin:50px 15px 10px; background:#f1f1f1; padding:15px 15px 20px; font-size:18px; border-radius:4px; text-align:center;}.amp-tailor span { display: block; margin:15px auto 0; width:70%; text-align:center; background:#a31022; border-radius:4px;}.amp-tailor span a { text-decoration: none; color:#fff; padding:5px 10px; display: block; font-size:18px;}.amp-tailor span .fa { font-size:130%; margin-left:10px;}
/*@CUSTOM-CSS@*/
#contentHead{padding-top: 8px;}
.sharebar-sticker { display: block; position:fixed; bottom:0; left:0; width:100%;}
</style>
</head>
<body>
<!-- Start Navbar -->
<header class="ampstart-headerbar flex justify-start items-center top-0 left-0 right-0 pl2 pr4 pt2 md-pt0">
<div role="button" aria-label="open sidebar" on="tap:header-sidebar.toggle" tabindex="0" class="ampstart-navbar-trigger pr2 absolute top-0 pr0 mr2 mt2">
<i class="fa fa-bars" aria-hidden="true"></i>
<span class="brand">China Highlights <sup>®</sup></span>
<span class="customizeBtn"><a href="/tour/create-my-trip.htm"> CUSTOMIZE </a></span>
</div>
</header>
<!-- Start Sidebar -->
<amp-sidebar id="header-sidebar" class="ampstart-sidebar px3 md-flex flex-column justify-content items-center justify-center" layout="nodisplay">
<div class="flex justify-start items-center ampstart-sidebar-header">
<div role="button" aria-label="close sidebar" on="tap:header-sidebar.toggle" tabindex="0" class="ampstart-navbar-trigger items-start"></div>
</div>
<nav class="ampstart-sidebar-nav ampstart-nav ">
<ul class="list-reset m0 p0 ampstart-label">
<li class="ampstart-nav-item"><a class="ampstart-nav-link" href="/">Home</a></li>
<li class="ampstart-nav-item "><a class="ampstart-nav-link" href="/tour/create-my-trip.htm">Create My Trip</a></li>
<li class="ampstart-nav-item">
<amp-accordion>
<section>
<h3 class="ampstart-nav-link amphtml-accordion-header"><a href="/tour/" class="ampstart-nav-link">China Tours</a> <i class="fa fa-angle-right" aria-hidden="true"></i></h3>
<ul class="ampstart-dropdown-items list-reset ">
<li><a href="/tour/top-china-tours/">Top 10 Tours</a> </li>
<li><a href="/tour/china-panda-tours/">Panda Tours</a></li>
<li><a href="/tour/family-tours/">Family Tours</a></li>
<li><a href="/tour/silk-road-tours/">Silk Road Tours</a></li>
<li><a href="/yangtzecruise/">Yangtze Cruise</a></li>
<li><a href="/tour/year.htm">China Tours 2019</a></li>
</ul>
</section>
</amp-accordion>
</li>
<li class="ampstart-nav-item">
<amp-accordion>
<section>
<h3 class="ampstart-nav-link amphtml-accordion-header"><a href="/citytour/" class="ampstart-nav-link">Destinations</a> <i class="fa fa-angle-right" aria-hidden="true"></i></h3>
<ul class="ampstart-dropdown-items list-reset">
<li><a href="/beijing/tours.htm">Beijing Tours</a></li>
<li><a href="/shanghai/tours.htm">Shanghai Tours</a></li>
<li><a href="/guilin/tours.htm">Guilin Tours</a></li>
<li><a href="/chengdu/tours.htm">Chengdu Tours</a></li>
<li><a href="/xian/tours.htm">Xi'an Tours</a></li>
<li><a href="/tibet/tours.htm">Tibet Tours</a></li>
<li><a href="/zhangjiajie/tours.htm">Zhangjiajie Tours</a></li>
</ul>
</section>
</amp-accordion>
</li>
<li class="ampstart-nav-item">
<amp-accordion>
<section>
<h3 class="ampstart-nav-link amphtml-accordion-header"><a href="/travelguide/" class="ampstart-nav-link">Travel Guide</a> <i class="fa fa-angle-right" aria-hidden="true"></i></h3>
<ul class="ampstart-dropdown-items list-reset">
<li><a href="/travelguide/visa-application/">China Visas</a></li>
<li><a href="/beijing/">Beijing</a></li>
<li><a href="/greatwall/">The Great Wall of China</a></li>
<li><a href="/travelguide/china-top-10-attractions.htm">Chinas Top 10 Attractions</a></li>
<li><a href="/giant-panda/">Giant Pandas</a></li>
<li><a href="/xian/terracotta-army/">The Terracotta Army</a></li>
<li><a href="/travelguide/top-highlights-of-china.htm">Best of China</a></li>
</ul>
</section>
</amp-accordion>
</li>
<li class="ampstart-nav-item">
<amp-accordion>
<section>
<h3 class="ampstart-nav-link amphtml-accordion-header"><a href="/travelguide/culture/" class="ampstart-nav-link">Culture</a> <i class="fa fa-angle-right" aria-hidden="true"></i></h3>
<ul class="ampstart-dropdown-items list-reset">
<li><a href="/travelguide/chinese-zodiac/">Chinese Zodiac</a></li>
<li><a href="/travelguide/special-report/chinese-new-year/">Chinese New Year</a></li>
<li><a href="/festivals/mid-autumn-festival.htm">Mid-autumn Festival</a></li>
<li><a href="/festivals/china-public-holiday.htm">Public Holiday Schedule</a></li>
</ul>
</section>
</amp-accordion>
</li>
<li class="ampstart-nav-item "><a class="ampstart-nav-link" href="/china-trains/">Trains</a></li>
<li class="ampstart-nav-item "><a class="ampstart-nav-link" href="/daytrip/">Day Tours</a></li>
<li class="ampstart-nav-item "><a class="ampstart-nav-link" href="/contactus/">Contact Us</a></li>
</ul>
</nav>
<span class="socialLink"><a class="fb fa fa-facebook" title="Follow us on Facebook" rel="nofollow" href="https://www.facebook.com/chinahighlights"></a><a class="tw fa fa-twitter" title="Share us on Twitter" rel="nofollow" href="https://twitter.com/chinahighlights"></a> <a class="tw fa fa-google-plus" title="Share us on Google Plus" rel="nofollow" href="https://plus.google.com/115440226907925048044"></a> <a class="tw fa fa-instagram" title="Share us on Instagram" rel="nofollow" href="https://instagram.com/chinahighlights"></a></span>
</amp-sidebar>
<!-- End Sidebar -->
<!--@CUSTOM-CONENT@-->
<div class="amp-tailor">
Start planning your tailor-made China tour …
<span><a href="/tour/create-my-trip.htm">Create My Trip <i class="fa fa-angle-right"></i></a></span>
</div>
<footer>
<div class="footerLink"><a href="/contactus/" >Contact us</a> | <a href="/aboutus/" >About us</a></div>
<div class="copyright">© 1998-2019 China Highlights</div>
</footer>
<!-- Google Analytics -->
<amp-analytics type="googleanalytics">
<script type="application/json">
{"vars": {"account": "UA-31694-1"}, "triggers": {"default pageview": {"on": "visible", "request": "pageview", "vars": {"title": "<!--@TITLE@-->"}}}}
</script>
</amp-analytics>
<!-- Google Analytics -->
<!--AMP Builder-->
<div class="sharebar-sticker"><amp-addthis width="320" height="92" layout="responsive" data-pub-id="ra-52170b0a4a301edc" data-widget-id="eixo"></amp-addthis></div>
</body>
</html>

@ -0,0 +1,218 @@
<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<title><!--@TITLE@--></title>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<meta name="description" content="<!--@DESCRIPTION@-->">
<link rel="canonical" href="<!--@CANONICAL@-->">
<link rel="shortcut icon" href="https://data.chinatravel.com/favicon.ico">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<script custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js" async></script>
<script async custom-element="amp-accordion" src="https://cdn.ampproject.org/v0/amp-accordion-0.1.js"></script>
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
<style amp-custom>
body { margin: 0;font-family:'Open Sans', Arial, Helvetica, sans-serif;font-size:16px;color:#545454; background:#fff; }
sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; top:-0.4rem; }
a { color:#545454;}
a:hover { text-decoration: none; color:#df6536}
h1{font-size:1.6rem;font-weight:400;margin:0 0 1.5rem 0;}
h2{font-size:1.5rem;font-weight:400;margin-bottom:1rem;margin-top:3rem;}
h3{font-size:1.25rem;font-weight:normal;}
p{margin-bottom:1.25rem; margin-top:0;}
ul,li,dl {margin:0; padding:0; list-style:none;}
.relative { position:relative;}
ul.drop1 { display: block; padding-left:0; margin-left:0;}
ul.drop1 li { list-style: none; line-height:1.25rem; margin-bottom:0.6rem; background:url(/pic/square.png) no-repeat left; padding-left:1.25rem;}
footer { background:#444; color:#fff; text-align:center; font-size:0.9rem; padding:0.8rem 0.5rem 0.2rem 0.5rem}
footer a { color:#fff; text-decoration: none;}
footer p { margin-bottom:0.5rem;}
.socialLink { text-align: center; display: block; margin-top:50px;}
.socialLink a { text-decoration: none }
.socialLink .fa { font-size: 150%; margin: 0 20px; color: #fff }
@media(max-width:376px) {
.brand { width:54%; font-size:1.1rem;}
}
@media(min-width:400px) {
.brand {width:60%; font-size:1.25rem; }
}
.brand { display: inline-block; text-align: center;color:#333;text-transform: uppercase; padding-left:1rem}
.ampstart-headerbar .ampstart-navbar-trigger { background:#fff; position:fixed; width:100%; z-index:9999; border-bottom: 1px solid #eee; height:60px;}
.customizeBtn {font-size:0.75rem;border: 1px solid #ccc;border-radius:4px;padding:0.15rem 0.5rem;display: inline-block;height: 1.25rem;line-height: 1.25rem; float: right; margin:1.15rem 1rem 0 0;}
.customizeBtn a { color:#666; text-decoration: none;}
.container { display: block; padding:0.625rem 0.94rem;}
#crumbNav { font-size: 0.75rem; color: #a31022; position: relative; margin: 0 0 1.15rem; }
#crumbNav a { text-decoration: none; padding: 2px 8px 4px 0; color: #444 }
#crumbNav a:after { content:""; margin-left:5px; font-size:1rem;}
#crumbNav a:hover { color: #a31022; text-decoration: none }
/* from font awesome */
@font-face{font-family:FontAwesome;src:url(https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/fonts/fontawesome-webfont.eot?v=4.7.0);src:url(https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/fonts/fontawesome-webfont.eot?#iefix&v=4.7.0) format('embedded-opentype'),url(https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/fonts/fontawesome-webfont.woff2?v=4.7.0) format('woff2'),url(https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/fonts/fontawesome-webfont.woff?v=4.7.0) format('woff'),url(https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/fonts/fontawesome-webfont.ttf?v=4.7.0) format('truetype'),url(https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular) format('svg');font-weight:400;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-facebook-square:before{content:"\f082"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-tripadvisor:before{content:"\f262"}.fa-500px:before{content:"\f26e"}.fa-angle-down:before{content:"\f107"}.fa-square-o:before{content:"\f096"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}
.fa-navicon:before,.fa-reorder:before,.fa-bars:before { content: "\f0c9"; color:#333; margin:0.32rem 0 0 1rem; }
.fa-google-plus::before { content: "\f0d5";}
/* sidebar style */
.ampstart-headerbar { background-color: #fff; color: #000; z-index: 999; box-shadow: 0 0 5px 2px rgba(0,0,0,.1) }
.ampstart-headerbar+:not(amp-sidebar), .ampstart-headerbar-nav .ampstart-nav-item { padding: 0 1rem; background: transparent; opacity: .8 }
.ampstart-headerbar-nav { line-height: 3.5rem }
.ampstart-nav-item:active, .ampstart-nav-item:focus, .ampstart-nav-item:hover { opacity: 1 }
.ampstart-navbar-trigger:focus { outline: 0 }
.ampstart-nav a, .ampstart-navbar-trigger, .ampstart-sidebar-faq a { cursor: pointer; text-decoration: none }
.ampstart-nav .ampstart-label { color: inherit; padding-left:0; }
.ampstart-navbar-trigger { line-height: 3.5rem; font-size: 2.2rem }
.ampstart-headerbar-nav { -webkit-box-flex: 1; -ms-flex: 1; flex: 1 }
.ampstart-nav-search { -webkit-box-flex: .5; -ms-flex-positive: .5; flex-grow: .5 }
.ampstart-headerbar .ampstart-nav-search:active, .ampstart-headerbar .ampstart-nav-search:focus, .ampstart-headerbar .ampstart-nav-search:hover { box-shadow: none }
.ampstart-nav-dropdown { min-width: 12.5rem }
.ampstart-nav-dropdown amp-accordion header { background-color: #fff; border: 0 }
.ampstart-nav-dropdown amp-accordion ul { background-color: #fff }
.ampstart-nav-dropdown .ampstart-dropdown-item, .ampstart-nav-dropdown .ampstart-dropdown>section>header { background-color: #fff; color: #000 }
.ampstart-nav-dropdown .ampstart-dropdown-item { color: #f88 }
.ampstart-sidebar { background-color: #555; color: #000; min-width: 18.75rem; width: 18.75rem }
.ampstart-sidebar .ampstart-icon { fill: #f88 }
.ampstart-sidebar-header { line-height: 3.5rem; min-height: 3.5rem }
.ampstart-sidebar .ampstart-dropdown-item, .ampstart-sidebar .ampstart-dropdown header, .ampstart-sidebar .ampstart-faq-item, .ampstart-sidebar .ampstart-nav-item, .ampstart-sidebar .ampstart-social-follow { margin: 0 0 2rem }
.ampstart-sidebar .ampstart-nav-dropdown { margin: 0 }
.ampstart-sidebar .ampstart-navbar-trigger { line-height: inherit; text-align:right; margin-right:1rem; color:#999 }
.ampstart-navbar-trigger svg { pointer-events: none; margin:1rem 0 0 1rem; color:#fff;}
.ampstart-headerbar { color: #f88; padding-right: 1rem; background-color: #fff; height: 3.5rem; box-shadow: none; border-bottom: 1px solid #f3f3f3 }
.ampstart-headerbar .ampstart-navbar-trigger { color: #222; font-size: 1.38rem; padding-right: 0 }
.ampstart-navbar-trigger:focus { outline: 5px auto -webkit-focus-ring-color }
.ampstart-sidebar-nav-image { width: 120px }
.ampstart-icon, .ampstart-sidebar .ampstart-icon { fill: #222 }
.ampstart-sidebar-header { position: relative; z-index: 1 }
.ampstart-nav { margin-bottom: 2rem }
.ampstart-nav-item { color: #222; border-bottom: 1px solid #777; list-style: none; padding-bottom:0.5rem; }
.ampstart-sidebar .ampstart-nav-item { margin-bottom: 1rem; padding-left:1.875rem }
.ampstart-nav-link { font-size:1rem; font-weight: 400; line-height: normal; display: inline-block; margin-bottom:0.32rem; position: relative; color:#fff; padding-bottom:0.19rem; }
.ampstart-nav-link .fa { position: absolute; right: 1.25rem; top: 3px }
.amp-mode-mouse .ampstart-nav-link:after { left: 0; position: absolute; -webkit-transform: scaleX(0); transform: scaleX(0); -webkit-transform-origin: left center; transform-origin: left center; -webkit-transition: -webkit-transform .3s cubic-bezier(.19, 1, .22, 1); transition: -webkit-transform .3s cubic-bezier(.19, 1, .22, 1); transition: transform .3s cubic-bezier(.19, 1, .22, 1); transition: transform .3s cubic-bezier(.19, 1, .22, 1), -webkit-transform .3s cubic-bezier(.19, 1, .22, 1); width: 100%; bottom: 0; height: 2px; content: ""; display: block }
.ampstart-dropdown-items { padding-left:0; }
.ampstart-dropdown-items li { font-size: 0.875rem; line-height: 1.8rem; border-bottom: 1px solid #777; margin-right: 0.875rem; padding-left: 1.25rem; padding-bottom: 0.6rem; padding-top: 0.6rem; list-style: none; }
.ampstart-dropdown-items li a { color: #fff }
.ampstart-dropdown-items li:last-child { border-bottom: 0 }
.ampstart-social-follow { -webkit-box-pack: initial; -ms-flex-pack: initial; justify-content: initial; display: inline-block }
.ampstart-social-follow li { display: inline-block; margin-right: 0 }
.amphtml-accordion-header{background:0;border:0;margin-bottom:0}.clearfix{clear:both}
.customizeBtn { height:1.6rem;line-height: 1.5rem;}
/*@CUSTOM-CSS@*/
html{font-size:16px}
</style>
</head>
<body >
<!-- Start Navbar -->
<header class="ampstart-headerbar flex justify-start items-center top-0 left-0 right-0 pl2 pr4 pt2 md-pt0">
<div role="button" aria-label="open sidebar" on="tap:header-sidebar.toggle" tabindex="0" class="ampstart-navbar-trigger pr2 absolute top-0 pr0 mr2 mt2"> <i class="fa fa-bars" aria-hidden="true"></i> <span class="brand">China Travel <sup>®</sup></span> <span class="customizeBtn"><a href="/forms/customize.html"> CUSTOMIZE </a></span></div>
</header>
<!-- Start Sidebar -->
<amp-sidebar id="header-sidebar" class="ampstart-sidebar px3 md-flex flex-column justify-content items-center justify-center" layout="nodisplay">
<div class="flex justify-start items-center ampstart-sidebar-header">
<div role="button" aria-label="close sidebar" on="tap:header-sidebar.toggle" tabindex="0" class="ampstart-navbar-trigger items-start"></div>
</div>
<nav class="ampstart-sidebar-nav ampstart-nav ">
<ul class="list-reset m0 p0 ampstart-label">
<li class="ampstart-nav-item"><a class="ampstart-nav-link" href="/">HOME</a></li>
<li class="ampstart-nav-item">
<amp-accordion>
<section>
<h3 class="ampstart-nav-link amphtml-accordion-header"><a class="ampstart-nav-link" href="/china-tours/">China Tours</a> <i class="fa fa-angle-right" aria-hidden="true"></i></h3>
<ul class="ampstart-dropdown-items list-reset ">
<li><a href="/china-tours/ct-1.htm">Classic China Tour</a></li>
<li><a href="/china-tours/ct-2.htm">The History and Nature of China</a></li>
<li><a href="/china-tours/ct-3.htm">China Adventure Journey</a></li>
<li><a href="/china-tours/theme/china-panda-tours/">Panda Tours</a></li>
<li><a href="/china-tours/top-10-china-tours.htm"> See All Top 10 China Tours</a></li>
</ul>
</section>
</amp-accordion>
</li>
<li class="ampstart-nav-item "><a class="ampstart-nav-link" href="/how-to-plan-a-trip-to-china-step-by-step/">Planning Tips</a></li>
<li class="ampstart-nav-item "><a class="ampstart-nav-link" href="/forms/customize.html">Create My Trip</a></li>
<li class="ampstart-nav-item">
<amp-accordion>
<section>
<h3 class="ampstart-nav-link amphtml-accordion-header"><a class="ampstart-nav-link" href="/city-tours/">City Tours</a><i class="fa fa-angle-right" aria-hidden="true"></i></h3>
<ul class="ampstart-dropdown-items list-reset ">
<li><a href="/tours-to-shanghai/">Shanghai and Water Town Tours</a></li>
<li><a href="/tours-to-beijing/">Beijing and Great Wall Tours </a></li>
<li><a href="/tours-to-zhangjiajie/">Zhangjaijie Tours</a></li>
<li><a href="/tours-to-chengdu/">Chengdu and Panda Tours</a></li>
<li><a href="/tours-to-guilin/">Guilin and Yangshuo Tours</a></li>
</ul>
</section>
</amp-accordion>
</li>
<li class="ampstart-nav-item">
<amp-accordion>
<section>
<h3 class="ampstart-nav-link amphtml-accordion-header"><a class="ampstart-nav-link" href="/tours-to-shanghai/">Shanghai Tours</a><i class="fa fa-angle-right" aria-hidden="true"></i></h3>
<ul class="ampstart-dropdown-items list-reset ">
<li><a href="/china-day-trips/shalc-62.htm">1-Day Suzhou and Tongli Water Town Tour from Shanghai</a></li>
<li><a href="/china-tours/ct-sh-1s.htm">3-Day Visa-free Shanghai and Water Essence Tour</a></li>
<li><a href="/china-tours/ct-sh-1.htm">4-Day Shanghai and Suzhou Highlights Tour </a></li>
</ul>
</section>
</amp-accordion>
</li>
<li class="ampstart-nav-item">
<amp-accordion>
<section>
<h3 class="ampstart-nav-link amphtml-accordion-header"><a class="ampstart-nav-link" href="/china-guide/">China Guide</a><i class="fa fa-angle-right" aria-hidden="true"></i></h3>
<ul class="ampstart-dropdown-items list-reset ">
<li><a href="/shanghai-travel/">Shangahai Travel Guide</a>
<li><a href="/zhangjiajie-travel/">Zhangjiajie Travel Guide</a></li>
<li><a href="/beijing-travel/">Beijing Travel Guide</a></li>
<li><a href="/focus/"> Best of China</a></li>
<li><a href="/facts/china-visa.htm">China Visa</a></li>
</ul>
</section>
</amp-accordion>
</li>
<li class="ampstart-nav-item">
<amp-accordion>
<section>
<h3 class="ampstart-nav-link amphtml-accordion-header"><a class="ampstart-nav-link" href="/china-day-trips/">Day Trips</a><i class="fa fa-angle-right" aria-hidden="true"></i></h3>
<ul class="ampstart-dropdown-items list-reset ">
<li><a href="/china-day-trips/cdalc-34.htm">1-Day Dujiangyan Panda Keeper Program</a></li>
<li><a href="/china-day-trips/zjjalc-6.htm">1-Day Zhangjiajie Glass Bridge Tour</a></li>
<li><a href="/china-day-trips/bjsic-16.htm">Tianjin Cruise Port Beijing Transfer</a></li>
<li><a href="/china-day-trips/bjsic-5.htm">1-Day Mutianyu Great Wall Tour </a></li>
<li><a href="/china-day-trips/shalc-62.htm">1-Day Suzhou and Tongli Tour</a>
</ul>
</section>
</amp-accordion>
</ul>
</section>
</amp-accordion>
</li>
<li class="ampstart-nav-item"><a class="ampstart-nav-link" href="/about-china-travel/">About Us</a></li>
</ul>
</nav>
<span class="socialLink"><a class="fb fa fa-facebook" title="Follow us on Facebook" rel="nofollow" href="https://www.facebook.com/ChinaTravelDotCom"></a><a class="tw fa fa-twitter" title="Share us on Twitter" rel="nofollow" href="https://twitter.com/joinchinatravel"></a> <a class="tw fa fa-google-plus" title="Share us on Google Plus" rel="nofollow" href="https://plus.google.com/111230828547235671984"></a></span></amp-sidebar>
<!-- End Sidebar -->
<!--@CUSTOM-CONENT@-->
<footer>
<p><a href="/contact-china-travel/">Contact us</a> | <a href="/about-china-travel/">About us</a></p>
<p>© 1997-2018 China Travel</p>
</footer>
<!-- Google Analytics -->
<amp-analytics type="googleanalytics">
<script type="application/json">
{
"vars": {
"account": "UA-4273670-1"
},
"triggers": {
"default pageview": {
"on": "visible",
"request": "pageview"
}
}
}
</script>
</amp-analytics>
<!-- Google Analytics -->
<!--AMP Builder-->
</body>
</html>

@ -0,0 +1,45 @@
<!doctype html>
<html amp lang="de">
<head>
<meta charset="utf-8">
<title><!--@TITLE@--></title>
<meta name="description" content="<!--@DESCRIPTION@-->">
<meta name="keywords" content="<!--@KEYWORDS@-->">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<link rel="canonical" href="<!--@CANONICAL@-->">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<link rel="shortcut icon" href="https://www.chinarundreisen.com/favicon.ico" />
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js" async></script>
<script async custom-element="amp-accordion" src="https://cdn.ampproject.org/v0/amp-accordion-0.1.js"></script>
<script async custom-element="amp-position-observer" src="https://cdn.ampproject.org/v0/amp-position-observer-0.1.js"></script>
<script async custom-element="amp-animation" src="https://cdn.ampproject.org/v0/amp-animation-0.1.js"></script>
<script async custom-element="amp-addthis" src="https://cdn.ampproject.org/v0/amp-addthis-0.1.js"></script>
<style amp-custom>
/*@COMMON-CSS@*/
/*@CUSTOM-CSS@*/
</style>
</head>
<body>
<amp-analytics config="https://www.googletagmanager.com/amp.json?id=GTM-MLTZ9X8&gtm.url=SOURCE_URL" data-credentials="include">
<script type="application/json">
{
"vars": {
"gaTrackingId": "UA-2825055-2"
}
}
</script>
</amp-analytics>
<div class="headerbottom" id="top-page"></div>
@AMP-COMMON-HEADER@
<!--@CUSTOM-CONENT@-->
@AMP-COMMON-FOOTER@
<div class="fixed-addthis"><amp-addthis width="320" height="48" layout="responsive" data-pub-id="ra-58255ecaa2c44e0d" data-widget-id="mip1"></amp-addthis></div>
<amp-animation id="showAnim"layout="nodisplay"><script type="application/json">{"duration":"200ms","fill":"both","iterations":"1","direction":"alternate","animations":[{"selector":"#scrollToTopButton","keyframes":[{"opacity":"1","visibility":"visible"}]}]}</script></amp-animation><amp-animation id="hideAnim"layout="nodisplay"><script type="application/json">{"duration":"200ms","fill":"both","iterations":"1","direction":"alternate","animations":[{"selector":"#scrollToTopButton","keyframes":[{"opacity":"0","visibility":"hidden"}]}]}</script></amp-animation><div id="marker"><amp-position-observer on="enter:hideAnim.start; exit:showAnim.start"layout="nodisplay"></amp-position-observer></div><a id="scrollToTopButton"on="tap:top-page.scrollTo(duration=200)"class="scrollToTop"></a>
<!--AMP Builder-->
</body>
</html>

@ -14,7 +14,23 @@
<h1>页面样式精简</h1>
<form name="form_htmlsource" id="form_htmlsource" action="<?php echo site_url('apps/htmlcompressor/index/optimize'); ?>" method="post">
<input type="text" name="websitehost" id="websitehost" style="width:200px;" placeholder="域名" /><br/><br/>
<textarea name="htmlsource" id="htmlsource" rows="22" style="width:800px;" placeholder="网页代码" ></textarea>
<textarea name="htmlsource" id="htmlsource" rows="22" style="width:800px;" placeholder="网页代码" ></textarea><br/><br/>
<label><input type="checkbox" value="true" name="create_amp">生成AMP页面</label>
<select name="template_name" id="template_name" class="form-control" onselect="">
<option selected="" value="none">模板选择生成AMP才需要</option>
<option value="ah">AH</option>
<option value="gm">GM</option>
<option value="cht">CHT</option>
<option value="ct">CT</option>
</select>
<select name="debug" id="debug" class="form-control" onselect="">
<option selected="" value="0">不调试</option>
<option value="1">开启调试</option>
</select>
<br/><br/>
<input type="submit"/>
</form>

@ -30,14 +30,14 @@ class Confirm extends CI_Controller {
}
}
} else {
$this->load->view($site_code.'/link_tips', $data);
$this->load->view($site_code.'/link_tips', $data);
return false;
}
$visitor_link_arr = $this->Order_model->get_visitor_link($COLI_SN);
foreach ($visitor_link_arr as $l) {
if ($visitor_link == $l->visitor_link) {
$this->load->view($site_code.'/link_tips', $data);
$this->load->view($site_code.'/link_tips', $data);
return false;
}
}
@ -57,10 +57,16 @@ class Confirm extends CI_Controller {
$COLI_SN = $this->input->post('COLI_SN');
$visitor_link = $this->input->post('visitor_link');
$COLI_ID = $this->input->post('COLI_ID');
//航班信息
$MEI_ArrivalFlightNo = $this->input->post('MEI_ArrivalFlightNo');
$MEI_ArrivalTime = $this->input->post('MEI_ArrivalTime');
$MEI_DepartureFlightNo = $this->input->post('MEI_DepartureFlightNo');
$MEI_DepartureTime = $this->input->post('MEI_DepartureTime');
//已经确认过
$had_save = $this->Order_model->get_visitor_link($COLI_SN, $visitor_link);
if (!empty($had_save)) {
echo json_encode(array('status' => 'ok'));
return;
@ -74,7 +80,7 @@ class Confirm extends CI_Controller {
} elseif ($this->input->post('address_street')) {
$MEI_Street = $this->input->post('address_street') . ',' . $this->input->post('address_city') . ',' . $this->input->post('address_state') . ',' . $this->input->post('address_country');
} else {
$MEI_Street = '';
$MEI_Street = $this->input->post('street').','.$this->input->post('city').','.$this->input->post('country');
}
$data['MEI_Street'] = $MEI_Street;
if (isset($given_name[$key]) && $given_name[$key] != 'None') {
@ -85,34 +91,21 @@ class Confirm extends CI_Controller {
$MEI_LastName = $name;
if ($this->input->post('arrive_flight')) {
$CUL_Memo = 'Arrival China Flight No : '
. $this->input->post('arrive_flight')
. ' & Arrival time : '
. $this->input->post('arrive_time')
. ' & Departure China Flight no : '
. $this->input->post('departure_flight')
. ' & Departure time : '
. $this->input->post('depart_time');
} else {
$CUL_Memo = '';
}
$CUL_Memo .= $this->input->post('insurance_information');
$CUL_Memo = $this->input->post('insurance_information');
$MEI_Memo = $this->input->post('special_request') . ' ' . $CUL_Memo;
//$birthday[$key] = date('Y-m-d H:i:s', strtotime($birthday[$key]));
$birthday_tmp = date('Y-m-d H:i:s', strtotime($birthday[$key]));
//$expiration_date[$key] = date('Y-m-d H:i:s', strtotime($expiration_date[$key]));
$expiration_date_tmp = date('Y-m-d H:i:s', strtotime($expiration_date[$key]));
$MEI_SN = $this->Order_model->add_customer_info($gender[$key], $nationality[$key], $MEI_FirstName, $MEI_LastName, $passport[$key], $expiration_date_tmp, $birthday_tmp, $MEI_Memo, $MEI_Street, '', $contact_phone, 0, $COLI_SN, $visitor_link);
$MEI_SN = $this->Order_model->add_customer_info($gender[$key], $nationality[$key], $MEI_FirstName, $MEI_LastName, $passport[$key], $expiration_date_tmp, $birthday_tmp, $MEI_Memo, $MEI_Street, '', $contact_phone, 0, $COLI_SN, $visitor_link,$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime);
}
}
if ($MEI_SN && $this->input->post('emergency_person_name') != '') {
$add_emergency_res = $this->Order_model->add_customer_info(
'', '', $this->input->post('emergency_person_name'), '', '', '', '', $this->input->post('emergency_relationship'), '', $this->input->post('emergency_email'), $this->input->post('emergency_telephone'), 1, $COLI_SN, $visitor_link
,$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime
);
}
@ -133,7 +126,7 @@ class Confirm extends CI_Controller {
echo json_encode(array('status' => 'no'));
}
}
//只有ch有review功能
function review() {
$data = array();

@ -43,7 +43,7 @@ class Order_model extends CI_Model {
}
//添加客人信息
public function add_customer_info($MEI_Gender,$MEI_Nationality,$MEI_FirstName,$MEI_LastName,$MEI_PassportNo,$MEI_PassportValidDate,$MEI_Birthday,$MEI_Memo,$MEI_Street,$MEI_MailList='',$MEI_Phone='',$CUL_IsEmergency=0,$CUL_COLI_SN='',$visitor_link='')
public function add_customer_info($MEI_Gender,$MEI_Nationality,$MEI_FirstName,$MEI_LastName,$MEI_PassportNo,$MEI_PassportValidDate,$MEI_Birthday,$MEI_Memo,$MEI_Street,$MEI_MailList='',$MEI_Phone='',$CUL_IsEmergency=0,$CUL_COLI_SN='',$visitor_link='',$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime)
{
$createdate=date('Y-m-d H:i:s');
$sql="INSERT INTO MEmberInfoTmpCheck
@ -69,9 +69,13 @@ class Order_model extends CI_Model {
visitor_link,
CreateDate,
CUL_IsLinkMan,
copyState
) VALUES (?,?,?,?,?,?,?,?,?,?,?,102001,0,0,1,1,?,?,?,?,0,0) ";
$this->HT->query($sql, array($MEI_Gender,$MEI_Nationality,$MEI_FirstName,$MEI_LastName,$MEI_PassportNo,$MEI_PassportValidDate,$MEI_Birthday,$MEI_Memo,$MEI_Street,$MEI_MailList,$MEI_Phone,$CUL_IsEmergency,$CUL_COLI_SN,$visitor_link,$createdate));
copyState,
MEI_ArrivalFlightNo,
MEI_ArrivalTime,
MEI_DepartureFlightNo,
MEI_DepartureTime
) VALUES (?,?,?,?,?,?,?,?,?,?,?,102001,0,0,1,1,?,?,?,?,0,0,?,?,?,?) ";
$this->HT->query($sql, array($MEI_Gender,$MEI_Nationality,$MEI_FirstName,$MEI_LastName,$MEI_PassportNo,$MEI_PassportValidDate,$MEI_Birthday,$MEI_Memo,$MEI_Street,$MEI_MailList,$MEI_Phone,$CUL_IsEmergency,$CUL_COLI_SN,$visitor_link,$createdate,$MEI_ArrivalFlightNo,$MEI_ArrivalTime,$MEI_DepartureFlightNo,$MEI_DepartureTime));
$insertid = $this->HT->last_id('MEmberInfoTmpCheck');//$this->HT->insert_id();
return $insertid;
}

@ -7,13 +7,13 @@
<meta name="robots" content="noindex,nofollow" />
<title>China Highlights! Please complete and submit the information.</title>
<link href="https://www.chinahighlights.com/css/min.php?f=/image/customer_center_data/css/bootstrap.min.css,/image/customer_center_data/css/order.css,/image/customer_center_data/css/bootstrap-datetimepicker.min.css&v=20150506" rel="stylesheet">
<link href="https://data.chinahighlights.com/css/min.php?f=/image/customer_center_data/css/bootstrap.min.css,/image/customer_center_data/css/order.css,/image/customer_center_data/css/bootstrap-datetimepicker.min.css&v=20150506" rel="stylesheet">
<!--[if lte IE 9]>
<link href="https://www.chinahighlights.com/public/js/fixie/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />
<link href="https://www.chinahighlights.com/public/js/fixie/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />
<script src="https://www.chinahighlights.com/js/min.php?f=/public/js/respond.min.js,/public/js/fixie/respond.proxy.js"></script>
<![endif]-->
<script src="https://www.chinahighlights.com/js/min.php?f=/image/customer_center_data/js/jquery.min.js,/image/customer_center_data/js/bootstrap.min.js,/image/customer_center_data/js/jquery-ui.min.js,/image/customer_center_data/js/jquery-ui-timepicker-addon.js&v=20150506"></script>
<script src="https://data.chinahighlights.com/js/min.php?f=/image/customer_center_data/js/jquery.min.js,/image/customer_center_data/js/bootstrap.min.js,/image/customer_center_data/js/jquery-ui.min.js,/image/customer_center_data/js/jquery-ui-timepicker-addon.js&v=20150506"></script>
<link rel="shortcut icon" href="https://www.chinahighlights.com/favicon.ico">
<style type="text/css">.popover{background-color:#f2f600;}</style>
</head>
@ -70,7 +70,10 @@
<div class="panel-body">
<div class="row panel-new-head">
<h4 class="text-red">Passenger Information <span class="text-muted" style="font-size:15px;">(we need passport info for all the group members)</span></h4>
<h4 class="text-red">Passenger Information <span class="text-muted" style="font-size:15px;">(we need passport info for all the group members)</span><br/>
<small class="text-muted" style="font-size:15px;">Please ensure the details you provide are <span class="text-red">correct, as stated in your passport.</span> We use this information to book all your hotels and transportation. If the name you provide are incorrect, you would not be able to board your flight or trains in China, and therefore reissuing of tickets would be at your expense! </small>
</h4>
</div>
<div class="col-xs-24 nopadding hidden-xs">
@ -461,25 +464,25 @@
<div class="col-xs-24 flight-info-box">
<div class="form-group col-sm-6 nopadding">
<label>Arrival China Flight No.</label>
<input type="text" class="form-control input-sm" name="arrive_flight" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your Flight No.!">
<input type="text" class="form-control input-sm" name="MEI_ArrivalFlightNo" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your Flight No.!">
</div>
<div class="form-group col-sm-6 nopadding-R">
<label>Arrival time</label>
<div class="input-groups date" >
<input class="form-control input-sm f_datepicker" type="text" name="arrive_time" value="" autocomplete="off" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your arrival time!" style="color:#333333 !important;">
<input class="form-control input-sm f_datepicker" type="text" name="MEI_ArrivalTime" value="" autocomplete="off" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your arrival time!" style="color:#333333 !important;">
</div>
</div>
<div class="form-group col-sm-6 nopadding-R">
<label>Departure China Flight no.</label>
<input type="text" class="form-control input-sm" name="departure_flight" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your flight no.!">
<input type="text" class="form-control input-sm" name="MEI_DepartureFlightNo" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your flight no.!">
</div>
<div class="form-group col-sm-6 nopadding-R">
<label>Departure time</label>
<div class="input-groups date ">
<input class="form-control input-sm f_datepicker" type="text" name="depart_time" value="" autocomplete="off" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your departure time!" style="color:#333333 !important;">
<input class="form-control input-sm f_datepicker" type="text" name="MEI_DepartureTime" value="" autocomplete="off" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your departure time!" style="color:#333333 !important;">
</div>
</div>
@ -506,6 +509,7 @@
Vegetarian food for
Different arrival/departure information for
Special Assistance/Disability Needs for Customers
Any surgery recently
"></textarea>
</div>
<div class="col-xs-24 btn-lg"></div>
@ -727,6 +731,8 @@
});
// $("#btn-add-personinfo-box").click();
//日期初始化
$('.f_datepicker').datetimepicker({

@ -7,16 +7,16 @@
<meta name="robots" content="noindex,nofollow" />
<title>www.chinatravel.com</title>
<link href="/css/order/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="/css/order/order.css?v=201506052" rel="stylesheet" type="text/css"/>
<link href="/css/order/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
<link href="//data.chinatravel.com/css/info/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="//data.chinatravel.com/css/info/order.css?v=201506052" rel="stylesheet" type="text/css"/>
<link href="//data.chinatravel.com/css/info/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
<!--[if lt IE 9]>
<script src="/js/respond.min.js" type="text/javascript"></script>
<![endif]-->
<script src="/js/jquery.min.js" type="text/javascript"></script>
<script src="/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js" type="text/javascript"></script>
<script src="/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<script src="//data.chinatravel.com/js/info/jquery.min.js" type="text/javascript"></script>
<script src="//data.chinatravel.com/js/info/bootstrap.min.js" type="text/javascript"></script>
<script src="//data.chinatravel.com/js/info/jquery-ui.min.js" type="text/javascript"></script>
<script src="//data.chinatravel.com/js/info/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<style type="text/css">
#header {background: #DF6536 !important;}
.text-red{color: #DF6536 !important;}
@ -33,7 +33,7 @@
<div class="row">
<div class="col-lg-3 col-sm-4 logobox hidden-xs" style="top:8px;">
<a href="javascript:void(0);">
<img src="http://www.chinatravel.com/images/chinatravel-logo.png" alt="logo">
<img src="//www.chinatravel.com/images/chinatravel-logo.png" alt="logo">
</a>
</div>
<div class="col-lg-15 col-sm-13 col-lg-offset-3 col-sm-offset-4">
@ -68,7 +68,7 @@
<h4 class="text-center text-red">Thanks for booking with China Travel! </h4>
<h4 class="text-center text-red">Please complete and submit the information below.</h4>
</div>
<form id="form-confirm-info" method="post" action="<?php echo site_url('apps/order/confirm/save_confirm_info'); ?>">
<form id="form-confirm-info" method="post" action="<?php echo '/info.php/apps/order/confirm/save_confirm_info'; ?>">
<div class="col-xs-24 personinfo-box">
<div class="panel panel-default">
<div class="panel-body">
@ -446,25 +446,25 @@
<div class="col-xs-24 flight-info-box">
<div class="form-group col-sm-6 nopadding">
<label>Arrival China Flight No.</label>
<input type="text" class="form-control input-sm" name="arrive_flight" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your Flight No.!">
<input type="text" class="form-control input-sm" name="MEI_ArrivalFlightNo" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your Flight No.!">
</div>
<div class="form-group col-sm-6 nopadding-R">
<label>Arrival time</label>
<div class="input-groups date" >
<input class="form-control input-sm f_datepicker" type="text" name="arrive_time" value="" autocomplete="off" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your arrival time!" style="color:#333333 !important;">
<input class="form-control input-sm f_datepicker" type="text" name="MEI_ArrivalTime" value="" autocomplete="off" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your arrival time!" style="color:#333333 !important;">
</div>
</div>
<div class="form-group col-sm-6 nopadding-R">
<label>Departure China Flight no.</label>
<input type="text" class="form-control input-sm" name="departure_flight" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your flight no.!">
<input type="text" class="form-control input-sm" name="MEI_DepartureFlightNo" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your flight no.!">
</div>
<div class="form-group col-sm-6 nopadding-R">
<label>Departure time</label>
<div class="input-groups date ">
<input class="form-control input-sm f_datepicker" type="text" name="depart_time" value="" autocomplete="off" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your departure time!" style="color:#333333 !important;">
<input class="form-control input-sm f_datepicker" type="text" name="MEI_DepartureTime" value="" autocomplete="off" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Please fill in your departure time!" style="color:#333333 !important;">
</div>
</div>
@ -643,7 +643,7 @@ $(document).ready(function(){
data: data,
success: function(json_data) {
if (json_data.status == 'ok') {
location.href='<?php echo site_url('apps/order/confirm/index/0/0/0/ct'); ?>';
location.href='<?php echo '/info.php/apps/order/confirm/index/0/0/0/ct'; ?>';
} else {
$btn.button('reset');
$('#myModal').modal('show');

@ -7,16 +7,16 @@
<meta name="robots" content="noindex,nofollow" />
<title>www.chinatravel.com</title>
<link href="/css/order/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="/css/order/order.css?v=201506052" rel="stylesheet" type="text/css"/>
<link href="/css/order/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
<link href="//data.chinatravel.com/css/info/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="//data.chinatravel.com/css/info/order.css?v=201506052" rel="stylesheet" type="text/css"/>
<link href="//data.chinatravel.com/css/info/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
<!--[if lt IE 9]>
<script src="/js/respond.min.js" type="text/javascript"></script>
<![endif]-->
<script src="/js/jquery.min.js" type="text/javascript"></script>
<script src="/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js" type="text/javascript"></script>
<script src="/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<script src="//data.chinatravel.com/js/info/jquery.min.js" type="text/javascript"></script>
<script src="//data.chinatravel.com/js/info/bootstrap.min.js" type="text/javascript"></script>
<script src="//data.chinatravel.com/js/info/jquery-ui.min.js" type="text/javascript"></script>
<script src="//data.chinatravel.com/js/info/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<style type="text/css">
#header {background: #DF6536 !important;}
.text-red{color: #DF6536 !important;}

@ -0,0 +1,409 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>China Reisen und China Rundreisen individuell | Chinarundreisen.com</title>
<link rel="stylesheet" href="//data.chinarundreisen.com/min/?f=/css/base.css,/css/header.css,/css/kunden-form.css"/>
<link href="https://data.chinarundreisen.com/information-view/information/css/bootstrap-datetimepicker.min.css?v=201506022" rel="stylesheet" type="text/css"/>
<script language="javascript" src="//data.chinarundreisen.com/min/?f=/js/base.js,/js/bootstrap.min.3.3.5.js,/js/lazyload.js,/js/common.js,/js/gotop.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery-ui.min.1-11-3.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<!--[if lt IE 9]>
<script src="https://data.chinarundreisen.com/information-view/bootstrap/js/respond.min.js" type="text/javascript"></script>
<![endif]-->
<style type="text/css">.popover{background-color:#f2f600;}</style>
</head>
<body>
<div id="warp">
<!-- 移动端导航start -->
<div class="sidenav-box cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left visible-sm visible-xs" id="menu" style="overflow-y: scroll;">
<div class="sidenav-top">
<ul>
<li><a href="/" class="home"></a></li>
<li><a href="/ueber-uns/" class="contact"></a></li>
<li><a href="/kontakt/" class="email"></a></li>
<li><a href="tel://800-8224462" class="cell"></a></li>
</ul>
<div class="clearfix"></div>
</div>
<ul class="sidenav-menu">
<li> <a href="//www.chinarundreisen.com/massgeschneiderte-china-reisen/" class="active" style="margin-left:30px !important; padding-right: 50px;">Maßschneidern Ihrer Reise</a>
</li>
<li style="position:relative"><span class="close-btn"></span>
<a href="//www.chinarundreisen.com/china-rundreisen/" class="active">Chinarundreisen<span class="phone-arrow"></span></a>
<ul class="sidenav-dropdown" style="display:none">
<li><a href="/chinareisen/">China Reisen 2018</a></li>
<li><a href="/china-individualreisen/">China Individualreisen</a></li>
<li><a href="/panda/">Panda</a></li>
<li><a href="/wanderung-reisen/">Wanderung</a></li>
<li><a href="/tagesreisen/">Tagesreisen</a></li>
<li><a href="/china-kreuzfahrtausflug/">Kreuzfahrt Ausflug</a></li>
</ul>
</li>
<li style="position:relative"><span class="close-btn"></span>
<a href="/reiseziele/" class="active">Reiseziele<span class="phone-arrow"></span></a>
<ul class="sidenav-dropdown" style="display:none">
<li><a href="/beijing/">Beijing</a></li>
<li><a href="/shanghai/">Shanghai</a></li>
<li><a href="/guilin/">Guilin </a></li>
<li><a href="/xian/">Xian</a></li>
<li><a href="/yangtse/">Yangtse Kreuzfahrt</a></li>
</ul>
</li>
<li><a href="/guide-book/">Reiseführer</a></li>
<li><a href="/china-info/kultur.htm">Kultur</a></li>
<li><a href="/ueber-uns/">über uns</a></li>
</ul>
</div>
<div class="phone-header cbp-spmenu-push visible-sm visible-xs" id="phoneheader">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
<i class="fa fa-navicon" id="showLeftPush"></i>
</button>
<div class="phone-logo">Chinarundreisen</div>
<a href="/massgeschneiderte-china-reisen/" class="white-btn">Anfragen</a>
</div>
<!-- 移动端导航end -->
<!-- pc端导航start -->
<div id="header" class="hidden-sm hidden-xs">
<div class="container">
<div class="logo">
<a href="/">
<img src="http://data.chinarundreisen.com/public/pic/common/widget/header/pic/logo1_3d64397.jpg" alt="China Highlights" />
</a>
</div>
<div class="top-content">
<div class="top-bar">
<ul>
<li><span class="cell-icon"></span>800-8224462 <span style="opacity:0.4;filter:alpha(opacity=40);">(9:00-17:00 Uhrzeit China)</span></li>
<li><a href="/ueber-uns/">über uns</a></li>
<li><a href="/kontakt/">Kontakt</a></li>
<li><a href="/feedback/">Bewertung</a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="top-nav" style="margin-bottom: -10px;">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/china-rundreisen/">Chinarundreisen</a></li>
<li><a href="/massgeschneiderte-china-reisen/">Maßschneidern Ihrer Reise</a></li>
<li><a href="/reiseziele/">Reiseziele</a></li>
<li><a href="/guide-book/">Reiseführer</a></li>
<li><a href="/china-info/kultur.htm">Kultur</a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="nav-sub">
<div class="clearfix"></div>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
<!-- pc端导航end -->
<!-- content -->
<div class="bg-gray">
<div class="container">
<div class="row mtop30">
<div class="col-xs-12 col-sm-12 col-md-8">
<h1>Vielen Dank für die Buchung bei Chinarundreisen!<br/>Bitte füllen Sie das folgende Formular aus</h1>
<div class="top-note">
<span class="note-tag">!</span>
Bitte prüfen Sie, ob Ihr Name richtig geschrieben ist (vollständiger Name wie im Reisepass) . Da wir die Folgekosten durch ein wegen falschem Namen stornierten Hotel oder Flugticketnicht tragen, ist die richtige Schreibweise Ihres Namens und Ihrer alle Daten unbedingt wichtig.
</div>
<form id="form-confirm-info" method="post" action="/secureinfoconfirm/confirm/save_confirm_info">
<div class="kunden-info-box ">
<h2>Fluginformationen</h2>
<div class="kunden-info">
<div class="form-content">
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-4 form-col">Flug Nr.und Datum Ihrer Ankunft in China</label>
<div class="col-sm-5 form-col">
<input class="form-control" name="MEI_ArrivalFlightNo" required/>
</div>
<div class="col-sm-3 form-col">
<input class="form-control calendar f_datepicker" name="MEI_ArrivalTime" required/>
</div>
<div class="clearfix"></div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-4 form-col">Flug Nr.und Datum Ihres Abfluges</label>
<div class="col-sm-5 form-col">
<input type="" class="form-control" name="MEI_DepartureFlightNo" required/>
</div>
<div class="col-sm-3 form-col">
<input type="" class="form-control calendar f_datepicker" name="MEI_DepartureTime" required/>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="b-text">
<p class="red"><a href="" class="addmemeber" target="_blank">Falls jemand die andere Flug nach China nehmen, klicken Sie hier die Info auszufüllen.<span class="red-round"><i class="leftcaret"></i></span></a></p>
</div>
</div>
</div>
<div class="kunden-info-box ">
<h2>Kundeninformationen</h2>
<div class="kunden-info ">
<div class="form-content">
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col">Name</label>
<div class="col-sm-6 col-md-5 form-col">
<div class="gender-left">
<select class="form-control" name="gender[]">
<option value="100003"> Frau</option>
<option value="100001"> Herr</option>
</select>
</div>
<div class="gender-right">
<input class="form-control require" name="sur_name[]" placeholder="Nachname" type="text" required/>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 form-col">
<input type="text" name="given_name[]" class="form-control" placeholder="Name" required/>
</div>
<div class="clearfix"></div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col">Geburtstag</label>
<div class="col-sm-6 col-md-5 form-col">
<input type="text" class="form-control calendar bd_datepicker" name="birthday[]" required/>
</div>
<div class="clearfix"></div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col">Passnr.</label>
<div class="col-xs-12 col-sm-12 col-md-5 form-col">
<input type="text" class="form-control" name="passport[]" required/>
</div>
<div class="clearfix"></div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col line2">Verfallsdatum <br />
des Reisepasses</label>
<div class="col-xs-12 col-sm-12 col-md-5 form-col">
<input type="text" class="form-control calendar passport_expiration_date" name="passport_expiration_date[]" required/>
</div>
<div class="clearfix"></div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col">Nationalität</label>
<div class="col-xs-12 col-sm-12 col-md-5 form-col">
<select class="form-control" name="nationality[]">
<option selected="selected" disabled="disabled"> Nationalität</option>
<option value="6"> Deutschland</option>
<option value="25"> Die Schweiz</option>
<option value="470"> Österreich</option>
<option value="572">Luxemburg</option>
<option value="5">Kanada</option>
<option value="8">Frankreich</option>
</select>
</div>
<div class="clearfix"></div>
</div>
</div>
<p class="red addperson">
<a href="javacript:void(0);"><span class="add-btn">+</a> Mitreisende hinzufügen
</p>
<div class="b-text">
<div class="add-content">
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col">Kontakttelefon</label>
<div class="col-xs-6 col-sm-6 col-md-4 form-col">
<input type="" class="form-control" placeholder="Land line" name="landline" required/>
</div>
<div class="col-xs-6 col-sm-6 col-md-4 form-col">
<input type="" class="form-control" placeholder="Handy" name="mobile" required/>
</div>
<div class="clearfix"></div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col">Anschrift</label>
<div class="col-xs-12 col-sm-12 col-md-8 form-col">
<p class="mbottom20"><input type="text" class="form-control" id="input2" placeholder="Straße" name="street" required/></p>
<p class="mbottom20"><input type="text" class="form-control" id="input2" placeholder="Stadt" name="city" required/></p>
<p><input type="text" class="form-control" id="input2" placeholder="Land" name="country" required/></p>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>
<div class="kunden-info-box ">
<h2>Besondere Anforderungen</h2>
<div class="kunden-info ">
<textarea name="special_request" class="form-control" cols="30" rows="5" placeholder="Großes Bett für
Vegetarisches Essen für
Andere Abfahrts-/Ankunftszeit für
" required></textarea>
</div>
</div>
<div class="kunden-info-box ">
<h2>Kontaktinformationen für Notfälle<span class="font16"> (im Falle eines Notfalls während Ihrer Chinareise)</span></h2>
<div class="kunden-info ">
<div class="form-content">
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col">Kontaktsperson</label>
<div class="col-sm-6 col-md-5 form-col">
<input type="text" class="form-control" name="emergency_person_name" required/>
</div>
<div class="clearfix"></div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col">Email Adresse</label>
<div class="col-xs-12 col-sm-12 col-md-5 form-col">
<input type="text" class="form-control" name="emergency_email" required/>
</div>
<div class="clearfix"></div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col line2">Beziehung
<br />mit ihm/ihr</label>
<div class="col-xs-12 col-sm-12 col-md-5 form-col">
<input type="text" class="form-control" name="emergency_relationship" required/>
</div>
<div class="clearfix"></div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col">Telefon Nr.</label>
<div class="col-xs-12 col-sm-12 col-md-5 form-col">
<input type="text" class="form-control" name="emergency_telephone" required/>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
<div class=" text-center">
<input type="hidden" name="toname" value="<?php echo $userinfo[0]->OPI_FirstName; ?>">
<input type="hidden" name="tomail" value="<?php echo $userinfo[0]->OPI_Email; ?>">
<input type="hidden" name="COLI_ID" value="<?php echo $userinfo[0]->COLI_ID; ?>">
<input type="hidden" name="COLI_SN" value="<?php echo $userinfo[0]->COLI_SN; ?>">
<input type="hidden" name="visitor_link" value="<?php echo $visitor_link; ?>">
<button href="javascript:;" id="form-confirm-info" class="btn btn-danger btn-lg">Überprüfen & Absenden</button>
<p><img src="https://data.chinarundreisen.com/pic/btn-text.jpg" width="311" height="30" /></p>
</div>
<div class="form-footer">
Copyright © 2002. Chinarundreisen.com Alle Rechte vorbehalten.
</div>
</div>
</div>
</div>
</div>
</form>
<!-- content -->
</div>
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Fehler!</h4>
</div>
<div class="modal-body" style="height:150px;">
<p class="text-danger lead" style="padding-top:10px;">Fehler: Bitte kontaktieren Sie Ihren Reisebegleiter.</p>
</div>
</div>
</div>
</div>
<script>
$(function(){
//到达日期/出发日期
$('.f_datepicker').datepicker({
controlType: 'select',
oneLine: true,
changeMonth: false,
changeYear: false,
timeFormat: 'H:mm'
});
//用on来绑定防止新添加的元素无法相应初始化配置但是有一个bug如果第一次直接点击无法启用日历
$('body').on('click',function(){
//生日
$('.bd_datepicker').datepicker({
controlType: 'select',
oneLine: true,
changeMonth: true,
changeYear: true,
defaultDate:'-45y',
yearRange: '1920:2015',
timeFormat: 'mm/dd/yy'
});
//护照过期时间
$('.passport_expiration_date').datepicker({
controlType: 'select',
oneLine: true,
changeMonth: true,
changeYear: true,
yearRange: '2010:2025',
timeFormat: 'mm/dd/yy'
});
});
//添加乘客
$('.addperson').click(function(){
var addhtml = '<div class="b-text"></div><div class="form-content"><div class="form-group"><label class="col-xs-12 col-sm-12 col-md-3 form-col">Name</label><div class="col-sm-6 col-md-5 form-col"><div class="gender-left"><select class="form-control" name="gender[]"><option value="100003"> Frau</option><option value="100001"> Herr</option></select></div><div class="gender-right"><input class="form-control require" name="sur_name[]" placeholder="Nachname" type="text"></div></div><div class="col-xs-12 col-sm-12 col-md-4 form-col"><input type="text" name="given_name[]" class="form-control" placeholder="Name"></div><div class="clearfix"></div></div><div class="form-group"><label class="col-xs-12 col-sm-12 col-md-3 form-col">Geburtstag</label><div class="col-sm-6 col-md-5 form-col"><input type="text" class="form-control calendar bd_datepicker" name="birthday[]"></div><div class="clearfix"></div></div><div class="form-group"><label class="col-xs-12 col-sm-12 col-md-3 form-col">Passnr.</label><div class="col-xs-12 col-sm-12 col-md-5 form-col"><input type="text" class="form-control" name="passport[]"></div><div class="clearfix"></div></div><div class="form-group"><label class="col-xs-12 col-sm-12 col-md-3 form-col line2">Verfallsdatum <br>des Reisepasses</label><div class="col-xs-12 col-sm-12 col-md-5 form-col"><input type="text" class="form-control calendar passport_expiration_date" name="passport_expiration_date[]"></div><div class="clearfix"></div></div><div class="form-group"><label class="col-xs-12 col-sm-12 col-md-3 form-col">Nationalität</label><div class="col-xs-12 col-sm-12 col-md-5 form-col"><select class="form-control" name="nationality[]"><option selected="selected" disabled="disabled"> Nationalität</option><option value="6"> Deutschland</option><option value="25"> Die Schweiz</option><option value="470"> Österreich</option><option value="572">Luxemburg</option><option value="5">Kanada</option><option value="8">Frankreich</option></select></div><div class="clearfix"></div></div></div>';
$(this).before(addhtml);
});
var coli_sn = <?php echo $userinfo[0]->COLI_SN;?>;
//ajax获取新生成页面的url
$.ajax({
type: "post",
url: '/ajax/get_member_uri/'+coli_sn,
success: function(return_url) {
$('.addmemeber').attr('href',return_url);
}
});
//提交信息
$("#form-confirm-info").submit(function(event){
event.preventDefault();
var $btn = $("#btn-add-userinfo").button('loading');
var url=$(this).attr('action');
var data=$(this).serialize();
$.ajax({
type: "post",
url: url,
dataType: "json",
data: data,
success: function(json_data) {
if (json_data.status == 'ok') {
location.href='/secureinfoconfirm/confirm/index/0/0/0/gm';
} else {
$btn.button('reset');
$('#myModal').modal('show');
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$btn.button('reset');
alert(errorThrown);
}
});
});
})</script>
</body>
</html>

@ -0,0 +1,538 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>China Reisen und China Rundreisen individuell | Chinarundreisen.com</title>
<link href="https://data.chinarundreisen.com/information-view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="https://data.chinarundreisen.com/information-view/information/css/order.css" rel="stylesheet" type="text/css"/>
<link href="https://data.chinarundreisen.com/information-view/information/css/bootstrap-datetimepicker.min.css?v=201506022" rel="stylesheet" type="text/css"/>
<!--[if lt IE 9]>
<script src="https://data.chinarundreisen.com/information-view/bootstrap/js/respond.min.js" type="text/javascript"></script>
<![endif]-->
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery.min.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery-ui.min.1-11-3.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<style type="text/css">.popover{background-color:#f2f600;}</style>
</head>
<body>
<div id="headerWrapper">
<div id="header">
<div id="mainnav" class="nav navbar" role="navigation">
<div class="container-fluid">
<div class="row">
<div class="col-lg-3 col-sm-4 logobox hidden-xs">
<a href="/">
<img width="135" src="http://data.chinarundreisen.com/public/pic/common/widget/header/pic/logo1_3d64397.jpg" alt="logo">
</a>
</div>
<div class="col-lg-14 col-sm-13 col-lg-offset-3 col-sm-offset-4">
<div class="navbar-header">
<div class="col-xs-24 btn-lg"></div>
<div class="col-xs-24 text-white"><?php if(!isset($dear)) $dear='Liebe/r'; echo $dear; ?> <?php echo $username; ?></div>
<div class="col-xs-24 text-white">Buchungsnummer: <?php echo $userinfo[0]->COLI_ID; ?></div>
</div>
</div>
<div class="col-lg-7 col-sm-7 hidden-xs pull-right nopadding">
<div class="tollfree pull-right" style="padding-top:10px;">
<div class="currentNo col-sm-24 nopadding"><span class="glyphicon glyphicon-earphone" style="font-size:12px;"></span> +86 773 <?php echo $userinfo[0]->OPI_Telephone; ?>(GMT+8)</div>
<div class="col-sm-24">
<div class="currentNo col-sm-24 nopadding"> 800-822-4462(gebührenfrei aus Deutschland)</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-24 btn-lg"></div>
<div class="col-xs-24 welcome-text">
<h4 class="text-center text-red">Vielen Dank für die Buchung bei Chinarundreisen! </h4>
<h4 class="text-center text-red">Bitte füllen Sie das folgende Formular aus und schicken es zurück.</h4>
</div>
<form id="form-confirm-info" method="post" action="/secureinfoconfirm/confirm/save_confirm_info">
<div class="col-xs-24 personinfo-box">
<div class="panel panel-default">
<div class="panel-body">
<div class="row panel-new-head">
<h4 class="text-red">Kunden informationen</h4>
<p>Bitte prüfen Sie, ob Ihr Name richtig geschrieben ist (vollständiger Name wie im Reisepass) . Da wir die Folgekosten durch ein wegen falschem Namen stornierten Hotel oder Flugticket nicht tragen, ist die richtige Schreibweise Ihres Namens und Ihrer alle Daten unbedingt wichtig.</p>
</div>
<div class="col-xs-24 nopadding">
<div class="form-group col-sm-7 nopadding-R" style="margin-bottom:0px;">
<label style="width:100%;text-align:left !important;font-weight:normal">
<span class="col-xs-6 nopadding"></span>
<div class="col-xs-18 nopadding-L" style="height:15px;">
<div class="col-xs-11 nopadding text-right">Nachname</div>
<div class="col-xs-1 nopadding text-right" style="font-size:18px;width:10px;">/</div>
<div class="col-xs-11 nopadding" style="padding-left: 2px !important;">Name</div>
</div>
</label>
</div>
<div class="form-group col-sm-4 nopadding-R" style="margin-bottom:0px;">
<label class="" style="font-weight:normal">Geburtstag</label>
</div>
<div class="form-group col-sm-4 nopadding-R" style="margin-bottom:0px;">
<label class="" style="font-weight:normal">Passnr.</label>
</div>
<div class="form-group col-sm-5 nopadding-R" style="margin-bottom:0px;">
<label class="" style="font-weight:normal">Verfallsdatum des Reisepasses</label>
</div>
<div class="form-group col-sm-4" style="margin-bottom:0px;">
<label class="" style="font-weight:normal">Nationalität</label>
</div>
</div>
<div class="col-xs-24 nopadding personinfo-input-box">
<div class="form-group col-sm-7 nopadding-R">
<div class="row">
<div class="col-xs-6 nopadding-R">
<select class="form-control input-sm nopadding-L" name="gender[]">
<option value="100001">Herr</option>
<option value="100003">Frau</option>
</select>
</div>
<div class="col-xs-18 nopadding-L">
<div class="input-group">
<div class="form-control input-sm nopadding">
<div class="col-xs-11 nopadding">
<input name="sur_name[]" class="common_input form-control input-sm nopadding-R" placeholder="" style="border:none;height:28px;" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie hier Ihren Nachname!">
</div>
<div class="col-xs-1 nopadding text-center" style="font-size:18px;width:10px;">/</div>
<div class="col-xs-11 col-sm-11 nopadding">
<input name="given_name[]" class="common_input form-control input-sm nopadding-R" placeholder="" style="border:none;height:28px;" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie hier Ihren Name!">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group col-sm-4 nopadding-R">
<div class="input-groups date " data-date="1970-05-20">
<input class="form-control input-sm common_input bd_datepicker" type="text" name="birthday[]" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihr Geburtsdatum ein!" autocomplete="off" style="color:#333333 !important;">
</div>
</div>
<div class="form-group col-sm-4 nopadding-R">
<input type="text" class="form-control input-sm common_input" name="passport[]" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Ausweisnummer ein!" autocomplete="off">
</div>
<div class="form-group col-sm-5 nopadding-R">
<div class="input-groups date">
<input class="form-control input-sm common_input datepicker" type="text" name="passport_expiration_date[]" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie das Datum ein, wann Ihr Personalausweis abläuft!" autocomplete="off" style="color:#333333 !important;">
</div>
</div>
<div class="form-group col-sm-4">
<div class="input-group">
<select class="form-control input-sm common_input" name="nationality[]">
<optgroup label="--Top Nationalitäten--">
<option value="6" selected="selected">
Deutschland
</option>
<option value="470">
Österreich
</option>
<option value="25">
die Schweiz
</option>
<option value="572">
Luxemburg
</option>
</optgroup>
<optgroup label="--Mehr Nationalitäten--">
<option value="5">
Kanada
</option>
<option value="8">
Frankreich
</option>
<option value="527">
Finland
</option>
</optgroup>
</select>
<span class="input-group-addon" style="background:#fff;border:none;padding:2px 3px;">
<span class="glyphicon glyphicon-minuss text-danger"></span>
</span>
</div>
</div>
</div>
<div class="col-xs-24 add-personinfo-box">
<span class="text-red" id="btn-add-personinfo-box">
<span class="glyphicon glyphicon-plus"></span> Mitreisende hinzufügen
</span>
<div class="col-xs-24 btn-lg"></div>
</div>
<div class="form-group col-xs-24 Home-Address">
<div class="input-group">
<span class="input-group-addon">
Kontakttelefon:
</span>
<div class="form-control input-sm nopadding" style="border:none;-webkit-box-shadow: inset 0 0px 0px rgba(0,0,0,0.075);box-shadow: inset 0 0px 0px rgba(0,0,0,0.">
<div class="col-xs-11 nopadding">
<input type="text" name="landline" value="" class="common_input form-control input-sm" placeholder="land line" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Nummer an Land ein!">
</div>
<div class="col-xs-13 nopadding">
<input type="text" name="mobile" value="" class="common_input form-control input-sm" placeholder="Handy" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Handynummer ein!">
</div>
</div>
</div>
</div>
<?php if($userinfo[0]->COLI_CustomerType!=44003){ ?>
<div class="form-group col-xs-24 Home-Address">
<div class="input-group">
<span class="input-group-addon" style="min-width:120px;">
Anschrift:
</span>
<div class="form-control input-sm hidden-xs nopadding">
<div class="col-xs-7 nopadding">
<input name="address_street" class="input_home_address form-control input-sm" placeholder="Straße" style="border:none;height:28px;" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Heimatadresse ein!">
</div>
<div class="col-xs-1 nopadding" style="font-size:18px;width:10px;">,</div>
<div class="col-xs-7 nopadding">
<input name="address_city" class="input_home_address form-control input-sm nopadding" placeholder="Stadt" style="border:none;height:28px;" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Heimatadresse ein!">
</div>
<div class="col-xs-1 nopadding hidden" style="font-size:18px;width:10px;">,</div>
<div class="col-xs-5 nopadding hidden">
<input name="address_state" class="input_home_address form-control input-sm nopadding" placeholder="State" style="border:none;height:28px;" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Heimatadresse ein!">
</div>
<div class="col-xs-1 nopadding" style="font-size:18px;width:10px;">,</div>
<div class="col-xs-8 nopadding">
<input name="address_country" class="input_home_address form-control input-sm nopadding" placeholder="Land" style="border:none;height:28px;" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Heimatadresse ein!">
</div>
</div>
<input class="form-control input-sm visible-xs-block" name="home_address">
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="col-xs-24 flightinfo-box">
<div class="panel panel-default">
<div class="panel-body">
<div class="row panel-new-head">
<h4 class="text-red">Fluginformationen</h4>
</div>
<div class="col-xs-24 flight-info-box">
<div class="form-group col-sm-6 nopadding">
<label>Ankunftsflug in China </label>
<input type="text" class="form-control input-sm" name="MEI_ArrivalFlightNo" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Flugnummer ein!">
</div>
<div class="form-group col-sm-6 nopadding-R">
<label>Ankunftszeit</label>
<div class="input-groups date" >
<input class="form-control input-sm f_datepicker" type="text" name="MEI_ArrivalTime" value="" autocomplete="off" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Ankunftszeit ein!" style="color:#333333 !important;">
</div>
</div>
<div class="form-group col-sm-6 nopadding-R">
<label>Abflugnummer von China</label>
<input type="text" class="form-control input-sm" name="MEI_DepartureFlightNo" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Flugnummer ein!">
</div>
<div class="form-group col-sm-6 nopadding-R">
<label>Abflugzeit</label>
<div class="input-groups date ">
<input class="form-control input-sm f_datepicker" type="text" name="MEI_DepartureTime" value="" autocomplete="off" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Abfahrtszeit ein!" style="color:#333333 !important;">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-24">
<div class="panel panel-default">
<div class="panel-body">
<div class="row panel-new-head">
<h4 class="text-red">
Besondere Anforderungen
</h4>
</div>
<div class="col-xs-24 special_request_box">
<div class="form-group">
<div class="col-xs-24 nopadding">
<textarea class="form-control input-sm" rows="5" name="special_request" placeholder="Großes Bett für
Vegetarisches Essen für
Andere Abfahrts-/Ankunftszeit für
"></textarea>
</div>
<div class="col-xs-24 btn-lg"></div>
</div>
</div>
</div>
</div>
</div>
<?php if($userinfo[0]->COLI_CustomerType!=44003){ ?>
<div class="col-xs-24">
<div class="panel panel-default">
<div class="panel-body">
<div class="row panel-new-head">
<h4 class="text-red">
Kontaktinformationen für Notfälle
<span class="text-muted" style="font-size:15px;">(im Falle eines Notfalls während Ihrer Chinareise)</span>
</h4>
</div>
<div class="col-xs-24 new-form-horizontal emergencyx_box">
<div class="form-group col-sm-13">
<label class="col-sm-9 control-label nopadding-L">Kontaktsperson</label>
<div class="col-sm-13 nopadding">
<input type="text" class="form-control input-sm" name="emergency_person_name" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihren Kontakt für Notfälle ein!">
</div>
</div>
<div class="form-group col-sm-11">
<label class="col-sm-7 control-label nopadding-L">Email Adresse</label>
<div class="col-sm-17 nopadding">
<input type="text" class="form-control input-sm" name="emergency_email" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie ihre E-Mail-Adresse ein!">
</div>
</div>
<div class="form-group col-sm-13">
<label class="col-sm-9 control-label nopadding-L">Beziehung mit ihm/ihr</label>
<div class="col-sm-13 nopadding">
<input type="text" class="form-control input-sm" name="emergency_relationship" placeholder="z.B.: Er ist der Vater von Sue." value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie hier Ihren Beziehungsstatus ein!">
</div>
</div>
<div class="form-group col-sm-11">
<label class="col-sm-7 control-label nopadding-L">Telefon Nr. </label>
<div class="col-sm-17 nopadding">
<input type="text" class="form-control input-sm" name="emergency_telephone" placeholder="Länderkürzel + Postleitzahl (land line gibt es nicht in Deutschland)" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie hier Ihre Telefonnummer ein!">
</div>
</div>
<div class="col-xs-24 btn-lg"></div>
</div>
</div>
</div>
</div>
<?php } ?>
<div class="col-xs-24">
<input type="hidden" name="toname" value="<?php echo $userinfo[0]->OPI_FirstName; ?>">
<input type="hidden" name="tomail" value="<?php echo $userinfo[0]->OPI_Email; ?>">
<input type="hidden" name="COLI_ID" value="<?php echo $userinfo[0]->COLI_ID; ?>">
<input type="hidden" name="COLI_SN" value="<?php echo $userinfo[0]->COLI_SN; ?>">
<input type="hidden" name="visitor_link" value="<?php echo $visitor_link; ?>">
<div class="col-sm-15 col-xs-24 nopadding">
<button type="submit" id="btn-add-userinfo" class="btn btn-danger btn-lg col-sm-9 col-xs-24 pull-right" style="min-width:300px;font-size:24px;">Überprüfen & Absenden</button>
</div>
<div class="partner-text col-sm-9 col-xs-24 text-left">Danke! Mit besten Grüßen, <?php echo $userinfo[0]->OPI_FirstName; ?></div>
</div>
</form>
</div>
</div>
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Fehler!</h4>
</div>
<div class="modal-body" style="height:150px;">
<p class="text-danger lead" style="padding-top:10px;">Fehler: Bitte kontaktieren Sie Ihren Reisebegleiter.</p>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$(".common_input,textarea").each(function(){
if ($(this).val()=='' && $(this).attr('placeholder')!='') {
var valstr=$(this).val($(this).attr('placeholder'));
$(this).css("color","#999999");
}
});
$(".common_input,textarea").click(function(){
if ($(this).val()==$(this).attr('placeholder') || $(this).val()=='') {
$(this).val('');
$(this).css("color","#333333");
}
$(this).popover('hide');
});
$(".common_input,textarea").blur(function(){
if ($(this).val()=='' && $(this).attr('placeholder')!='') {
$(this).val($(this).attr('placeholder'));
$(this).css("color","#999999");
}
});
//提交信息
$("#form-confirm-info").submit(function(event){
event.preventDefault();
var $btn = $("#btn-add-userinfo").button('loading');
var flag=true;
$(".common_input").each(function(){
if ($(this).val()==$(this).attr('placeholder') || $(this).val()=='') {
$(this).popover('show');
flag = false;
$btn.button('reset');
return false;
};
});
if (!flag) {
$btn.button('reset');
return false;
};
$(".input_home_address").each(function()
{
if ($(this).val()==$(this).attr('placeholder')) {
$(this).val('');
}
});
if ($("textarea").val()==$("textarea").attr('placeholder')) {
$("textarea").val('');
};
var url=$(this).attr('action');
var data=$(this).serialize();
$.ajax({
type: "post",
url: url,
dataType: "json",
data: data,
success: function(json_data) {
if (json_data.status == 'ok') {
location.href='/secureinfoconfirm/confirm/index/0/0/0/gm';
} else {
$btn.button('reset');
$('#myModal').modal('show');
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$btn.button('reset');
alert(errorThrown);
}
});
});
//移除一个客户信息
$('body').on('click','.glyphicon-minus',function(){
if(confirm("entfernen den Kunde?"))
{
$(this).parents('.personinfo-input-box').remove();
}
});
//添加一个客户信息
$("#btn-add-personinfo-box").click(function()
{
var html=$(".personinfo-input-box:first").clone();
$('.add-personinfo-box').before(html);
var num=$(".personinfo-input-box").length;
var $currentbox=$(".personinfo-input-box:last");
$currentbox.find('.glyphicon-minuss').addClass('glyphicon-minus').removeClass('glyphicon-minuss');
$currentbox.find('label').remove();
$currentbox.find('input').val('');
$currentbox.find('.datepicker').removeClass('hasDatepicker').attr('id','');
$currentbox.find('.bd_datepicker').removeClass('hasDatepicker').attr('id','');
$('.datepicker').datepicker({
controlType: 'select',
oneLine: true,
changeMonth: true,
changeYear: true,
yearRange: '2010:2025',
timeFormat: 'mm/dd/yy'
});
$('.bd_datepicker').datepicker({
controlType: 'select',
oneLine: true,
changeMonth: true,
changeYear: true,
defaultDate:'-45y',
yearRange: '1920:2015',
timeFormat: 'mm/dd/yy'
});
});
//日期初始化
$('.f_datepicker').datetimepicker({
controlType: 'select',
oneLine: true,
changeMonth: false,
changeYear: false,
timeFormat: 'H:mm'
});
$('.bd_datepicker').datepicker({
controlType: 'select',
oneLine: true,
changeMonth: true,
changeYear: true,
defaultDate:'-45y',
yearRange: '1920:2015',
timeFormat: 'mm/dd/yy'
});
$('.datepicker').datepicker({
controlType: 'select',
oneLine: true,
changeMonth: true,
changeYear: true,
yearRange: '2010:2025',
timeFormat: 'mm/dd/yy'
});
});
$(document).on('click','.common_input',function(){
$(this).popover('hide');
});
</script>
</body>
</html>

@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex,nofollow" />
<title>China Reisen und China Rundreisen individuell | Chinarundreisen.com</title>
<link href="https://data.chinarundreisen.com/information-view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="https://data.chinarundreisen.com/information-view/information/css/order.css" rel="stylesheet" type="text/css"/>
<!--[if lt IE 9]>
<script src="https://data.chinarundreisen.com/information-view/bootstrap/js/respond.min.js" type="text/javascript"></script>
<![endif]-->
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery.min.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/bootstrap/js/bootstrap.js" type="text/javascript"></script>
</head>
<body class="modal-open">
<div id="headerWrapper">
<div id="header">
<div id="mainnav" class="nav navbar" role="navigation">
<div class="container-fluid">
<div class="row">
<div class="col-lg-3 col-sm-4 logobox hidden-xs">
<a href="/">
<img width="135" src="http://data.chinarundreisen.com/public/pic/common/widget/header/pic/logo1_3d64397.jpg" alt="logo">
</a>
</div>
<div class="col-lg-16 col-sm-13 col-lg-offset-3 col-sm-offset-4">
<div class="navbar-header">
<div class="col-xs-24 btn-lg"></div>
</div>
</div>
<div class="col-lg-5 col-sm-7 hidden-xs pull-right nopadding">
<div class="tollfree pull-right">
<div class="col-xs-24 btn-sm"></div>
<div class="currentNo col-sm-24 nopadding"><span class="glyphicon glyphicon-earphone" style="font-size:12px;"></span> 800-2682918 (USA/CA)</div>
<div class="col-sm-24">
<div class="currentNo col-sm-24 nopadding"> 1800-764678 (AU)</div>
<div class="currentNo col-sm-24 nopadding"> 0800-0327753 (UK)</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="bs-example bs-example-modal" data-example-id="static-modal">
<div class="modal" style="display:block;">
<div class="modal-dialog" style="margin-top:200px;">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title text-success" id="modal-title">Erfolg!<a class="anchorjs-link" href="#modal-title"><span class="anchorjs-icon"></span></a></h3>
</div>
<div class="modal-body" style="height:150px;">
<h4 style="padding-top:10px;">Für jeglichen Grund kontaktieren Sie bitte Ihren Reiseführer.</h4>
<p>----<a href="http://www.chinarundreisen.com" class="">www.chinarundreisen.com</a></p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<div class="modal-backdrop fade in" style="bottom:0;"></div>
</body>
</html>

@ -25,20 +25,19 @@
<h3>Contact Information</h3>
<p style="margin:0;">Land line:<?php if (isset($postdata['landline'])) echo $postdata['landline']; ?></p>
<p style="margin:0;">Mobile:<?php if (isset($postdata['mobile'])) echo $postdata['mobile']; ?></p>
<p style="margin:0;">Home Address:<?php if (isset($MEI_Street)) echo $MEI_Street; ?></p>
<h4 class="text-red" style="box-sizing:border-box;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-weight:500;line-height:1.1;color:#AA2E2D;margin-top:10px;margin-bottom:15px;font-size:24px;padding:12px 0 12px 0;border-bottom:1px solid #dddddd;border-top:1px solid #dddddd;white-space:normal;background-color:#FFFFFF;">
Flight Information
</h4>
<p style="margin:0;">Arrival China Flight No.:<?php if (isset($postdata['arrive_flight'])) echo $postdata['arrive_flight']; ?></p>
<p style="margin:0;">Arrival China Flight No.:<?php if (isset($postdata['MEI_ArrivalFlightNo'])) echo $postdata['MEI_ArrivalFlightNo']; ?></p>
<p style="margin:0;">
Arrival time:<?php if (isset($postdata['arrive_time'])) echo $postdata['arrive_time']; ?>
Arrival time:<?php if (isset($postdata['MEI_ArrivalTime'])) echo $postdata['MEI_ArrivalTime']; ?>
</p>
<p style="margin:0;">
Departure China Flight no.:<?php if (isset($postdata['departure_flight'])) echo $postdata['departure_flight']; ?>
Departure China Flight no.:<?php if (isset($postdata['MEI_DepartureFlightNo'])) echo $postdata['MEI_DepartureFlightNo']; ?>
</p>
<p style="margin:0;">
Departure time:<?php if (isset($postdata['depart_time'])) echo $postdata['depart_time']; ?>
Departure time:<?php if (isset($postdata['MEI_DepartureTime'])) echo $postdata['MEI_DepartureTime']; ?>
</p>
<h4 class="text-red" style="box-sizing:border-box;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-weight:500;line-height:1.1;color:#AA2E2D;margin-top:10px;margin-bottom:15px;font-size:24px;padding:12px 0 12px 0;border-bottom:1px solid #dddddd;border-top:1px solid #dddddd;white-space:normal;background-color:#FFFFFF;">
Special Request

@ -21,7 +21,7 @@ class PageSpeedData_model extends CI_Model {
public function detail($psd_URL, $psd_SiteCode) {
$this->init();
$this->topnum = 1;
$this->where = ' AND psd.psd_URL=' . $this->INFO->escape($psd_URL);
$this->where = ' AND psd.psd_URL=N' . $this->INFO->escape($psd_URL);
$this->where .= ' AND psd.psd_SiteCode=' . $this->INFO->escape($psd_SiteCode);
return $this->get_list();
}
@ -64,7 +64,7 @@ class PageSpeedData_model extends CI_Model {
$this->topnum = $topnum;
$this->where = ' AND psd.psd_SiteCode=' . $this->INFO->escape($psd_SiteCode);
$this->where .= ' AND ISNULL(psd.psd_Datetime,1999) < GETDATE()-1 ';
$this->where .= ' AND psd.psd_ErrorCount<=3 ';
$this->where .= ' AND psd.psd_ErrorCount<=3';
$this->orderby = ' ORDER BY psd_Datetime ASC ';
return $this->get_list();
}
@ -127,7 +127,7 @@ class PageSpeedData_model extends CI_Model {
public function search_score_list($start_score, $end_score, $psd_SiteCode, $device = 'moblie') {
$this->init();
$this->topnum = 50;
$this->topnum = 150;
$this->where = ' AND psd.psd_SiteCode=' . $this->INFO->escape($psd_SiteCode);
if ($device == 'moblie') {
$this->where .= " AND psd.psd_MobileScore BETWEEN $start_score AND $end_score ";

@ -0,0 +1,20 @@
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
//行程地图
class Index extends CI_Controller
{
public function __construct() {
parent::__construct();
}
public function index()
{
$this->load->view('welcome');
}
}

@ -0,0 +1,383 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>Tour Map</title>
<script type="text/javascript" src="https://data.chinahighlights.com/js/min.php?f=/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src='https://webapi.amap.com/maps?v=1.4.10&key=b91a08b248b7db3e15a28eb3926650de'></script>
<script src="https://webapi.amap.com/ui/1.0/main.js"></script>
<style>
html,
body,
#container {
width: 100%;
height: 100%;
margin: 0px;
}
.amap-marker-label{
border: 0;
background-color: transparent;
}
.markerInfo {
background: rgba(255, 255, 255, 0.7);
padding: 2px 5px;
border: 1px solid #ccc;
white-space: nowrap;
}
</style>
</head>
<body>
<!--
根据行程生成地图,数据格式:
起点名称,起点坐标,终点名称,终点坐标,交通工具,交通工具备注(如航班号,车次等)
data['start']='Beijing';//出发地
data['start_lng']='116.41667';//经度
data['start_lat']='39.91667';//纬度
data['end']='Xian';
data['end_lng']='108.95000';//经度
data['end_lat']='34.26667';//纬度
data['traffic']='2';//交通类型 2火车 3飞机 4游船 5小车
data['memo']='G87';//备注,显示航班号,里程等等
-->
<?php
$tour = array();
$tour[] = array('start' => 'Beijing', 'start_lng' => '116.41667', 'start_lat' => '39.91667', 'end' => 'urumqi', 'end_lng' => '87.61792', 'end_lat' => '43.793308', 'traffic' => '2', 'memo' => 'G87');
$tour[] = array('start' => 'Beijing', 'start_lng' => '116.41667', 'start_lat' => '39.91667', 'end' => 'Xian', 'end_lng' => '108.95000', 'end_lat' => '34.26667', 'traffic' => '2', 'memo' => 'G87');
$tour[] = array('start' => 'Xian', 'start_lng' => '108.95000', 'start_lat' => '34.26667', 'end' => 'Guilin', 'end_lng' => '110.290247', 'end_lat' => '25.273915', 'traffic' => '3', 'memo' => 'CA1225');
$tour[] = array('start' => 'Guilin', 'start_lng' => '110.290247', 'start_lat' => '25.273915', 'end' => 'Longsheng', 'end_lng' => '110.648739', 'end_lat' => '24.828426', 'traffic' => '5', 'memo' => '');
$tour[] = array('start' => 'Longsheng', 'start_lng' => '110.648739', 'start_lat' => '24.828426', 'end' => 'Guilin', 'end_lng' => '110.290247', 'end_lat' => '25.273915', 'traffic' => '5', 'memo' => '');
$tour[] = array('start' => 'Guilin', 'start_lng' => '110.290247', 'start_lat' => '25.273915', 'end' => 'Yangshuo', 'end_lng' => '110.496593', 'end_lat' => '24.778481', 'traffic' => '5', 'memo' => '');
$tour[] = array('start' => 'Yangshuo', 'start_lng' => '110.496593', 'start_lat' => '24.778481', 'end' => 'Guilin', 'end_lng' => '110.290247', 'end_lat' => '25.273915', 'traffic' => '5', 'memo' => '');
$tour[] = array('start' => 'Guilin', 'start_lng' => '110.290247', 'start_lat' => '25.273915', 'end' => 'Shanghai', 'end_lng' => '121.473658', 'end_lat' => '31.230378', 'traffic' => '3', 'memo' => 'FM9350');
$map_data = $this->input->get('map_data');
//echo $map_data;
$debug = $this->input->get('debug');
if (!empty($debug)) {
print_r(base64_decode($map_data));
}
?>
<div id="container"></div>
<script type="text/javascript">
var tour_data = '<?php echo base64_decode($map_data); ?>';
$(function () {
//创建地图
var map = new AMap.Map('container', {
zoom: 5,
center: [116.397428, 39.90923],
lang: "en",
mapStyle: "amap://styles/whitesmoke"
});
AMapUI.loadUI(['overlay/AwesomeMarker'],
function (AwesomeMarker) {
//icon的取值请见 http://fontawesome.io/icons/
var awIcons = [
'arrow-left',
'arrow-right',
'bookmark',
'city'
];
var cityIcon = new AMap.Icon({
size: new AMap.Size(12, 12)
});
//标记出目的地
$.each(JSON.parse(tour_data), function (index, element) {
awesomeIcon = awIcons[2]; //经过的城市图标
awesomeIcon_start = false; //入境城市
awesomeIcon_end = false; //出境城市
if (index === 0) {
awesomeIcon_start = awIcons[0];
var marker_start = new AwesomeMarker({
awesomeIcon: awesomeIcon_start,
iconStyle: 'orange',
map: map,
position: [element.start_lng, element.start_lat],
title: element.start,
label: {content: element.start, offset: new AMap.Pixel(30, 8)}
});
}
if (index === JSON.parse(tour_data).length - 1) {
awesomeIcon_end = awIcons[1];
var marker_end = new AwesomeMarker({
awesomeIcon: awesomeIcon_end,
iconStyle: 'orange',
map: map,
position: [element.end_lng, element.end_lat],
title: element.end,
label: {content: element.end, offset: new AMap.Pixel(30, 8)}
});
}
var marker_pass = new AMap.Marker({
position: [element.start_lng, element.start_lat],
offset: new AMap.Pixel(-3, -3),
icon: new AMap.Icon({
image: '/css/images/point.png',
siez: new AMap.Size(8, 8)
}),
title: element.start,
map: map,
label: {content: element.start, offset: new AMap.Pixel(8, -8)}
});
//画曲线
var path_data_control = vertical_line(element.start_lng, element.start_lat, element.end_lng, element.end_lat);
var pathdata = [
[element.start_lng, element.start_lat],
[element.start_lng, element.start_lat, path_data_control.lng, path_data_control.lat, element.end_lng, element.end_lat],
[element.end_lng, element.end_lat]
];
var bezierCurve = new AMap.BezierCurve({
path: pathdata, //设置线覆盖物路径
strokeColor: '#3366FF', // 线颜色
strokeOpacity: 1, // 线透明度
strokeWeight: 5, // 线宽
strokeStyle: 'solid', // 线样式
strokeDasharray: [10, 5], // 补充线样式
showDir: true
});
bezierCurve.setMap(map);
//绘制交通图标
//2火车 3飞机 4游船 5小车
switch (element.traffic) {
case '2':
tour_traffic = '/css/images/train.png';
break;
case '3':
tour_traffic = '/css/images/plane.png';
break;
case '4':
tour_traffic = '/css/images/ship.png';
break;
case '5':
tour_traffic = '/css/images/car.png';
break;
default:
tour_traffic = '/css/images/car.png';
}
var $markerContent ='';
if (element.memo !== '') {
$markerContent = '<div class="markerInfo">'+element.memo+'</div>';
}
bezierCurveCenter=vertical_line(element.start_lng, element.start_lat, element.end_lng, element.end_lat,0.3);
new AMap.Marker({
position: [bezierCurveCenter.lng, bezierCurveCenter.lat],
offset: new AMap.Pixel(-3, -3),
icon: new AMap.Icon({
image: tour_traffic,
siez: new AMap.Size(8, 8)
}),
title: bezierCurveCenter.lng + ',' + bezierCurveCenter.lat,
label: {content: $markerContent, offset: new AMap.Pixel(20, -10)},
map: map
});
});
});
/*
//画轨迹
AMapUI.load(['ui/misc/PathSimplifier', 'lib/$'], function(PathSimplifier, $) {
if (!PathSimplifier.supportCanvas) {
alert('当前环境不支持 Canvas');
return;
}
var pathSimplifierIns = new PathSimplifier({
zIndex: 100,
//autoSetFitView:true,//自动调整地图视野以适合全部轨迹
map: map, //所属的地图实例
getPath: function(pathData, pathIndex) {
return pathData.path;
}
});
window.pathSimplifierIns = pathSimplifierIns;
var path_data=new Array();
$.each(JSON.parse(tour_data), function (index, element) {
path_data.push({'name':index,'path':PathSimplifier.getGeodesicPath([element.start_lng, element.start_lat], [element.end_lng, element.end_lat], 30)});
});
//设置数据
pathSimplifierIns.setData(path_data);
$.each(JSON.parse(tour_data), function (index, element) {
//交通工具 plane car train ship
var tour_traffic='';
var tour_speed=500000;//巡航速度,单位千米/小时
var tour_memo=element.memo;
//2火车 3飞机 4游船 5小车
switch(element.traffic){
case '2':
tour_traffic='/css/images/train.png';
tour_traffic_width=32;
tour_traffic_height=32;
tour_speed=50000;
break;
case '3':
tour_traffic='/css/images/plane.png';
tour_traffic_width=32;
tour_traffic_height=32;
tour_speed=500000;
break;
case '4':
tour_traffic='/css/images/ship.png';
tour_traffic_width=22;
tour_traffic_height=80;
tour_speed=50000;
break;
case '5':
tour_traffic='/css/images/car.png';
tour_traffic_width=32;
tour_traffic_height=32;
tour_speed=5000;
break;
default:
tour_traffic='/css/images/car.png';
tour_traffic_width=32;
tour_traffic_height=32;
tour_speed=50000;
}
//创建一个巡航器
var navigator = pathSimplifierIns.createPathNavigator(index, {
loop: true, //循环播放
speed: tour_speed, //巡航速度,单位千米/小时
pathNavigatorStyle: {
width: tour_traffic_width,
height: tour_traffic_height,
//使用图片
content: PathSimplifier.Render.Canvas.getImageContent(tour_traffic, onload, onerror),
strokeStyle: null,
fillStyle: null,
//经过路径的样式
pathLinePassedStyle: {
lineWidth: 6,
//strokeStyle: 'black',
dirArrowStyle: {
stepSpace: 15,
strokeStyle: 'red'
}
}
}
});
//让导航器暂停,交通图标显示在中间节点
//console.log(navigator.range);
navigator.start(12);
navigator.pause();
//添加备注信息
if(tour_memo!==''){
var $markerContent = $('<div class="markerInfo"></div>');
$markerContent.html(tour_memo);
navigator.marker = new AMap.Marker({
offset: new AMap.Pixel(15, -10),
content: $markerContent.get(0),
map: map
});
navigator.marker.setPosition(navigator.getPosition());
}
});
});
*/
/*
//贝赛尔曲线经过的起点,途经点,控制点,终点的二维数组
var position_beijing= new AMap.LngLat(116.39, 39.9);
var position_xian= new AMap.LngLat(108.939621,34.343147);
var position_guilin= new AMap.LngLat(110.290247,25.273915);
var position_urumqi= new AMap.LngLat(87.61792, 43.793308);
var position_shanghai= new AMap.LngLat(121.473658,31.230378);
var position_start=position_beijing;
var position_end=position_xian;
var path_data_control=vertical_line(position_start.lng, position_start.lat,position_end.lng, position_end.lat);
var position_control=new AMap.LngLat(path_data_control.lng, path_data_control.lat);
console.log(position_control);
console.log(position_xian);
var pathdata = [
position_start,
[position_start.lng, position_start.lat,position_control.lng, position_control.lat,position_end.lng, position_end.lat],
position_end
] ;
var bezierCurve = new AMap.BezierCurve({
path:pathdata, //设置线覆盖物路径
strokeColor: '#3366FF', // 线颜色
strokeOpacity: 1, // 线透明度
strokeWeight: 2, // 线宽
strokeStyle: 'solid', // 线样式
strokeDasharray: [10, 5], // 补充线样式
showDir:true
});
bezierCurve.setMap(map);
});
*/
//vertical_line(116.39, 39.9,87.61792, 43.793308);
});
//根据两点坐标求过中点的垂线
//Threshold 阈值,用来调整曲线开口大小
function vertical_line(Ax, Ay, Bx, By,Threshold) {
Ax = parseFloat(Ax);
Ay = parseFloat(Ay);
Bx = parseFloat(Bx);
By = parseFloat(By);
Threshold = typeof Threshold !== 'undefined' ? Threshold : 0.6;
var x, y;
var Mx = (Ax + Bx) / 2;
var My = (Ay + By) / 2;
//console.log(Mx + ',' + My);
//根据终点纬度高低来确定曲线开口方向
if (Ay >= By) {
x = Mx - Threshold;
} else {
x = Mx + Threshold;
}
y = My - (Bx - Ax) * (x - Mx) / (By - Ay);
//console.log(y);
return {'lng': x, 'lat': y};
y = My - 0.5;
x = Mx - (y - My) * (By - Ay) / (Bx - Ax);
//console.log(x);
}
</script>
</body>
</html>

@ -5,8 +5,15 @@ if (!defined('BASEPATH'))
class search extends CI_Controller{
public function __construct(){
parent::__construct();
parent::__construct();
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST, GET');
header('Access-Control-Max-Age:0');
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
header('Access-Control-Allow-Credentials:true');
$this->start_time = microtime(true);
$this->load->model("BIZ_train_model");//加载模型
$this->load->model("BIZ_intel_train_model");//国际火车模型
}
//查询聚合余票接口,对返回的数据进行处理
@ -28,17 +35,26 @@ class search extends CI_Controller{
exit('toStation:参数错误!');
}
$api_start_time = microtime(true);
//调用查询模块
$search_return = $this->Searchtrain($train_date,$fromStation,$toStation);
$api_end_time = microtime(true);
//调用数据处理模块
$returnJson = $this->dataOperate($search_return,$fromStation,$toStation);
//调用拼接处理模块
$trainjson = $this->createTrainJson($returnJson);
$end_time = microtime(true);
//聚合接口相应时间
$api_responsive_time = $api_end_time - $api_start_time;
//我们的接口相应时间
$responsive_time = $end_time - $this->start_time;
log_message('error','TRAINSPEED|请求url:'.$this->url.'|聚合相应时间:'.$api_responsive_time.'s|接口运行时间:'.$responsive_time.'s|缓存:'.$this->cache.'|+7天:'.$this->seveth);
print_r($trainjson);
}
}
@ -46,40 +62,49 @@ class search extends CI_Controller{
function Searchtrain($train_date,$fromStation,$toStation){
$this->train_date = $train_date;
$now_time = time();
$differ_time = (strtotime($train_date) - $now_time) / 86400;
$this->differ_time = (strtotime($train_date) - $now_time) / 86400;
$this->seveth = 'no';
//屏蔽掉超过预售期的搜索,提高速度
if($differ_time > 29){
if($this->differ_time > 29){
$train_date = date('Y-m-d',strtotime('+7day'));
$this->seveth = 'yes';
}
$url = 'http://139.129.246.118:12309/trainTickets/ticketsAvailable?key='.JUHE_TRAIN_API_KEY.'&train_date='.$train_date.'&from_station='.$fromStation.'&to_station='.$toStation;
$this->url = $url;
$train_info = $this->get_http($url);
//如果为网络错误就再执行一次
if(json_decode($train_info)->reason == '网络故障请重试0'){
$train_info = $this->get_http($url);
}
$this->url = JUHE_TRAIN_CX_API.'?key='.JUHE_TRAIN_API_KEY.'&train_date='.$train_date.'&from_station='.$fromStation.'&to_station='.$toStation;
$train_info = $this->get_http($this->url);
return $train_info;
}
//缓存处理模块(包含缓存处理)
function dataOperate($search_return,$fromStation,$toStation){
$this->reason = json_decode($search_return)->reason;
$this->cache = 'no';
if(!empty($search_return) && !empty(json_decode($search_return)->result)){
//首先判断聚合返回的数据是否为空
if(empty($search_return)){
$this->reason = '聚合接口没有响应';
$this->cache = 'yes';
}else{
$this->reason = json_decode($search_return)->reason;
$this->cache = 'no';
}
if(!empty(json_decode($search_return)->result)){
$this->BIZ_train_model->addOrUpdate($fromStation,$toStation,$search_return);
$operate_data = $search_return;
}else{
$cache_train_info = $this->BIZ_train_model->get_train_info($fromStation,$toStation);
//添加缓存调用时间判断
if($this->differ_time <= 5){
$cache_train_info = NULL;
}else{
$cache_train_info = $this->BIZ_train_model->get_train_cache($fromStation,$toStation);
}
//判断缓存是否为空
if(empty($cache_train_info)){
log_message('error','TRAIN 查询为空的链接:'.$this->url.'|出错的原因:'.$this->reason.'|缓存为空');
$operate_data = NULL;
}else{
$cache_time = $cache_train_info->tpc_datetime;
$now_time = time();
$differ_time = ($now_time - strtotime($cache_time)) / 86400;
if($differ_time >= 3){
$cache_differ_time = ($now_time - strtotime($cache_time)) / 86400;
if($cache_differ_time >= 3){
$this->BIZ_train_model->delete_traincache($fromStation,$toStation);
log_message('error','TRAIN 查询为空的链接:'.$this->url.'|出错的原因:'.$this->reason.'|缓存超时,已经删除');
$operate_data = NULL;
@ -92,7 +117,6 @@ class search extends CI_Controller{
}
return $operate_data;
}
//字符串拼接模块
function createTrainJson($returnjson){
$return_data = new stdClass();
@ -181,7 +205,8 @@ class search extends CI_Controller{
}
$pricestr = $seat_type.'"train_no":'.'"'.$value->train_no.'"';
//余票字符串
$return_data->data->result[$i] = '|预定|'.$value->train_no.'|'.$value->train_code.'|'.$value->from_station_name.'|'.$value->to_station_name.'|'.$value->from_station_code.'|'.$value->to_station_code.'|'.$value->start_time.'|'.$value->arrive_time.'|'.$value->run_time.'|'.$value->can_buy_now.'||'.$value->train_start_date.'||||||||'.$this->ticket_exchange($value->gjrw_num).'|'.$this->ticket_exchange($value->qtxb_num).'|'.$this->ticket_exchange($value->rw_num).'|'.$this->ticket_exchange($value->rz_num).'|'.$this->ticket_exchange($value->tdz_num).'|'.$this->ticket_exchange($value->wz_num).'||'.$this->ticket_exchange($value->yw_num).'|'.$this->ticket_exchange($value->yz_num).'|'.$this->ticket_exchange($value->edz_num).'|'.$this->ticket_exchange($value->ydz_num).'|'.$this->ticket_exchange($value->swz_num).'|'.$this->ticket_exchange($value->dw_num).'||';
$this->can_buy_now = $value->can_buy_now;
$return_data->data->result[$i] = '|预定|'.$value->train_no.'|'.$value->train_code.'|'.$value->from_station_name.'|'.$value->to_station_name.'|'.$value->from_station_code.'|'.$value->to_station_code.'|'.$value->start_time.'|'.$value->arrive_time.'|'.$value->run_time.'|'.$value->can_buy_now.'||'.$this->train_date.'||||||||'.$this->ticket_exchange($value->gjrw_price,$value->gjrw_num).'|'.$this->ticket_exchange($value->qtxb_price,$value->qtxb_num).'|'.$this->ticket_exchange($value->rw_price,$value->rw_num).'|'.$this->ticket_exchange($value->rz_price,$value->rz_num).'|'.$this->ticket_exchange($value->tdz_price,$value->tdz_num).'|'.$this->ticket_exchange($value->wz_price,$value->wz_num).'||'.$this->ticket_exchange($value->yw_price,$value->yw_num).'|'.$this->ticket_exchange($value->yz_price,$value->yz_num).'|'.$this->ticket_exchange($value->edz_price,$value->edz_num).'|'.$this->ticket_exchange($value->ydz_price,$value->ydz_num).'|'.$this->ticket_exchange($value->swz_price,$value->swz_num).'|'.$this->ticket_exchange($value->dw_price,$value->dw_num).'||';
$data = '{"validateMessagesShowId":"_validatorMessage","status":true,"httpstatus":200,"data":{'.$pricestr.'},"messages":[],"validateMessages":{}}';
$return_data->data->price[$i] = $data;
$i++;
@ -193,7 +218,204 @@ class search extends CI_Controller{
return json_encode($return_data);
}
//国际火车获取
public function search_international_train(){
$trainFrom = $this->input->get_post('trainFrom');
$trainTo = $this->input->get_post('trainTo');
$trainDate = $this->input->get_post('trainDate');
if(empty($trainFrom) || empty($trainTo)){
header("HTTP/1.1 404 Not Found");
exit('{"status":"201","reason":"车站查询失败","data":""}');
}
//根据传过来的城市名称获取城市代码
$trainFromCode = $this->BIZ_intel_train_model->get_code_by_name($trainFrom);
$trainToCode = $this->BIZ_intel_train_model->get_code_by_name($trainTo);
if(empty($trainFromCode) || empty($trainToCode)){
header("HTTP/1.1 404 Not Found");
exit('{"status":"202","reason":"站点名转换失败","data":""}');
}
//获取车次信息
$obj = $this->BIZ_intel_train_model->get_train_info($trainFromCode->s_code,$trainToCode->s_code);
//如果结果为空则直接返回为空的结果
if(empty($obj)){
header("HTTP/1.1 404 Not Found");
exit('{"status":"203","reason":"无车次信息!","data":""}');
}
//处理返回的字符串
$return_json = new StdClass();
$return_json->status = '200';
$return_json->reason = '成功的返回';
$return_json->rate = $this->GetCurrencyRate();
$return_json->mainland_deliver = 9;
$return_json->others_deliver = 12;
$return_json->data = array();
$return_json->endata = array();
//如果有结果则进行字符串处理
foreach($obj as $key=>$item){
//发车规则处理
$item->trainrule = array();
$item->trainrule['include'] = array();
$item->trainrule['exclusive'] = array();
foreach(json_decode($item->DateRule)->DateRule as $key_rule=>$rules){
if(!empty($rules)){
if($key_rule == 'include'){
$item->trainrule['include'] = $rules;
}else if($key_rule == 'exclusive'){
$item->trainrule['exclusive'] = $rules;
}
}
}
//价格处理
$item->adult_seat = array();
$item->child_seat = array();
$price_arr = json_decode($item->seatPriceInfo2);
$audlt = $price_arr->price;
$child = $price_arr->cprice;
if(!empty($audlt)){
$i=0;
foreach($audlt as $key_adult=>$value){
$seat_name = $this->BIZ_intel_train_model->get_seatname($key_adult)->Seat_EName1;
$item->adult_seat[$i]['name'] = $seat_name;
$item->adult_seat[$i]['code'] = $key_adult;
$item->adult_seat[$i]['price'] = $value;
$item->adult_seat[$i]['pic'] = $this->BIZ_intel_train_model->get_seatname($key_adult)->Seat_Pic;
$i++;
}
}
if(!empty($child)){
$j=0;
foreach($child as $key_child=>$value){
$seat_name = $this->BIZ_intel_train_model->get_seatname($key_child)->Seat_EName1;
$item->child_seat[$j]['name'] = $seat_name;
$item->child_seat[$j]['code'] = $key_child;
$item->child_seat[$j]['price'] = $value;
$j++;
}
}
//最后进行当前日期判断,对数据进行分组
$flag = $this->checkDateRule($trainDate,$item->DateRule);
if(!$flag){
//将不符合发车日期的列车放入到另外一个数组中存储起来
array_push($return_json->endata,$obj[$key]);
}else{
array_push($return_json->data,$obj[$key]);
}
}
print_r(json_encode($return_json));
}
//获取某一条列车的信息
public function search_one_train($train_no){
$obj = $this->BIZ_intel_train_model->get_one_train($train_no);
$seat_code = json_decode($obj->seatPriceInfo2)->price;
$obj->seat_info = new stdClass();
foreach ($seat_code as $key=>$code){
$seat_info = $this->BIZ_intel_train_model->get_seat_info($key);
$obj->seat_info->$key = $seat_info;
}
$obj->arriveTime = $obj->localarriveTime;
print_r(json_encode($obj));
}
//查询某一趟列车的途径站
public function search_train_station($train_no){
if(!$train_no){
header("HTTP/1.1 404 Not Found");
exit('{"status":"404","reason":"列车编号为空"}');
}
$arr = $this->BIZ_intel_train_model->get_train_station($train_no);
if(!empty($arr)){
echo json_encode($arr);
}else{
header("HTTP/1.1 404 Not Found");
exit('{"status":"404","reason":"途径站为空"}');
}
}
//获取所有的列车信息
public function get_all_inteltrain(){
$obj = $this->BIZ_intel_train_model->get_allinteltrain();
print_r(json_encode($obj));
}
//获取国际火车出发规则
public function get_station_rules(){
//获取所有站点的列表
$return_json = array();
$return_json['TrainList'] = array();
$all_stations = $this->BIZ_intel_train_model->get_allstations();
$i = 0;
foreach($all_stations as $item){
$rule_arr = $this->BIZ_intel_train_model->get_train_rules($item->station_id);
if(!empty($rule_arr)){
$return_json['TrainList'][$i]['FromStation'] = $item->s_ename;
$return_json['TrainList'][$i]['FromCountry'] = $item->s_country;
$return_json['TrainList'][$i]['ToStations'] = array();
$j = 0;
foreach($rule_arr as $rule_info){
$return_json['TrainList'][$i]['ToStations'][$j]['Message'] = $rule_info->tsi_Message;
$return_json['TrainList'][$i]['ToStations'][$j]['Station'] = $rule_info->S_ename;
$return_json['TrainList'][$i]['ToStations'][$j]['StationCountry'] = $rule_info->s_country;
$j++;
}
$i++;
}
}
//print_r($return_json);
header('Content-type: application/json');
print_r(json_encode($return_json));
}
//获取国际火车出发规则
public function ch_station_rules(){
//获取所有站点的列表
$return_json = array();
$return_json['TrainList'] = array();
$all_stations = $this->BIZ_intel_train_model->ch_allstations();
$i = 0;
foreach($all_stations as $item){
if($item->s_country == 'Vietnam'){
$rule_arr = $this->BIZ_intel_train_model->ch_train_rules($item->station_id,true);
}else{
$rule_arr = $this->BIZ_intel_train_model->ch_train_rules($item->station_id,false);
}
if(!empty($rule_arr)){
$return_json['TrainList'][$i]['FromStation'] = $item->s_ename;
$return_json['TrainList'][$i]['FromCountry'] = $item->s_country;
$return_json['TrainList'][$i]['ToStations'] = array();
$j = 0;
foreach($rule_arr as $rule_info){
$return_json['TrainList'][$i]['ToStations'][$j]['Message'] = $rule_info->tsi_Message;
$return_json['TrainList'][$i]['ToStations'][$j]['Station'] = $rule_info->S_ename;
$return_json['TrainList'][$i]['ToStations'][$j]['StationCountry'] = $rule_info->s_country;
$j++;
}
$i++;
}
}
//print_r($return_json);
header('Content-type: application/json');
print_r(json_encode($return_json));
}
//获取价格(废弃)
/*
fromStationCode出发站三字码
@ -214,13 +436,21 @@ class search extends CI_Controller{
}
//余票转换
function ticket_exchange($num){
function ticket_exchange($price,$num){
//echo $this->can_buy_now;
if($this->cache == 'yes' || $this->seveth == 'yes'){
return '有';
if(isset($price) && is_numeric($num)){
if($price > 0){
return '有';
}else{
return '';
}
}
return '';
}else{
if(is_numeric($num)){
if($num == 0){
return '无';
return '无';
}elseif($num >= 99){
return '有';
}else{
@ -234,13 +464,163 @@ class search extends CI_Controller{
}
}
function checkDateRule($strDate, $jsonDate){
if (!strtotime($strDate)) {
return false;
}
$strDate_t = strtotime($strDate);
$strDate = date("Y-m-d", $strDate_t);
$dYear = date("Y", $strDate_t);
$dMonth = date("m", $strDate_t);
$dDay = date("d", $strDate_t);
$dWeek = date("w", $strDate_t); //星期的第几天数组0-6
//单双日
if ($dDay % 2 == 0) {
$dSingle = 2;
} else {
$dSingle = 1;
}
$jObject = json_decode($jsonDate);
$result = false;
//先判断排除规则有一条符合就返回false
if (isset($jObject->DateRule->exclusive) ) {
$jObject_exclusive = $jObject->DateRule->exclusive;
foreach ($jObject_exclusive as $key => $val) {
if ($val->dateType=="EveryDay" ) { //每天,这个基本不会出现,设置每天排除和关闭没区别
return false;
} elseif ($val->dateType=="WeekDay" ) { //按星期
//先判断是否在日期范围内,再判断星期是否对应
$bw_CheckRange = false; //是否需要判断星期几
if ($val->dateRange == "*") { //每天
$bw_CheckRange = true;
} else {
$dateRange = explode("|", $val->dateRange); //日期范围
if (count($dateRange) == 2) {
if ($strDate_t >= strtotime($dateRange[0]) and $strDate_t <= strtotime($dateRange[1])) {
$bw_CheckRange = true; //在范围内
}
}
}
if ($bw_CheckRange) {
if ($dWeek==0) {
$dWeek=7; //星期0为星期天我们保存的星期天是7
}
$weekArr = explode(",", $val->dateData); //星期数据1,2,3,4,5,6,7这种
foreach ($weekArr as $week) {
if ($week == $dWeek) {
return false;
}
}
}
} elseif ($val->dateType == "SelectDay") { //固定日期
if ($val->dateRange=="*") {
$SelectDayArr = explode(",", $val->dateData);
foreach ($SelectDayArr as $sDay) {
if (strtotime($sDay) == $strDate_t) {
return false;
}
}
}
} elseif ($val->dateType == "RangeDay") { //连续日期
if ($val->dateRange == "*") {
$RangeDateArr = explode("|", $val->dateData);
if (count($RangeDateArr)==2) {
if ($strDate_t >= strtotime($RangeDateArr[0]) and $strDate_t <= strtotime($RangeDateArr[1])) {
return false ; //在范围内
}
}
}
}
}
}
//再判断包含规则有一条符合就为true
if (isset($jObject->DateRule->include)) {
$jObject_include = $jObject->DateRule->include;
foreach ($jObject_include as $key => $val) {
if ($val->dateType == "EveryDay") { //每天
return true;
} elseif ($val->dateType == "WeekDay") { //按星期
//先判断是否在日期范围内,再判断星期是否对应
$bw_CheckRange = false; //是否需要判断星期几
if ($val->dateRange == "*") { //每天
$bw_CheckRange = true;
} else {
$dateRange = explode("|", $val->dateRange); //日期范围
if (count($dateRange) == 2) {
if ($strDate_t >= strtotime($dateRange[0]) and $strDate_t <= strtotime($dateRange[1])) {
$bw_CheckRange = true; //在范围内
}
}
}
if ($bw_CheckRange) {
if ($dWeek == 0) {
$dWeek = 7; //星期0为星期天我们保存的星期天是7
}
$weekArr = explode(",", $val->dateData); //星期数据1,2,3,4,5,6,7这种
foreach ($weekArr as $week) {
if ($week == $dWeek) {
return true;
}
}
}
} elseif ($val->dateType=="MonthDay") { //每月单双
if ($val->dateRange=="*") {
$MonthDayArr = explode(",", rtrim($val->dateData, ',')); //月单双数据m3:2,m4:1
foreach ($MonthDayArr as $MonthKey) {
$MonthArr = explode(":", $MonthKey);
$Month = str_pad(str_replace("m", "", $MonthArr[0]), 2, "0", STR_PAD_LEFT); //存储的月份补0好比较
if ($dMonth == $Month) { //月份相同比较
if ($dSingle == $MonthArr[1]) {
return true;
}
}
}
}
} elseif ($val->dateType == "SelectDay") { //固定日期
if ($val->dateRange=="*") {
$SelectDayArr = explode(",", $val->dateData);
foreach ($SelectDayArr as $sDay) {
if (strtotime($sDay) == $strDate_t) {
return true;
}
}
}
} elseif ($val->dateType == "RangeDay") { //连续日期
if ($val->dateRange == "*") {
$RangeDateArr = explode("|", $val->dateData);
if (count($RangeDateArr)==2) {
if ($strDate_t >= strtotime($RangeDateArr[0]) and $strDate_t <= strtotime($RangeDateArr[1])) {
return true ; //在范围内
}
}
}
}
}
}
return $result;
}
//发送请求
function get_http($url, $data = '', $method = 'GET') {
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
//curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
if ($method == 'POST' && !empty($data)) {
@ -260,6 +640,33 @@ class search extends CI_Controller{
curl_close($curl); //关闭CURL会话
return $tmpInfo; //返回数据
}
function GetCurrencyRate() {
$this->HT = $this->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 . '<br/>';
// echo $this->EUR_Rate . '<br/>';
// echo $this->RUB_Rate . '<br/>';
return $this->USD_Rate;
}
}

@ -0,0 +1,176 @@
<?php
class BIZ_intel_train_model extends CI_Model {
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
//查询火车列表信息
public function get_train_info($trainFromCode,$trainToCode){
if($trainFromCode == 'CHBJ'){
$add = "OR tl.trainFromCode = 'CHPW'";
}else{
$add = "";
}
$sql = "
SELECT
tl.trainNo,
tl.trainFrom,
tl.trainFromCode,
(select s_country from TrainStation_intel where s_code = tl.trainFromCode) as from_country,
tl.trainTo,
tl.trainToCode,
(select s_country from TrainStation_intel where s_code = tl.trainToCode) as to_country,
tl.trainType,
tl.train_no,
tl.trainUse,
tl.RunTime,
tl.departTime,
(select top 1 trainArrive from trainlistDetail where train_no = tl.train_no order by trainOrder desc) as arriveTime,
tl.UseDay,
tl.DateRule,
tl.TrainMessage,
tp.seatPriceInfo2
FROM
trainlist tl
left join
trainPrice tp
on
tl.train_no = tp.train_no
WHERE
tl.isGlobal = 1
AND
(tl.trainFromCode = '{$trainFromCode}' {$add})
AND
tl.trainToCode = '{$trainToCode}'
AND
tl.DateRule != ''
AND
tp.seatPriceInfo2 IS NOT NULL
order by departTime asc
";
$query = $this->HT->query($sql);
return $query->result();
}
public function get_code_by_name($name){
$sql = "select s_code from TrainStation_intel where s_ename = '{$name}'";
$query = $this->HT->query($sql);
return $query->row();
}
public function get_seatname($seat_code){
$sql = "select Seat_EName1,Seat_Pic from TrainSeat_Intel where Seat_code = '{$seat_code}'";
$query = $this->HT->query($sql);
return $query->row();
}
//获取一列指定火车数据
public function get_one_train($train_no){
$sql = "
SELECT
*,
(select s_country from TrainStation_intel where trainFromCode = s_code ) as From_country,
(select s_country from TrainStation_intel where trainToCode = s_code ) as To_country,
(select top 1 trainArrive from trainlistDetail where train_no = tl.train_no order by trainOrder desc) as localarriveTime
FROM
trainlist tl
LEFT JOIN
trainPrice tp
ON
tl.train_no = tp.train_no
WHERE
tl.train_no = '{$train_no}'
AND
isGlobal = 1
";
$query = $this->HT->query($sql);
return $query->row();
}
public function get_allinteltrain(){
$sql = "
SELECT
*
FROM
TrainStation_intel
LEFT JOIN
trainlist
ON
s_code = trainFromCode
WHERE
trainFrom != 'NULL'
";
$query = $this->HT->query($sql);
return $query->result();
}
public function get_seat_info($seat_code){
$sql = "SELECT Seat_CName,Seat_EName1 FROM TrainSeat_Intel WHERE Seat_Code = '{$seat_code}'";
$query = $this->HT->query($sql);
return $query->row();
}
public function get_train_station($train_no){
$sql = "SELECT * FROM trainlistDetail WHERE train_no = '{$train_no}' order by trainOrder asc";
$query = $this->HT->query($sql);
return $query->result();
}
public function get_allstations(){
$sql = "SELECT * FROM TrainStation_intel";
$query = $this->HT->query($sql);
return $query->result();
}
public function ch_allstations(){
$sql = "SELECT * FROM TrainStation_intel where station_id != 10";
$query = $this->HT->query($sql);
return $query->result();
}
public function get_train_rules($station_id){
$sql = "SELECT
S_ename,s_country,tsi_Message
FROM
TrainSearch_intel
LEFT JOIN
TrainStation_intel
ON
tsi_ToStation = station_id
where
tsi_FromStation = '{$station_id}'";
$query = $this->HT->query($sql);
return $query->result();
}
public function ch_train_rules($station_id,$flag){
if($flag){
$and = "and s_country != 'Vietnam'";
}else{
$and = "";
}
if($station_id == 11){
$station = "or tsi_FromStation = 10";
}else{
$station = "";
}
$sql = "SELECT
S_ename,s_country,tsi_Message
FROM
TrainSearch_intel
LEFT JOIN
TrainStation_intel
ON
tsi_ToStation = station_id
where
tsi_FromStation = '{$station_id}'
";
$sql .= $and;
$sql .= $station;
$query = $this->HT->query($sql);
return $query->result();
}
}

@ -8,7 +8,7 @@ class BIZ_train_model extends CI_Model {
$this->INFO = $this->load->database('INFO', TRUE);
}
//新增或更新价格
//新增或更新缓存
public function addOrUpdate($tpc_from_station,$tpc_to_station,$tpc_content){
$sql = "IF NOT EXISTS(
SELECT 1
@ -49,7 +49,7 @@ class BIZ_train_model extends CI_Model {
//获取缓存的火车信息
//如果读取到缓存是7天以前的数据就不返回任何数据并且将其删除。
public function get_train_info($tpc_from_station,$tpc_to_station){
public function get_train_cache($tpc_from_station,$tpc_to_station){
$sql = "SELECT
*
FROM

@ -40,108 +40,185 @@ class Tuniu_train extends CI_Controller{
if(!$date || !$fromStation || !$toStation){
exit('传参错误!');
}else{
//做超过预售期的处理查询
$isCache = false;
$iseven = false;
$cachedata = false;
$now_time = time();
$differ = (strtotime($date) - $now_time) / 86400;
if($differ > 29){
$date = date('Y-m-d',strtotime('+7day'));
$iseven = true;
}
//途牛报文拼接
$sign = $this->create_sign();
$url = TUNIU_URL.'/train/search';
$time = date('Y-m-d H:i:s',time());
$post_data = '{
"apiKey": "'.TUNIU_KEY.'",
"sign": "'.$sign.'",
"timestamp": "'.$time.'",
"data": { "trainDate": "'.$date.'", "fromStation": "'.$fromStation.'", "toStation": "'.$toStation.'", "trainCode": "" }
}';
$back_data = post_tuniu($url,$post_data,$method = 'POST');
if(empty(json_decode($back_data)->data)){
log_message('error','tuniu:'.json_encode($post_data));
}
//print_r(json_decode($back_data)->data);
$return_data = new stdClass();
$return_data->returnCode = json_decode($back_data)->returnCode;
//echo $return_data->returnCode;
$return_data->httpstatus = 200;
$return_data->data = new stdClass();
$return_data->data->result = array();
$return_data->data->map = new stdClass();
$obj = array();
$i = 0;
$pricestr = '';
if(!empty(json_decode($back_data)->data)){
foreach (json_decode($back_data)->data as $value){
$obj[$value->fromStationCode] = $value->fromStationName;
$obj[$value->toStationCode] = $value->toStationName;
$seat_type = '';
if(isset($value->gjrwPrice)){
if(is_numeric($value->gjrwPrice)){
$gjrwPrice = $value->gjrwPrice * 10;
$seat_type .= '"6":"'.$gjrwPrice.'","A6":"¥'.$value->gjrwPrice.'",';
}
$url = TUNIU_URL.'/train/search';
$time = date('Y-m-d H:i:s',time());
$post_data = '{
"apiKey": "'.TUNIU_KEY.'",
"sign": "'.$sign.'",
"timestamp": "'.$time.'",
"data": { "trainDate": "'.$date.'", "fromStation": "'.$fromStation.'", "toStation": "'.$toStation.'", "trainCode": "" }
}';
//设置请求接口时间
$api_start_time = microtime(true);
$back_data = post_tuniu($url,$post_data,$method = 'POST');
//$back_data = null;
//接口结束时间
$api_end_time = microtime(true);
//计算响应时间
$api_responsive_time = $api_end_time - $api_start_time;
if(!empty($back_data)){
$tn_info = json_decode($back_data);
$retrun_code = $tn_info->returnCode;
$return_msg = $tn_info->errorMsg;
}else{
$retrun_code = '404';
$return_msg = '途牛接口未响应';
}
if(isset($tn_info->data)){
if(empty(json_decode($back_data)->data)){
$isCache = true;
}else{
$this->tuniuprice_model->addOrUpdate($fromStation,$toStation,$back_data);
}
if(isset($value->qtxbPrice)){
if(is_numeric($value->qtxbPrice)){
$seat_type .= '"H":"¥'.$value->qtxbPrice.'",';
}else{
$isCache = true;
}
if($isCache){
if($differ <= 5){
$back_data = null;
}else{
$trainCache = $this->tuniuprice_model->get_train_cache($fromStation,$toStation);
if(!empty($trainCache)){
$back_data = $trainCache->tpc_content;
$cachedata = true;
}else{
$back_data = null;
$cachedata = false;
}
}
if(isset($value->rwPrice)){
if(is_numeric($value->rwPrice)){
$rwPrice = $value->rwPrice * 10;
$seat_type .= '"4":"'.$rwPrice.'","A4":"¥'.$value->rwPrice.'",';
}
}
if($cachedata){
$cacheuse = '使用缓存';
}else{
$cacheuse = '缓存为空';
}
//记录数据格式 |出发站|到达站|发车时间|接口响应时间|接口返回代码|接口返回信息|是否调用缓存
log_message('error','tuniutrain|'.$fromStation.'|'.$toStation.'|'.$date.'|'.$api_responsive_time.'|'.$retrun_code.'|'.$return_msg.'|'.$cacheuse);
//途牛数据格式转换
$return_data = new stdClass();
$return_data->httpstatus = 200;
$return_data->data = new stdClass();
$return_data->data->seven = $iseven;
$return_data->data->cache = $isCache;
$return_data->data->result = array();
$return_data->data->map = new stdClass();
$obj = array();
$i = 0;
$pricestr = '';
if(!empty(json_decode($back_data)->data)){
foreach (json_decode($back_data)->data as $value){
$obj[$value->fromStationCode] = $value->fromStationName;
$obj[$value->toStationCode] = $value->toStationName;
$seat_type = '';
if(isset($value->gjrwXiaPrice)){
if(is_numeric($value->gjrwXiaPrice)){
$gjrwXiaPrice = $value->gjrwXiaPrice * 10;
$seat_type .= '"6":"'.$gjrwXiaPrice.'","A6":"¥'.$value->gjrwXiaPrice.'",';
}
}
}
if(isset($value->rzPrice)){
if(is_numeric($value->rzPrice)){
$rzPrice = $value->rzPrice * 10;
$seat_type .= '"2":"'.$rzPrice.'","A2":"¥'.$value->rzPrice.'",';
if(isset($value->qtxbPrice)){
if(is_numeric($value->qtxbPrice)){
$seat_type .= '"H":"¥'.$value->qtxbPrice.'",';
}
}
}
if(isset($value->tdzPrice)){
if(is_numeric($value->tdzPrice)){
$seat_type .= '"P":"¥'.$value->tdzPrice.'",';
if(isset($value->rwPrice)){
if(is_numeric($value->rwPrice)){
$rwPrice = $value->rwPrice * 10;
$seat_type .= '"4":"'.$rwPrice.'","A4":"¥'.$value->rwPrice.'",';
}
}
}
if(isset($value->wzPrice)){
if(is_numeric($value->wzPrice)){
$wzPrice = $value->wzPrice * 10;
$seat_type .= '"WZ":"¥'.$value->wzPrice.'",';
if(isset($value->rzPrice)){
if(is_numeric($value->rzPrice)){
$rzPrice = $value->rzPrice * 10;
$seat_type .= '"2":"'.$rzPrice.'","A2":"¥'.$value->rzPrice.'",';
}
}
}
if(isset($value->ywPrice)){
if(is_numeric($value->ywPrice)){
$ywPrice = $value->ywPrice * 10;
$seat_type .= '"3":"'.$ywPrice.'","A3":"¥'.$value->ywPrice.'",';
if(isset($value->tdzPrice)){
if(is_numeric($value->tdzPrice)){
$seat_type .= '"P":"¥'.$value->tdzPrice.'",';
}
}
}
if(isset($value->yzPrice)){
if(is_numeric($value->yzPrice)){
$yzPrice = $value->yzPrice * 10;
$seat_type .= '"1":"'.$yzPrice.'","A1":"¥'.$value->yzPrice.'",';
if(isset($value->wzPrice)){
if(is_numeric($value->wzPrice)){
$wzPrice = $value->wzPrice * 10;
$seat_type .= '"WZ":"¥'.$value->wzPrice.'",';
}
}
}
if(isset($value->edzPrice)){
if(is_numeric($value->edzPrice)){
$seat_type .= '"O":"¥'.$value->edzPrice.'",';
if(isset($value->ywPrice)){
if(is_numeric($value->ywPrice)){
$ywPrice = $value->ywPrice * 10;
$seat_type .= '"3":"'.$ywPrice.'","A3":"¥'.$value->ywPrice.'",';
}
}
}
if(isset($value->ydzPrice)){
if(is_numeric($value->ydzPrice)){
$seat_type .= '"M":"¥'.$value->ydzPrice.'",';
if(isset($value->yzPrice)){
if(is_numeric($value->yzPrice)){
$yzPrice = $value->yzPrice * 10;
$seat_type .= '"1":"'.$yzPrice.'","A1":"¥'.$value->yzPrice.'",';
}
}
}
if(isset($value->swzPrice)){
if(is_numeric($value->swzPrice)){
$swzPrice = $value->swzPrice * 10;
$seat_type .= '"9":"'.$swzPrice.'","A9":"¥'.$value->swzPrice.'",';
if(isset($value->edzPrice)){
if(is_numeric($value->edzPrice)){
$seat_type .= '"O":"¥'.$value->edzPrice.'",';
}
}
if(isset($value->ydzPrice)){
if(is_numeric($value->ydzPrice)){
$seat_type .= '"M":"¥'.$value->ydzPrice.'",';
}
}
if(isset($value->swzPrice)){
if(is_numeric($value->swzPrice)){
$swzPrice = $value->swzPrice * 10;
$seat_type .= '"9":"'.$swzPrice.'","A9":"¥'.$value->swzPrice.'",';
}
}
$pricestr = $seat_type.'"train_no":'.'"'.$value->trainNo.'"';
//对返回的数据进行容错处理
$value->gjrwNum = isset($value->gjrwNum) ? ticket_exchange($value->gjrwNum,$iseven) : '';
$value->rwNum = isset($value->rwNum) ? ticket_exchange($value->rwNum,$iseven) : '';
$value->rzNum = isset($value->rzNum)?ticket_exchange($value->rzNum,$iseven) : '';
$value->tdzNum = isset($value->tdzNum)?ticket_exchange($value->tdzNum,$iseven) : '';
$value->wzNum = isset($value->wzNum)?ticket_exchange($value->wzNum,$iseven) : '';
$value->ywNum = isset($value->ywNum)?ticket_exchange($value->ywNum,$iseven) : '';
$value->yzNum = isset($value->yzNum)?ticket_exchange($value->yzNum,$iseven) : '';
$value->edzNum = isset($value->edzNum)?ticket_exchange($value->edzNum,$iseven) : '';
$value->ydzNum = isset($value->ydzNum)?ticket_exchange($value->ydzNum,$iseven) : '';
$value->swzNum = isset($value->swzNum)?ticket_exchange($value->swzNum,$iseven) : '';
$value->dwNum = isset($value->dwNum)?ticket_exchange($value->dwNum,$iseven) : '';
$value->runTime = isset($value->runTime)?$value->runTime : '';
//余票字符串
$return_data->data->result[$i] = '|预定|'.$value->trainNo.'|'.$value->trainCode.'|'.$value->fromStationName.'|'.$value->toStationName.'|'.$value->fromStationCode.'|'.$value->toStationCode.'|'.$value->startTime.'|'.$value->arriveTime.'|'.$value->runTime.'|'.$value->canBuyNow.'||'.date('Ymd',strtotime($value->trainStartDate)).'||||||||'.$value->gjrwNum.'||'.$value->rwNum.'|'.$value->rzNum.'|'.$value->tdzNum.'|'.$value->wzNum.'||'.$value->ywNum.'|'.$value->yzNum.'|'.$value->edzNum.'|'.$value->ydzNum.'|'.$value->swzNum.'|'.$value->dwNum.'||';
$data = '{"validateMessagesShowId":"_validatorMessage","status":true,"httpstatus":200,"data":{'.$pricestr.'},"messages":[],"validateMessages":{}}';
$return_data->data->price[$i] = $data;
$i++;
}
$pricestr = $seat_type.'"train_no":'.'"'.$value->trainNo.'"';
//余票字符串
$return_data->data->result[$i] = '|预定|'.$value->trainNo.'|'.$value->trainCode.'|'.$value->fromStationName.'|'.$value->toStationName.'|'.$value->fromStationCode.'|'.$value->toStationCode.'|'.$value->startTime.'|'.$value->arriveTime.'|'.$value->runTime.'|'.$value->canBuyNow.'||'.date('Ymd',strtotime($value->trainStartDate)).'||||||||'.ticket_exchange($value->gjrwNum).'|'.ticket_exchange($value->qtxbNum).'|'.ticket_exchange($value->rwNum).'|'.ticket_exchange($value->rzNum).'|'.ticket_exchange($value->tdzNum).'|'.ticket_exchange($value->wzNum).'||'.ticket_exchange($value->ywNum).'|'.ticket_exchange($value->yzNum).'|'.ticket_exchange($value->edzNum).'|'.ticket_exchange($value->ydzNum).'|'.ticket_exchange($value->swzNum).'|'.ticket_exchange($value->dwNum).'||';
$data = '{"validateMessagesShowId":"_validatorMessage","status":true,"httpstatus":200,"data":{'.$pricestr.'},"messages":[],"validateMessages":{}}';
$return_data->data->price[$i] = $data;
$this->tuniuprice_model->addOrUpdate($value->trainNo,$value->trainCode,$value->fromStationCode,$value->toStationCode,json_encode($data));
$i++;
}
}
$return_data->data->map = (object)$obj;
print_r(json_encode($return_data));
$return_data->data->map = (object)$obj;
print_r(json_encode($return_data));
}
}

@ -14,16 +14,20 @@
}
//余票转换
function ticket_exchange($num){
if(is_numeric($num)){
if($num == 0){
return '无';
}elseif($num == 99){
return '有';
}else{
return $num;
}
}
function ticket_exchange($num,$iseven){
if($iseven){
return '有';
}else{
if(is_numeric($num)){
if($num == 0){
return '无';
}elseif($num >= 99){
return '有';
}else{
return $num;
}
}
}
}
//发送请求函数
@ -40,7 +44,8 @@
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
}
curl_setopt($curl, CURLOPT_TIMEOUT, 45); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_TIMEOUT, 40); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_TIMEOUT_MS, 40000); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作

@ -6,47 +6,60 @@ class tuniuprice_model extends CI_Model {
$this->INFO = $this->load->database('INFO', TRUE);
}
//ÐÂÔö»ò¸üм۸ñ
public function addOrUpdate($TPL_Train_No,$TPL_Train_Code,$TPL_From_Station_Code,$TPL_To_Station_Code,$TPL_Price){
//新增或更新缓存
public function addOrUpdate($tpc_from_station,$tpc_to_station,$tpc_content){
$sql = "IF NOT EXISTS(
SELECT 1
FROM TrainPriceList
WHERE TPL_Train_Code = '$TPL_Train_Code'
AND TPL_From_Station_Code = '$TPL_From_Station_Code'
AND TPL_To_Station_Code = '$TPL_To_Station_Code'
FROM TrainPriceCache
WHERE
tpc_from_station = '$tpc_from_station'
AND tpc_to_station = '$tpc_to_station'
) BEGIN
INSERT INTO TrainPriceList
INSERT INTO TrainPriceCache
(
TPL_Train_No,
TPL_Train_Code,
TPL_From_Station_Code,
TPL_To_Station_Code,
TPL_Price,
TPL_Datetime,
TPL_Source
tpc_from_station,
tpc_to_station,
tpc_content,
tpc_datetime,
tpc_source
)
VALUES
(
'$TPL_Train_No','$TPL_Train_Code','$TPL_From_Station_Code','$TPL_To_Station_Code','$TPL_Price',GETDATE(),'tuniu'
'$tpc_from_station','$tpc_to_station','$tpc_content',GETDATE(),'tuniu'
)
END
ELSE
BEGIN
UPDATE TrainPriceList
SET
TPL_Train_No = '$TPL_Train_No',
TPL_Price = '$TPL_Price',
TPL_Datetime = GETDATE(),
TPL_Source = 'tuniu'
WHERE TPL_Train_Code = '$TPL_Train_Code'
AND TPL_From_Station_Code = '$TPL_From_Station_Code'
AND TPL_To_Station_Code = '$TPL_To_Station_Code'
UPDATE TrainPriceCache
SET tpc_from_station = '$tpc_from_station',
tpc_to_station = '$tpc_to_station',
tpc_content = '$tpc_content',
tpc_datetime = GETDATE(),
tpc_source = 'tuniu'
WHERE
tpc_from_station = '$tpc_from_station'
AND tpc_to_station = '$tpc_to_station'
END
";
$query = $this->INFO->query($sql);
return $query;
}
//获取缓存的火车信息
//如果读取到缓存是7天以前的数据就不返回任何数据并且将其删除。
public function get_train_cache($tpc_from_station,$tpc_to_station){
$sql = "SELECT
*
FROM
TrainPriceCache
WHERE
tpc_from_station = '$tpc_from_station'
AND
tpc_to_station = '$tpc_to_station'";
$query = $this->INFO->query($sql);
return $query->row();
}
//»ñÈ¡¼Û¸ñ
public function get_price($fromStationCode,$toStationCode,$trainCode){
$sql = "SELECT

@ -1,91 +1,202 @@
<style>
.preview_box {
float: left;
width:375px;
height:600px;
margin-top:8px;
width: 375px;
height: 600px;
margin-top: 8px;
}
.code_editor {
overflow: hidden;
height:600px;
margin-top:8px;
height: 600px;
margin-top: 8px;
}
</style>
<div class="container-fluid">
<div class="row">
<div class="preview_box" id="iframe_box" ></div>
<div class="preview_box" id="iframe_box"></div>
<div>
<h4>多媒体中心图片</h4>
<div class="input-group">
<input type="text" class="form-control" placeholder="请选择图片后复制地址到相应位置" id='selectedImageUrl'>
<span class="input-group-btn">
<button class="btn btn-default" type="button" id='mediaButton'>选择</button>
</span>
</div>
</div>
<div class="code_editor" id="editor"></div>
</div>
<hr/>
<form name="form_amp_code" id="form_amp_code" method="post" action="<?php echo site_url('amp/edit_save') ?>">
<textarea id="textarea_htmlcode" name="textarea_htmlcode" style="display: none;"><?php echo get_meta($information->ic_id, 'AMP'); ?></textarea>
<input type="hidden" name="ic_id" value="<?php echo $information->ic_id; ?>" />
<textarea id="textarea_htmlcode" name="textarea_htmlcode" style="display: none;"></textarea>
<input type="hidden" name="ic_id" value="<?php echo $information->ic_id; ?>"/>
<div class="row">
<div class="col-sm-13" >
<a href="http://ampvalidator.mycht.cn/" target="_blank">AMP代码验证</a>
|
<a href="https://uncss-online.com/" target="_blank">CSS精简</a>
|
<a href="http://tool.oschina.net/jscompress" target="_blank">CSS压缩</a>
</div>
<div class="col-sm-10">
<a href="http://ampvalidator.mycht.cn/" target="_blank">AMP代码验证</a>
|
<a href="https://uncss-online.com/" target="_blank">CSS精简</a>
|
<a href="http://tool.oschina.net/jscompress" target="_blank">CSS压缩</a>
|
<a href="http://tool.oschina.net/codeformat/css" target="_blank">CSS格式化</a>
|
<a href="<?php echo site_url('apps/htmlcompressor'); ?>" target="_blank">调试</a>
</div>
<div class="col-sm-3">
<select name="amp_status" id="amp_status" class="form-control" >
<option value="0" <?php echo get_meta($information->ic_id, 'AMP_STATUS') === '0' ? 'selected' : FALSE; ?> >不发布</option>
<option value="1" <?php echo get_meta($information->ic_id, 'AMP_STATUS') === '1' ? 'selected' : FALSE; ?> >发布</option>
<button type="button" class="btn btn-info" onclick="auto_create_amp(this);">
自动转换
</button>
</div>
<div class="col-sm-3">
<select name="amp_status" id="amp_status" class="form-control">
<option value="0" <?php echo get_meta($information->ic_id, 'AMP_STATUS') === '0' ? 'selected' : FALSE; ?> >
不发布
</option>
<option value="1" <?php echo get_meta($information->ic_id, 'AMP_STATUS') === '1' ? 'selected' : FALSE; ?> >
发布
</option>
<option value="2" <?php echo get_meta($information->ic_id, 'AMP_STATUS') === '2' ? 'selected' : FALSE; ?> >
发布-手动管理
</option>
</select>
</div>
<div class="col-sm-4">
<div class="btn-group">
<button type="button" class="btn btn-primary" onclick="submit_amp_editor();">保存</button>
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li role="separator" class="divider"></li>
<li><a href="javascript(0);" onclick="meta('delete', '<?php echo $information->ic_id; ?>', 'AMP', ''); meta('delete', '<?php echo $information->ic_id; ?>', 'AMP_STATUS', '');">删除</a></li>
</ul>
</div>
<?php if ($this->config->item('site_code') == 'cht') { ?>
<a href="http://192.155.224.195:8080/guide-use.php/amp_loader/test/?info_url=<?php echo $information->ic_url ?>" class="btn btn-primary"
target="_blank">看看</a>
<?php } ?>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-primary" onclick="submit_amp_editor();">保存</button>
<button type="button" class="btn btn-primary" onclick="show_cache_refresh_modal('<?php echo $information->ic_url ?>');">更新静态页面</button>
</div>
<div class="col-sm-4"> <button type="button" class="btn btn-default" onclick="meta('delete', '<?php echo $information->ic_id; ?>', 'AMP', ''); meta('delete', '<?php echo $information->ic_id; ?>', 'AMP_STATUS', '');">删除</button> </div>
</div>
</form>
<div id="amp_error">
</div>
<hr/>
</div>
<script type="text/x-template" id="amp_html">
<?php echo htmlentities(get_meta($information->ic_id, 'AMP')); ?>
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
function openKCFinder_Root() {
var site_url = 'https://www.chinahighlights.com';
var weburl = encodeURI(site_url + '<?php echo $information->ic_url ?>');
window.CallBack = openKCFinder_Root_callback;
window.open('/media/popselectpicture.php?site_code=cht&site_lgc=1&WebUrl=' + weburl, 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600');
}
function openKCFinder_Root_callback(result) {
var site_image_url = '<?php echo $this->config->item('media_image_url') ?>';
if (result != null && result.Pinfo[0]) {
console.info(result.Pinfo[0]);
$("#selectedImageUrl").val(site_image_url + result.Pinfo[0].PUrl);
}
}
$(function() {
$('#mediaButton').click(function() {
openKCFinder_Root();
});
});
var editor = ace.edit("editor");
editor.setTheme("ace/theme/eclipse");
editor.session.setMode("ace/mode/html");
editor.setOptions({
autoScrollEditorIntoView: true,
wrap: true
});
editor.getSession().on('change', function (e) {
update_preview();
});
var temp_div = document.createElement("div");
temp_div.innerHTML = $('#amp_html').html();
editor.session.setValue(temp_div.textContent);
function update_preview() {
//考虑做成异步操作,降低页面卡顿
var iframe = document.createElement('iframe');
iframe.setAttribute('frameBorder', '0');
iframe.setAttribute('id', 'previewIframe');
iframe.setAttribute('height', '100%');
iframe.setAttribute('width', '100%');
iframe.setAttribute('name', 'AMP Playground Output');
$('#iframe_box').html('');
$('#iframe_box').append(iframe);
var doc = iframe.contentDocument || iframe.document;
doc.open();
doc.write(editor.getValue());
doc.close();
}
function submit_amp_editor() {
$('#amp_error').html('');
$('#textarea_htmlcode').text(editor.getValue()).html();
$("#form_amp_code").ajaxSubmit({
success: function (responseText, statusText, xhr, form) {
if (responseText.name === 'no') {
error_msg='<h3>AMP validation FAIL</h3>';
$.each(responseText.value, function (index, element) {
error_msg=error_msg+'<p>line '+element.line+' col '+element.col+' :'+element.message+'</p>';
});
$.modaldialog.error('AMP语法错误请看下方错误详情');
$('#amp_error').html(error_msg);
} else {
$.modaldialog.success('保存成功!');
}
},
error: function (responseText, statusText, xhr, form) {
$.modaldialog.error("Action unsuccessful. Try again later.");
},
dataType: "json",
timeout: 30000
});
return false
}
function auto_create_amp(obj) {
$(obj).text('转换中...');
$(obj).enable(false);
$.getJSON("<?php echo site_url('amp/auto_create/' . $information->ic_id) ?>", function (result) {
$.each(result, function (i, field) {
if (i == 'data') {
editor.setValue(field.amp);
}
});
$(obj).text('转换完成!');
$(obj).enable(true);
});
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/eclipse");
editor.session.setMode("ace/mode/html");
editor.setOptions({
autoScrollEditorIntoView: true,
wrap: true
});
editor.getSession().on('change', function (e) {
update_preview();
});
editor.session.setValue($('#textarea_htmlcode').html($('#textarea_htmlcode').html()).text());
function update_preview() {
//考虑做成异步操作,降低页面卡顿
var iframe = document.createElement('iframe');
iframe.setAttribute('frameBorder', '0');
iframe.setAttribute('id', 'previewIframe');
iframe.setAttribute('height', '100%');
iframe.setAttribute('width', '100%');
iframe.setAttribute('name', 'AMP Playground Output');
$('#iframe_box').html('');
$('#iframe_box').append(iframe);
var doc = iframe.contentDocument || iframe.document;
doc.open();
doc.write(editor.getValue());
doc.close();
}
function submit_amp_editor() {
$('#textarea_htmlcode').text(editor.getValue()).html();
submitForm('form_amp_code');
}
</script>

@ -1,7 +1,7 @@
<link rel="stylesheet" href="http://data.chtcdn.com/js/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/start_rate/rating_simple.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery-ui/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/start_rate/rating_simple.js"></script>
<link rel="stylesheet" href="/js/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css" type="text/css" />
<link rel="stylesheet" href="/js/start_rate/rating_simple.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/js/jquery-ui/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/start_rate/rating_simple.js"></script>
<script src="/js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
$(function() {
@ -448,7 +448,7 @@
if (isset($rating[$k])) {
for ($i = 0; $i < $rating[$k]; $i++) {
?>
<img src="http://data.chtcdn.com/js/start_rate/sth.gif">
<img src="/js/start_rate/sth.gif">
<?php
}
}

@ -4,7 +4,6 @@
function batch_update_cache(url, index) {
var msg_obj="#cache" + index;
$(msg_obj).html("\u7a0d\u7b49...");
$.ajax({
type: "post",
dataType: "json",
@ -32,13 +31,14 @@ function batch_update_cache(url, index) {
function create_cache_data(index){
if ($('#cache_url' + index).length > 0) {
if ($('#cache' + index).html() != '\u66f4\u65b0\u9759\u6001\u9875\u9762\u6210\u529f\uff01') {
batch_update_cache($('#cache_url' + index).html(),index);
url=$('#cache_url' + index).html();
setTimeout("batch_update_cache('"+url+"',"+index+")",5000);
}
}
}
$(document).ready(function() {
batch_update_cache($('#cache_url1').html(),1);
});
//$(document).ready(function() {
//batch_update_cache($('#cache_url1').html(),1);
//});
</script>
@ -77,7 +77,7 @@ function batch_update_cache(url, index) {
</div>
<div class="span1">
<a href="javascript:void(0);" class="btn btn-danger" onclick="batch_update_cache($('#cache_url1').html(),1);">开始更新</a>
</div>

@ -80,8 +80,12 @@
<li><a href="<?php echo site_url('thirdparty/advertise') ?>">广告管理</a></li>
<li><a href="<?php echo site_url('apps/tripadvisor_spider') ?>">TA评论采集</a></li>
<li><a href="<?php echo site_url('tools/old') ?>">老旧信息查询</a></li>
<li><a href="<?php echo site_url('tools/amp_check') ?>">AMP转化检查</a></li>
<li><a target="_blank" href="http://www.arachina.com/html-tag-quick-query.htm">Html基础知识</a></li>
<li><a target="_blank" href="https://docs.google.com/presentation/d/1YN9P8j837SCHenpK_UApHU04K6evV1-GLULhsdmdtWM/edit?usp=sharing">AMP知识及构建SOP</a></li>
<li><a target="_blank" href="https://docs.google.com/presentation/d/1YN9P8j837SCHenpK_UApHU04K6evV1-GLULhsdmdtWM/edit?usp=sharing">AMP知识</a></li>
<li><a target="_blank" href="https://docs.google.com/presentation/d/1E9dbrANxtvgsOTkJWWab-UNaBgRJyQwNYu9Tw5k5jUI/edit?usp=sharing">AMP操作SOP</a></li>
<li><a target="_blank" href="https://docs.google.com/presentation/d/1_SN8Eo3EFmigfyYrtX7WTkiGKqgvc0EBBS3YoXeZSBc/edit#slide=id.g45b539c835_4_61">HTML构建工具V3</a></li>
<li><a target="_blank" href="https://docs.google.com/presentation/d/1zPc7832vManRsCgkgO5XoMVKe6deIHC9zsmLPWihxrA/edit?usp=sharing">PS基础课件</a></li>
<li><a href="<?php echo site_url('setting') ?>">系统设置</a></li>
</ul>
</li>

@ -350,32 +350,6 @@
return true;
}
//添加绑定景点
function add_landscape(area_id, lsi_sn) {
var urlReQuery = "<?php echo site_url('information/add_landscape/'); ?>";
$.ajax({
type: "get",
url: urlReQuery + '/' + area_id + '/' + lsi_sn,
success: function(data, textStatus) {
var dataArray = $.parseJSON(data);//JSON.parse(data);
for (var key in dataArray) {
if (dataArray[key].name == 'ok') {
window.location.href = dataArray[key].value;
return true;
} else if (dataArray[key].name == 'no') {
$.modaldialog.error(dataArray[key].value);
return false;
}
}
},
error: function() {
$.modaldialog.error('发生错误请联系YCC');
return false;
}
});
}
//跳转到前台页面
function goto_page() {
var site_url = '<?php echo $this->config->item('site_url') ?>';
@ -1000,7 +974,7 @@
<div class="clearfix"></div>
<?php if (is_series_site()) { ?>
<label class="span12">系列站会自动更新静态页面</label>
<label class="span12">自动更新静态页面</label>
<?php } else { ?>
<label class="checkbox inline span12">
<input type="checkbox" name="auto_update_cache_checkbox" id="auto_update_cache_checkbox" onclick="get_update_cache_url();" value="<?php echo $information->ic_url; ?>" />静态更新
@ -1059,22 +1033,3 @@
</div>
<!-- Modal -->
<div id="myModal" class="modal hide fade" style="width:90%;left:25%;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div id="myModalLabel" style="line-height:30px;">
<h3 class="span5 pull-left">页面访问量明细表</h3>
<form style="margin-bottom:0px;" id="get-analytic-form" method="post" action="<?php echo site_url('keyworlds/get_analytics_by_date'); ?>">
<input class="span2 pull-left" style="margin-bottom:0;" size="16" id="startdate" name="startdate" type="text" value="开始时间">
<input class="span2 pull-left" style="margin-bottom:0;" size="16" id="enddate" name="enddate" type="text" placeholder="结束时间">
<input type="hidden" name="pagepath" value="<?php echo $information->ic_url; ?>">
<button type="button" class="btn" onClick="get_analytics_ajax('get-analytic-form', 'analytics-content', '0');">查询</button>
</form>
</div>
</div>
<div class="modal-body" id="analytics-content">
</div>
</div>

@ -3,7 +3,7 @@
<head>
<title>URLS</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="http://data.chtcdn.com/css/information-system.css" type="text/css" />
<link rel="stylesheet" href="/css/information-system.css" type="text/css" />
</head>
<body>

@ -10,6 +10,7 @@
<li class="divider"></li>
<li class="nav-header">信息模块</li>
<li><a href="<?php echo site_url('home') ?>">首页</a></li>
<li><a href="<?php echo site_url('special') ?>">专题管理</a></li>
<li><a href="<?php echo site_url('link') ?>">交换链接</a></li>
<li><a href="<?php echo site_url('airport') ?>">机场信息</a></li>
@ -40,6 +41,8 @@
<li><a href="<?php echo site_url('keyworlds/update_cdn') ?>" target="_blank">CDN定时更新</a> </li>
<li><a href="<?php echo site_url('sendmail') ?>" >订单邮件管理</a> </li>
<li><a href="http://share.chtcdn.com/info.php/infoshare/" target="_blank" >信息分享平台</a> </li>
<li><a href="<?php echo site_url('welcome/create_all_urls') ?>" target="_blank" >全站静态化更新</a> </li>
<li><a href="<?php echo site_url('welcome/create_all_urls/amp') ?>" target="_blank" >全站AMP更新</a> </li>
<li class="divider"></li>

@ -15,7 +15,7 @@
<div class="modal-content" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 style="margin:0;">静态化更新-系列站专用</h3>
<h3 style="margin:0;">静态化更新</h3>
</div>
<div class="modal-body">
<label>需要更新的页面</label>
@ -34,6 +34,32 @@
</div>
<!-- 静态化更新窗口 -->
<!-- 国际展异步更新窗口 -->
<div class="modal fade" id="icht_async_modal" tabindex="-2" role="dialog" data-backdrop="false">
<div class="modal-dialog" role="document">
<div class="modal-content" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 style="margin:0;">静态化更新</h3>
</div>
<div class="modal-body">
<!--label class="text-info">信息保存成功。</label-->
<div id="icht_async_msg_waiting">
<p class="text-danger">正在更新静态页面请稍等4~8秒。</p>
<img src="http://img10.cache.hxsd.com/news/2015/11/12/691442_1447295058_5.gif" width="100%">
</div>
<div id="icht_async_msg_success">
<p class="text-success">静态页面更新成功,请打开页面检查。</p>
<img src="http://pic39.photophoto.cn/20160620/1155116868658436_b.jpg" width="100%">
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<!-- 国际展异步更新窗口 -->

@ -5,8 +5,8 @@
<meta charset="utf-8">
<title>信息平台</title>
<link rel="stylesheet" href="/css/information-system3.css?v=201508112" type="text/css" />
<script type="text/javascript" src="/min/?f=/js/information-system3.min.js,/js/common.js&v=2018022601"></script>
<script type="text/javascript" src="/js/kindeditor/kindeditor.js?v=20160601"></script>
<script type="text/javascript" src="/min/?f=/js/information-system3.min.js,/js/common.js&v=20190128"></script>
<script type="text/javascript" src="/js/kindeditor/kindeditor.js?v=20180730"></script>
<link rel="shortcut icon" href="/bootstrap/img/glyphicons_290_skull.png">
<script language="javascript">
@ -20,6 +20,9 @@
case 'ah':
echo "alert(url.replace('/kcfinder/upload/ah/','https://data.asiahighlights.com/'));";
break;
case 'gm':
echo "alert(url.replace('/kcfinder/upload/gm/','https://data.chinarundreisen.com/'));";
break;
default:echo 'alert(url);';
}
?>
@ -84,8 +87,12 @@
<li><a href="<?php echo site_url('thirdparty/advertise') ?>">广告管理</a></li>
<li><a href="<?php echo site_url('apps/tripadvisor_spider') ?>">TA评论采集</a></li>
<li><a href="<?php echo site_url('tools/old') ?>">老旧信息查询</a></li>
<li><a href="<?php echo site_url('tools/amp_check') ?>">AMP转化检查</a></li>
<li><a target="_blank" href="http://www.arachina.com/html-tag-quick-query.htm">Html基础知识</a></li>
<li><a target="_blank" href="https://docs.google.com/presentation/d/1YN9P8j837SCHenpK_UApHU04K6evV1-GLULhsdmdtWM/edit?usp=sharing">AMP知识及构建SOP</a></li>
<li><a target="_blank" href="https://docs.google.com/presentation/d/1YN9P8j837SCHenpK_UApHU04K6evV1-GLULhsdmdtWM/edit?usp=sharing">AMP知识</a></li>
<li><a target="_blank" href="https://docs.google.com/presentation/d/1E9dbrANxtvgsOTkJWWab-UNaBgRJyQwNYu9Tw5k5jUI/edit?usp=sharing">AMP操作SOP</a></li>
<li><a target="_blank" href="https://docs.google.com/presentation/d/1_SN8Eo3EFmigfyYrtX7WTkiGKqgvc0EBBS3YoXeZSBc/edit#slide=id.g45b539c835_4_61">HTML构建工具V3</a></li>
<li><a target="_blank" href="https://docs.google.com/presentation/d/1zPc7832vManRsCgkgO5XoMVKe6deIHC9zsmLPWihxrA/edit?usp=sharing">PS基础课件</a></li>
<li><a href="<?php echo site_url('setting') ?>">系统设置</a></li>
</ul>
</li>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,128 @@
<script language="javascript">
function batch_update_amp(index) {
var ic_id = $('#cache_ic_id_' + index).val();
var msg_obj = "#cache" + index;
var amp_code = '';
$(msg_obj).html("\u7a0d\u7b49...");
$.ajax({
type: "get",
dataType: "json",
url: "<?php echo site_url('amp/auto_create/') ?>/" + ic_id,
success: function (result, textStatus) {
//当result为空的时候跳过
if(result.length == 0 || result =='' || undefined || null){
$(msg_obj).html("<a href='javascript:void(0);' onclick='create_amp_data(" + index + ");' >发生错误,请重试</a>");
create_amp_data(++index);
return;
}
$.each(result, function (i, field) {
if (i === 'data') {
amp_code = field.amp;
}
});
$(msg_obj).html("\u0041\u004d\u0050\u8f6c\u6362\u6210\u529f\u0021\u6b63\u5728\u4fdd\u5b58\u2026\u2026");
//保存转换的AMP代码 begin
$.ajax({
type: "post",
dataType: "json",
url: "<?php echo site_url('amp/edit_save/') ?>",
data: {
"ic_id": ic_id,
"textarea_htmlcode": amp_code,
"amp_status": 1
},
success: function (result, textStatus) {
if (result.name === 'no') {
error_msg='';
$.each(result.value, function (index, element) {
error_msg=error_msg+'line '+element.line+' col '+element.col+' :'+element.message+'&#10;';
});
$(msg_obj).html("保存失败AMP语法错误!"+'<i class="glyphicon glyphicon-education" title="'+error_msg+'"></i>');
}else{
$(msg_obj).html("\u0041\u004d\u0050\u66f4\u65b0\u6210\u529f\u0021");
}
create_amp_data(++index);
},
error: function () {
$(msg_obj).html("<a href='javascript:void(0);' onclick='create_amp_data(" + index + ");' >发生错误,请重试</a>");
create_amp_data(++index);
}
});
//保存转换的AMP代码 end
},
error: function () {
$(msg_obj).html("<a href='javascript:void(0);' onclick='create_amp_data(" + index + ");' >发生错误,请重试</a>");
create_amp_data(++index);
}
});
}
function create_amp_data(index) {
if ($('#cache_url' + index).length > 0) {
if ($('#cache' + index).html() !== '\u0041\u004d\u0050\u66f4\u65b0\u6210\u529f\u0021') {
if ($('#cache' + index).html() == '手动管理,不会自动更新') { //手动更新的项目跳过
create_amp_data(++index);
} else {
setTimeout("batch_update_amp("+index+")",5000);
}
}
}
}
</script>
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
</div>
<div class="col-sm-16">
<table class="table table-striped">
<thead>
<tr>
<th class="col-sm-2">#</th>
<th class="col-sm-2">发布</th>
<th class="col-sm-14">URL</th>
<th class="col-sm-6">更新进度</th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($all_information as $key => $info) {
if ($info->ic_status == 1 && !empty($info->ic_url)) {
$i++;
?>
<tr>
<td><a href="<?php echo site_url('amp/edit/'.$info->ic_id); ?>" target="_blank"><?php echo $i; ?></a></td>
<td>
<?php if($info->amp_status==='1'){echo '<i class="glyphicon glyphicon-flash"></i>'; } ?>
<?php if($info->amp_status==='2'){echo '<i class="glyphicon glyphicon-hand-up" title="手动管理,不会自动更新"></i>'; } ?>
</td>
<td id="cache_url<?php echo $i; ?>" name="cache_url<?php echo $i; ?>" class="cache_url"><a href="<?php echo site_url('information/edit/'.$info->is_id) ?>" target="_blank"><?php echo $info->ic_url; ?></a></td>
<td id="cache<?php echo $i; ?>" name="cache<?php echo $i; ?>"><?php if($info->amp_status==='2'){echo '手动管理,不会自动更新'; } ?></td>
<input type="hidden" id="cache_ic_id_<?php echo $i; ?>" value="<?php echo $info->ic_id; ?>" />
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<div class="col-sm-4">
<a href="javascript:void(0);" class="btn btn-danger" onclick="create_amp_data(1);">开始更新</a>
</div>
</div>
</div>

@ -3,9 +3,9 @@
<head>
<title>更新静态页-v1.0a</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="http://europe.chtcdn.com/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<script type="text/javascript" src="http://europe.chtcdn.com/js/jquery.js"></script>
<script type="text/javascript" src="http://europe.chtcdn.com/bootstrap/js/bootstrap.min.js"></script>
<link href="//int.mycht.cn/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<script type="text/javascript" src="//int.mycht.cn/js/jquery.js"></script>
<script type="text/javascript" src="//int.mycht.cn/bootstrap/js/bootstrap.min.js"></script>
<style type="text/css">
.show-grid {padding: 15px; background: #efefef; border-radius: 5px;}
.mr10 {margin-right: 10px;}

@ -3,23 +3,23 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>信息管理</title>
<link rel="stylesheet" href="http://data.chtcdn.com/js/poshytip/tip-yellow/tip-yellow.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/zTree/zTreeStyle/zTreeStyle.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/zTree/demo.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/modaldialog/css/jquery.modaldialog.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/kindeditor/themes/default/default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="http://data.chtcdn.com/css/layout.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css" type="text/css" />
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery-ui/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery.form.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/poshytip/jquery.poshytip.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/zTree/jquery.ztree.all.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/modaldialog/jquery.modaldialog.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/basic.js"></script>
<link rel="shortcut icon" href="http://data.chtcdn.com/bootstrap/img/glyphicons_290_skull.png">
<link rel="stylesheet" href="/js/poshytip/tip-yellow/tip-yellow.css" type="text/css" />
<link rel="stylesheet" href="/js/zTree/zTreeStyle/zTreeStyle.css" type="text/css" />
<link rel="stylesheet" href="/js/zTree/demo.css" type="text/css" />
<link rel="stylesheet" href="/js/modaldialog/css/jquery.modaldialog.css" type="text/css" />
<link rel="stylesheet" href="/js/kindeditor/themes/default/default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/css/layout.css" type="text/css" />
<link rel="stylesheet" href="/js/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css" type="text/css" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery-ui/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.form.min.js"></script>
<script type="text/javascript" src="/js/poshytip/jquery.poshytip.min.js"></script>
<script type="text/javascript" src="/js/zTree/jquery.ztree.all.min.js"></script>
<script type="text/javascript" src="/js/modaldialog/jquery.modaldialog.js"></script>
<script type="text/javascript" src="/js/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript" src="/js/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript" src="/js/basic.js"></script>
<link rel="shortcut icon" href="/bootstrap/img/glyphicons_290_skull.png">
<script language="javascript">
//快速图片上传

@ -1043,7 +1043,7 @@
<span id="mobile_friendly_status"></span>
</p>
<div class="btn-group col-xs-24 nopadding pull-right <?php if ($is_writeable == 0) echo 'hide'; ?>">
<div class="btn-group col-xs-24 nopadding pull-right ">
<a href="javascript:void(0);" class="btn btn-primary col-xs-19" onclick="editor.sync();if(information_check()!=false){submitForm('form_information_edit');}">保存修改</a>
<button class="btn dropdown-toggle btn-primary col-xs-5" data-toggle="dropdown">
<span class="caret"></span>

@ -0,0 +1,130 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>AMP转化表-v1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="http://europe.chtcdn.com/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<script type="text/javascript" src="http://europe.chtcdn.com/js/jquery.js"></script>
<script type="text/javascript" src="http://europe.chtcdn.com/bootstrap/js/bootstrap.min.js"></script>
<style type="text/css">
.show-grid {padding: 15px; background: #efefef; border-radius: 5px;}
.mr10 {margin-right: 10px;}
.nav {margin-bottom: 5px;}
.pic {display: none;}
.msg {color: #07c;}
.mt12 {margin-top: 12px;}
.msg_wait {color: #999;}
.none {display: none;}
.form-search {display: inline-block;margin:0 0 0 5px !important;}
.input-medium.search-query {width: 250px;}
#search,#insert,#update {margin-top: 2px;float: right;}
@media (min-width: 1200px) {
.container.wd {
padding: 0 15px;
width: 1170px;
}
}
</style>
<script type="text/javascript">
$(function() {
//下拉选站点
$('a.sss').on('click', function() {
var site = $(this).html();
location.href = '/info.php/login/change_site/'+site+'/?url=/tools/amp_check';
});
});
</script>
</head>
<body>
<div class="container wd">
<div class="row show-grid">
<ul class="nav nav-pills">
<li class="active dropdown mr10">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
站点:<?php echo($this->config->item('site_code'));?>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a class="sss">cht</a>
</li>
<li>
<a class="sss">jp</a>
</li>
<li>
<a class="sss">gm</a>
</li>
<li>
<a class="sss">vc</a>
</li>
<li>
<a class="sss">vac</a>
</li>
<li>
<a class="sss">ru</a>
</li>
<li>
<a class="sss">it</a>
</li>
<li>
<a class="sss">ct</a>
</li>
</ul>
</li>
<span class="label label-info">信息:<?php echo(count($info));?>个 (只显示前800个)</span>
<form class="form-search" id="path_search" action="#" method="post">
<span class="checkbox">
<label>
<input type="radio" name="amp" value="yes" <?php if($amp == 'yes') echo('checked'); ?>> 显示已转换AMP的信息
</label>
</span>
&nbsp;
<span class="checkbox">
<label>
<input type="radio" name="amp" value="no" <?php if($amp == 'no') echo('checked'); ?>> 显示未转换AMP的信息
</label>
</span>
&nbsp;
<button type="submit" class="btn">筛选</button>
</form>
</ul>
</div>
<div class="row">
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th>文件名</th>
<th width="6%">AMP转化</th>
<th width="6%"></th>
</tr>
</thead>
<tbody class="data_group">
<?php foreach($info as $key=>$it) {
if ($key == 800) break;
?>
<tr class="data">
<td><?php echo($key+1);?></td>
<td title="<?php echo($it->ic_url);?>"><?php echo($it->ic_url);?></td>
<td>
<?php
if ($amp == 'yes')
echo('<span style="color:seagreen"></span>');
else
echo('<span style="color:#a12023"></span>');
?>
</td>
<td>
<a href="javascript:document.getElementById('keywords').value='<?php echo(urlencode($it->ic_url));?>';document.forms.goSearch.submit();" target="_blank">编辑</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<form action="/info.php/welcome/search" method="post" id="goSearch" target="_blank">
<input type="hidden" name="keywords" id="keywords" value="">
</form>
</body>
</html>

@ -5,7 +5,9 @@
<dl>
<dt>系统模块</dt>
<dd>
<a href="<?php echo site_url('home') ?>">站点首页</a>
</dd>
<dd>
<a href="<?php echo site_url('special') ?>">专题管理</a>
</dd>

@ -3,18 +3,18 @@
<head>
<meta charset="utf-8">
<title>CHT Author</title>
<link href="http://data.chtcdn.com/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="http://data.chtcdn.com/js/poshytip/tip-yellow/tip-yellow.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/modaldialog/css/jquery.modaldialog.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/kindeditor/themes/default/default.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/poshytip/jquery.poshytip.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery.form.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/modaldialog/jquery.modaldialog.js"></script>
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="/js/poshytip/tip-yellow/tip-yellow.css" type="text/css" />
<link rel="stylesheet" href="/js/modaldialog/css/jquery.modaldialog.css" type="text/css" />
<link rel="stylesheet" href="/js/kindeditor/themes/default/default.css" type="text/css" media="screen" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/poshytip/jquery.poshytip.min.js"></script>
<script type="text/javascript" src="/js/jquery.form.min.js"></script>
<script type="text/javascript" src="/js/modaldialog/jquery.modaldialog.js"></script>
<script type="text/javascript" src="/js/kindeditor/kindeditor.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/basic.js"></script>
<script src="http://data.chtcdn.com/js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="/js/basic.js"></script>
<script src="/js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

@ -7,10 +7,23 @@ $sftp = new Net_SFTP('106.14.1.181');
if (!$sftp->login('10000004000', 'YRATF0OtDaYa2Uhv6cWO8BV9FPBup5')) {
exit('Login Failed');
}
// 获取前一天的对账单
// target remote
$target_folder = str_replace("-", "/", date("Y-m", strtotime("-1 day")) );
$target_folder = null;
$targer_day = null;
// 获取前一天的对账单
$target_folder = str_replace("-", "/", date("Y-m", strtotime("-1 day")) ); // 2018/07
if (isset($_GET['f'])) {
$target_folder = $_GET['f']; // f=2018/06 f=2018/07/23
$target_set = explode('/', $target_folder);
if (isset($target_set[2])) {
$target_folder = $target_set[0] . "/" . $target_set[1];
$targer_day = $target_set[2];
}
}
$file_list = array_values(array_diff($sftp->nlist($target_folder), array(".","..")));
if ($targer_day !== null) {
$file_list = array($target_set[0] . $target_set[1] . $target_set[2] . ".xlsx");
}
// target local
$target_local = "statement_files/" . $target_folder;
if ( ! is_dir($target_local)) {
@ -24,11 +37,15 @@ $new_files = array_values(array_diff($file_list, $local_files));
$new_cnt = 0;
foreach ($new_files as $key => $new) {
$file_path = $target_folder . "/" . $new;
echo $file_path, " ", $target_local . "/" . $new;
echo "<br>";
$sftp->get($file_path, $target_local . "/" . $new);
$new_cnt++;
}
echo "Copied new statements count: " . $new_cnt;
echo "<br> new_files ", json_encode($new_files);
echo "<br> file_list ", json_encode($file_list);
// header("Location: http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/auto_update_statement?f=$target_folder&fjson=" . json_encode($new_files));
// header("Location: http://www.mycht.cn/webht.php/apps/pay/report/ipaylinks_excel?f=$target_folder&fjson=" . json_encode($new_files));
header("Location: http://www.mycht.cn/webht.php/apps/pay/report/ipaylinks_excel?f=$target_folder&fjson=" . json_encode($new_files));
// header("Location: http://202.103.68.79:8083/webht.php/apps/pay/report/ipaylinks_excel?f=$target_folder&fjson=" . json_encode($new_files));

@ -38,6 +38,15 @@ function information_check() {
flag = false;
}
//信息备注og:description长度
var og_description = $("#meta_note").val();
var og_description_length = get_string_length(og_description);
if (sitecode == 'jp' || sitecode == 'ru') og_description_length = parseInt(og_description_length / 2);
if (og_description_length < 80 || og_description_length > 160) {
$("#error-tops").append('<li><small>og:description信息备注长度必须在80~160个字符之间[' + og_description_length + '个]</small></li>');
flag = false;
}
//文章字数
var content_num = content_length;
if (content_num < 1500) {

@ -295,7 +295,17 @@ function successfun(responseText, statusText, xhr, form) {
$.modaldialog.success(responseText[key].value + "n" + "\u9759\u6001\u9875\u9762\u66f4\u65b0\u4e2d...");
updateCache($("#auto_update_cache_checkbox").val(), "")
} else {
$.modaldialog.success(responseText[key].value)
var update_info_log = responseText[key].update_info_log;
if (update_info_log && update_info_log.async_update) {
//国际站使用异步更新缓存
$('#icht_async_modal').modal('show');
$.get(update_info_log.async_update, function() {
$('#icht_async_msg_waiting').slideDown(400);
$('#icht_async_msg_success').slideUp(400);
});
} else {
$.modaldialog.success(responseText[key].value)
}
}
} else {
if (responseText[key].name == "ok_go") {

@ -161,6 +161,13 @@ function information_check() {
$("#error-tops").append("<li><small>SEO描述长度必须在80~160个字符之间[" + description_length + "个]</small></li>");
flag = false
}
var og_description = $("#meta_note").val();
var og_description_length = get_string_length(og_description);
if (sitecode == 'jp' || sitecode == 'ru') og_description_length = parseInt(og_description_length / 2);
if (og_description_length < 80 || og_description_length > 160) {
$("#error-tops").append('<li><small>og:description信息备注长度必须在80~160个字符之间[' + og_description_length + '个]</small></li>');
flag = false;
}
var content_num = content_length;
if (content_num < 1500) {
$("#error-tops").append("<li><small>文章字数不能少于1500字[" + content_num + "字]</small></li>");
@ -286,6 +293,9 @@ function information_check() {
return true
}
function submitForm(form) {
//国际站使用异步更新缓存
$('#icht_async_msg_waiting').show();
$('#icht_async_msg_success').hide();
$("#" + form).ajaxSubmit({
success: successfun,
error: errorfun,
@ -300,10 +310,20 @@ function errorfun(responseText, statusText, xhr, form) {
function successfun(responseText, statusText, xhr, form) {
for (var key in responseText) {
if (responseText[key].name == "ok") {
$.modaldialog.success(responseText[key].value)
var update_info_log = responseText[key].update_info_log;
if (update_info_log && update_info_log.async_update) {
//国际站使用异步更新缓存
$('#icht_async_modal').modal('show');
$.get(update_info_log.async_update,{"r": new Date().getTime()}, function() {
$('#icht_async_msg_waiting').slideUp(400);
$('#icht_async_msg_success').slideDown(400);
});
} else {
$.modaldialog.success(responseText[key].value);
}
} else {
if (responseText[key].name == "ok_go") {
$.modaldialog.success('提交成功,正在跳转到下个页面...');
$.modaldialog.success('提交成功,正在跳转到下个页面...');
setTimeout(function() {
window.location.href = responseText[key].value
},
@ -489,6 +509,14 @@ function get_string_length(str) {
}
return realLength
}
function get_string_length_site(element) {
var length = get_string_length($("#" + element).val());
var sitecode = $("#is_sitecode").val();
if (sitecode == "jp" || sitecode == "ru") {
length = parseInt(length / 2)
}
return length;
}
function change_seo_count(element) {
var length = get_string_length($("#" + element).val());
var sitecode = $("#is_sitecode").val();
@ -508,6 +536,15 @@ function get_ajax_reviewed_list(formid, container, flag) {
}
$("#" + container).load(url + " #" + container, data)
};
function count_valid(element, element_text, from, to) {
if (from <= 0) { return true;}
var element_value_cnt = get_string_length_site(element) ;
if (element_value_cnt < from) {
$.modaldialog.error(element_text + "长度必须大于" + from + "个字符")
return false
}
return true;
}
/* basic end*/
function mobile_friendly(refresh){
var ic_url = $("#ic_url").val();
@ -528,6 +565,12 @@ if (json.result == 'ok'){
});
}
//弹出静态化更新窗口,并自动点击更新
function show_cache_refresh_modal(url){
$('#static_html_url').val(url);
updateCache($('#static_html_url').val(), 'cache_refresh_modal_msg');
$('#cache_refresh_modal').modal('show');
}
$(document).ready(function() {

@ -17,7 +17,7 @@ if (!window.console) {
if (!console.log) {
console.log = function () {};
}
var _VERSION = '4.1.6 (2013-03-24) 20160601',
var _VERSION = '4.1.6 (2013-03-24) 20180730',
_ua = navigator.userAgent.toLowerCase(),
_IE = _ua.indexOf('msie') > -1 && _ua.indexOf('opera') == -1,
_GECKO = _ua.indexOf('gecko') > -1 && _ua.indexOf('khtml') == -1,
@ -3207,9 +3207,9 @@ _extend(KCmd, {
var thirdlink=false
if (arguments[3] && arguments[3]=='1') {
if(url.indexOf("www.chinahighlights.com") < 0 ){
url='http://www.chinahighlights.com'+url;
url='https://www.chinahighlights.com'+url;
}
url ='http://www.chinahighlights.com/redirect.asp?url='+url+'&t=78002';
url ='https://www.chinahighlights.com/redirect.asp?url='+url+'&t=78002';
thirdlink=true;
};
@ -5780,7 +5780,7 @@ _plugin('core', function(K) {
html = html.replace(/class=\"MsoNormal\"/gi, '');
html = html.replace(/file\:\/\/C:/gi, '');
html = html.replace(/<p class=\"MsoListParagraph\"/gi, '<li');
self.insertHtml(html, true);
}
K(doc.body).bind('paste', function(e){

@ -57,8 +57,8 @@ KindEditor.plugin('link', function(K) {
thirdlinkBox = K('select[name="thirdlink"]', div),
typeBox = K('select[name="type"]', div);
urlBox.val('http://');
typeBox[0].options[0] = new Option(lang.newWindow, '_blank');
typeBox[0].options[1] = new Option(lang.selfWindow, '');
typeBox[0].options[0] = new Option(lang.selfWindow, '');
typeBox[0].options[1] = new Option(lang.newWindow, '_blank');
self.cmd.selection();
var a = self.plugin.getSelectedLink();
if (a) {

@ -34,6 +34,8 @@ $_CONFIG = array(
'uploadDir' => "", //文件夹管理目录
'theme' => "default", //主题
'types' => array(
//在当前上传目录下建立虚拟链接指向对应的文件夹,就可以上传编辑站点文件
// mklink /D "C:\Dropbox\wwwroot\information-system-all_in_one\kcfinder\upload\gm\image" "C:\inetpub\wwwroot\gmsite\www\image"
'default' => '4sj4837Rjk37L', //默认站点,设置一个怎么也猜不到的后缀
'ah' => '*mime image/gif image/png image/jpeg', //这个名称就是目录名,每个站点不同
//国际站点

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
</staticContent>
</system.webServer>
</configuration>

@ -97,6 +97,7 @@ function is_remote_ip()
|| stripos($ip_list,'221.7.151.37')!==false
|| stripos($ip_list,'221.7.151.41')!==false
|| stripos($ip_list,'111.59.90.31')!==false
|| stripos($ip_list,'180.140.114.225')!==false
|| stripos($ip_list,'180.140.114.208')!==false
|| stripos($ip_list,'::1')!==false //这个也是本地IP
){
@ -115,7 +116,7 @@ function is_remote_ip()
<?php if (isset($_GET['remote']) || is_remote_ip()){ ?>
<iframe id="test" frameborder="0" src="http://photo.chtcdn.com:3581/OutputApp/searchpicture.aspx?<?php echo($rwidth);?>webcode=<?php echo $media_site_code; ?>&lgc=<?php echo $_GET['site_lgc'];?>&apptype=translate&uname=ycc&upass=ycc&lmisn=1&WebUrl=<?php echo isset($_GET['WebUrl'])?$_GET['WebUrl']:false;?>&redirecturl=http://<?php echo $_SERVER['HTTP_HOST']; ?>/media/transitval.php" > </iframe>
<?php }else{ ?>
<iframe id="test" frameborder="0" src="http://video.chtcdn.com/OutputApp/searchpicture.aspx?<?php echo($rwidth);?>webcode=<?php echo $media_site_code; ?>&lgc=<?php echo $_GET['site_lgc'];?>&apptype=infomation&WebUrl=<?php echo isset($_GET['WebUrl'])?$_GET['WebUrl']:false;?>&redirecturl=http://<?php echo $_SERVER['HTTP_HOST']; ?>/media/transitval.php" > </iframe>
<iframe id="test" frameborder="0" src="https://video.chtcdn.com/OutputApp/searchpicture.aspx?<?php echo($rwidth);?>webcode=<?php echo $media_site_code; ?>&lgc=<?php echo $_GET['site_lgc'];?>&apptype=infomation&WebUrl=<?php echo isset($_GET['WebUrl'])?$_GET['WebUrl']:false;?>&redirecturl=https://<?php echo $_SERVER['HTTP_HOST']; ?>/media/transitval.php" > </iframe>
<?php } ?>
</body>
</html>

@ -0,0 +1,105 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit</title>
<style type="text/css">
/*<![CDATA[ XML blockout */
<!--
p { margin-top: .75em;
text-align: justify;
margin-bottom: .75em;
}
h1,h2,h3 {
text-align: center; /* all headings centered */
clear: both;
}
div.centered {text-align:center;} /*work around for IE centering with CSS problem part 1 */
div.centered table {margin-left:auto; margin-right:auto; text-align:left;} /* work around for IE problem part 2 */
body{margin-left: 10%;
margin-right: 10%;
}
hr.large {width: 65%; margin-top: 2em; margin-bottom: 2em;}
hr.small {width: 45%; margin-top: 2em; margin-bottom: 2em;}
.pagenum { /* uncomment the next line for invisible page numbers */
/* visibility: hidden; */
position: absolute;
left: 92%;
font-size: smaller;
text-align: right;
} /* page numbers */
.sidenote {width: 20%; padding-bottom: .5em; padding-top: .5em;
padding-left: .5em; padding-right: .5em; margin-left: 1em;
float: right; clear: right; margin-top: 1em;
font-size: smaller; color: black; background: #eeeeee; border: solid 1px;}
.n {text-indent:0%;}
.bl {border-left: solid 2px;}
.ispace {margin-top: 2em;}
.center {text-align: center;}
.smcap {font-variant: small-caps;}
.caption {font-weight: bold;}
.figcenter {margin: auto; text-align: center;}
.footnote {margin-left: 10%; margin-right: 10%; font-size: 0.9em;}
.fnanchor {vertical-align: super; font-size: .8em; text-decoration: none;}
.gap {margin-top: 4em;}
.smallgap {margin-top: 2em;}
.poem {margin-left:10%; margin-right:10%; text-align: left;}
.poem br {display: none;}
.poem .stanza {margin: 1em 0em 1em 0em;}
.poem span.i4 {display: block; margin-left: 4em; padding-left: 3em; text-indent: -3em;}
// -->
/* XML end ]]>*/
</style>
</head>
<body>
<h2>Lorem Ipsum</h2>
<h1>Ipsum, Lorem</h1>
<div id="lipsum">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam massa enim, tincidunt non hendrerit eget, malesuada et nisi. In hac habitasse platea dictumst. Praesent nec laoreet ante. Aenean tempus nisi in erat tempus tempus. Vestibulum imperdiet lobortis sapien eu tempus. Vivamus volutpat quam sed eros molestie vitae dignissim nulla ultricies. Vivamus dictum elit velit. Pellentesque pellentesque ornare ornare. Mauris vel gravida sapien. Praesent eleifend tristique ipsum nec tempor. Vestibulum cursus eleifend tellus, a egestas lectus euismod sed.
</p>
<p>
Duis nec massa quam. Nulla porta, enim ut consequat tincidunt, quam tortor consequat enim, eu interdum eros lorem eu turpis. Cras vestibulum orci quis felis tristique quis semper sem imperdiet. Sed mattis tincidunt risus scelerisque scelerisque. Aliquam nisl quam, bibendum quis luctus eu, sodales ut felis. Integer id turpis nisi. Phasellus mattis nulla eu odio faucibus a auctor orci tristique. Nulla ullamcorper, risus nec semper accumsan, libero lacus aliquet elit, quis lacinia metus nunc vestibulum turpis. Suspendisse vel sapien vel magna auctor aliquam. Aenean fringilla fringilla metus non imperdiet. Aliquam nisl lacus, tempus vitae commodo non, accumsan ut lectus. Nam in urna eu neque pretium aliquam. Maecenas sit amet urna lectus. Donec vitae metus enim.
</p>
<p>
Sed lacus nulla, faucibus eget ullamcorper ut, mollis at metus. Vivamus tortor felis, tincidunt at tristique ut, tincidunt feugiat velit. Ut euismod felis non urna luctus luctus. Integer nec urna massa. Mauris vestibulum hendrerit auctor. Morbi at tellus nec arcu scelerisque rhoncus. Phasellus facilisis interdum lorem vulputate posuere. Nullam quis felis est. Aenean metus augue, tempus non ultricies et, dapibus vel felis. Pellentesque at augue velit. Nulla erat nisi, posuere eu pellentesque id, pretium ac libero. Phasellus tincidunt sollicitudin sapien at mollis. Nullam et libero velit, nec tincidunt eros. Aliquam et sem elit. Quisque suscipit orci enim, vel aliquam nisi. Suspendisse in enim a ligula blandit volutpat in id velit.
</p>
<p>
Nam tempor neque nec ligula sollicitudin rhoncus. Etiam et lorem vel odio pharetra interdum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In imperdiet nisi sed diam rutrum gravida in vel massa. Nam ullamcorper ultrices diam, vitae consequat lacus consequat consequat. Curabitur laoreet leo sed tortor fringilla nec euismod libero lobortis. Donec non enim lectus. Suspendisse potenti. In hac habitasse platea dictumst. Fusce semper auctor neque nec lobortis. Praesent vitae mauris turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sed pharetra odio. Suspendisse potenti. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis eget odio purus, quis dapibus massa.
</p>
<p>
Curabitur ut dapibus eros. Donec tempor, felis ac facilisis bibendum, nisi purus pellentesque sem, sollicitudin tempor lectus nulla at mi. Maecenas quis urna ut ante pulvinar pellentesque. Duis auctor imperdiet suscipit. Pellentesque dui nulla, volutpat quis posuere a, gravida ornare augue. Proin nec felis pharetra magna pellentesque facilisis. Curabitur lacus libero, malesuada sed tincidunt ac, aliquet ut tortor. Etiam gravida lorem nulla, consectetur eleifend risus. Donec facilisis, turpis laoreet imperdiet laoreet, purus justo egestas nulla, et hendrerit leo eros at orci. Nunc vulputate mauris sit amet sapien accumsan nec euismod orci volutpat. Sed ultricies velit ut lorem venenatis in convallis tellus imperdiet. Aenean auctor ultrices est ultricies rhoncus. Phasellus non magna a leo luctus fermentum nec fermentum erat.
</p>
<p>
Sed faucibus nisl quis diam mollis quis varius tortor tincidunt. Phasellus in turpis in tellus consectetur mollis. Donec a neque id metus condimentum dignissim. In hac habitasse platea dictumst. Pellentesque sem nisi, pulvinar nec sagittis vitae, lacinia non tellus. Aliquam dignissim dignissim volutpat. Pellentesque ut quam et mi tincidunt varius id vel quam. Duis consectetur elit ac ligula fringilla elementum. In elementum tellus viverra mi vehicula vitae tempus lectus laoreet. Nullam diam nibh, tincidunt vitae imperdiet a, luctus a felis. In posuere pulvinar volutpat. Pellentesque eget viverra justo.
</p>
<p>
Nullam nec sapien at felis molestie auctor. Sed dignissim erat eu nulla ullamcorper mattis. Curabitur felis sem, feugiat non semper ut, sollicitudin sed ipsum. Quisque cursus laoreet turpis, sit amet molestie neque consequat at. Vestibulum eu ligula quis nisl pulvinar rhoncus. Praesent faucibus, dolor in elementum ullamcorper, tellus ante mattis risus, ac imperdiet eros eros quis risus. Praesent luctus libero a diam pharetra eget placerat risus pulvinar. Donec sollicitudin pulvinar velit vel pellentesque. Quisque sagittis leo ac mauris congue adipiscing. In tempus facilisis facilisis. Aliquam erat volutpat. Suspendisse sagittis libero ipsum.
</p>
<p>
Aliquam at cursus ipsum. Vivamus purus mi, pretium at molestie id, dictum in quam. Proin egestas auctor iaculis. Maecenas sodales facilisis tellus eu bibendum. Vestibulum varius vehicula scelerisque. Praesent condimentum varius commodo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec sem nisl, sagittis eu euismod non, tempor nec magna. Fusce sed auctor nisl. Phasellus porttitor sagittis est, sit amet eleifend elit dignissim et. Nam consectetur elementum elit non egestas. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum a ultricies neque. Integer hendrerit nisi id dolor porta quis venenatis lacus dignissim. In vitae fringilla magna.
</p>
<p>
Fusce ultrices scelerisque felis, id semper quam posuere a. Sed nec erat eget velit euismod condimentum a in enim. Maecenas bibendum aliquam tincidunt. Mauris vestibulum neque at nulla sagittis id lacinia enim fermentum. Quisque adipiscing risus nec massa auctor condimentum. Mauris venenatis lacus justo, eu varius odio. Fusce commodo luctus felis, vitae lobortis lectus facilisis id. Nunc faucibus vestibulum urna et lacinia. Cras ornare quam neque, non gravida sapien. Cras porta, diam sit amet laoreet rutrum, massa erat commodo diam, eu rhoncus nisl massa ac metus. In sem mauris, venenatis nec euismod ac, suscipit condimentum neque. Quisque pretium blandit lectus, ut aliquet neque rhoncus eu. Vivamus ultrices porttitor tincidunt. Curabitur ut ipsum non ipsum ultrices tincidunt. Integer scelerisque augue nec nisl varius tristique. Morbi condimentum rutrum sodales. Pellentesque odio mauris, porttitor ac sollicitudin in, ultrices ut diam.
</p>
<p>
Sed congue adipiscing orci a pellentesque. Etiam quis neque eu nulla viverra egestas. Ut ultricies dui non enim rhoncus laoreet. Nulla molestie nibh non erat venenatis gravida. Pellentesque faucibus sem sit amet risus tincidunt non ultrices diam auctor. Praesent quis libero et tellus tempor molestie. Mauris ullamcorper feugiat libero sed elementum. Donec eget nunc eget diam hendrerit pulvinar. Ut ut imperdiet enim. Vestibulum sed quam lorem. Nunc ipsum massa, venenatis eget condimentum at, ornare id ante. Vestibulum ornare volutpat tincidunt. Etiam a eros erat. Curabitur lobortis, nisi a malesuada tincidunt, nisi enim congue eros, in dictum elit odio at nunc. Nam hendrerit porta velit a viverra.
</p>
<p>
Etiam vel velit urna. Donec commodo aliquet magna rhoncus pretium. Donec fermentum orci in diam dictum non pulvinar mi tristique. Morbi urna libero, sagittis vel facilisis nec, ornare vitae nunc. Pellentesque laoreet mi a mi condimentum sagittis. Donec eleifend, nisi sit amet tincidunt sollicitudin, leo magna accumsan elit, at adipiscing velit lacus id purus. Aenean nunc sapien, egestas vitae pretium viverra, bibendum vel tellus. Maecenas mattis dui ac justo facilisis sollicitudin. Proin in mi ac lacus hendrerit congue ac vitae elit. Aliquam erat volutpat. In hac habitasse platea dictumst. Phasellus dapibus diam vel velit consectetur tempor. Maecenas viverra suscipit bibendum. Sed non enim neque.
</p>
<p>
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Phasellus at odio et odio volutpat egestas. Fusce non pellentesque felis. Nunc fermentum posuere sem quis egestas. Integer nec orci vel eros fringilla bibendum. Praesent placerat molestie elit at mattis. Nunc rutrum faucibus arcu non bibendum. Vestibulum at sapien sit amet sem iaculis congue. Morbi tempus, libero vitae interdum suscipit, lacus ipsum suscipit quam, non pretium nulla orci eget dui. Praesent et nisl turpis, ultricies convallis quam. In tempor urna et eros aliquet accumsan. Phasellus lobortis bibendum libero sit amet viverra. Aenean consectetur, neque eu cursus posuere, est leo molestie dui, sit amet vulputate mi erat eu tortor. Suspendisse arcu velit, porta sit amet adipiscing sed, ultrices id urna. In hendrerit iaculis massa in pretium. Vivamus eros augue, venenatis non hendrerit a, bibendum in tortor. Fusce et mauris lorem, vitae semper ligula. Nam iaculis, eros eu varius varius, orci sapien rhoncus arcu, et luctus urna lectus non quam. Donec gravida convallis justo at bibendum. Quisque non est velit, sed laoreet augue.
</p>
</div>
</body>
</html>

@ -15,10 +15,9 @@ $config['currency'] = "USD";
$config['token_url'] = "https://api.paypal.com/v1/oauth2/token";
$config['web_profiles_url'] = "https://api.paypal.com/v1/payment-experience/web-profiles/";
$config['webhooks_url'] = "https://api.paypal.com/v1/notifications/webhooks";
$config['payment_url'] = "https://api.paypal.com/v1/payments/payment/";
$config['sale_url'] = "https://api.paypal.com/v1/payments/sale/";
// $config['activities_url'] = "https://api.paypal.com/v1/activities/activities";
// $config['reporting_url'] = "https://api.paypal.com/v1/reporting/transactions";
$config['payment_url'] = "https://api.paypal.com/v1/payments/payment";
$config['sale_url'] = "https://api.paypal.com/v1/payments/sale";
$config['activities_url'] = "https://api.paypal.com/v1/activities/activities";
$config['return_url'] = "https://www.chinahighlights.com";
$config['cancel_url'] = "https://www.chinahighlights.com";

@ -0,0 +1,25 @@
<?php
$config["sign_type"] = "HMAC-SHA256";
$config["trade_type"] = "NATIVE";
$config["notify_url"] = "";
$config["currency"] = "CNY";
$config["currency_unit"] = 100;
$config["method_code"] = 15016;
/*!
* 各账号的设置
*/
// test
$config['test']["app_id"] = "wx426b3015555a46be";
$config['test']["mch_id"] = "1900009851";
$config['test']["key"] = "8934e7d15453e97507ef794cf7b0519d";
$config['test']["app_secret"] = "7813490da6f1265e4901ffb80afaa36f";
// Trippest
$config['trippest']["app_id"] = "";
$config['trippest']["mch_id"] = "";
$config['trippest']["key"] = "";
$config['trippest']["app_secret"] = "";
// ChinaHighlights = China train booking
$config['cht']["app_id"] = "";
$config['cht']["mch_id"] = "";
$config['cht']["key"] = "";
$config['cht']["app_secret"] = "";

@ -92,6 +92,7 @@ class AlipayTradeService extends CI_Controller
*/
public function alipay_notice()
{
error_reporting(0);
$resp_arr = $this->input->post();
$asyns_resp = $this->check($resp_arr);
// 未得到结果
@ -99,29 +100,55 @@ class AlipayTradeService extends CI_Controller
echo "failed";
return;
}
if (true === $this->if_note_exists($asyns_resp->data->trade_no)) {
if ( isset($asyns_resp->data->refund_fee) && true === $this->if_note_exists($asyns_resp->data->out_biz_no) ) {
echo "success";
return;
} else if ( ! isset($asyns_resp->data->refund_fee) && true === $this->if_note_exists($asyns_resp->data->trade_no)) {
echo "success";
return;
}
$notify_type = "pay";
if (isset($asyns_resp->data->refund_fee)) {
$notify_type = "refund";
}
$code = isset($asyns_resp->data->code) ? strval($asyns_resp->data->code) : NULL ;
$buyer = isset($asyns_resp->data->buyer_logon_id) ? strval($asyns_resp->data->buyer_logon_id) : NULL ;
if (strcmp(strval($asyns_resp->data->trade_status), "TRADE_SUCCESS") == 0) {
$this->Alipay_note_model->save_alipay(
strval($asyns_resp->data->trade_no)
,strval($asyns_resp->data->out_trade_no)
,"CNY"
,strval($asyns_resp->data->total_amount)
,NULL
,NULL
,strval($asyns_resp->data->gmt_create)
,strval($asyns_resp->data->gmt_payment)
,json_encode($asyns_resp->data)
,strval("pay")
,$code
,strval($asyns_resp->data->trade_status)
,NULL
,$buyer
);
if (strcmp(trim(strval($asyns_resp->data->trade_status)), "TRADE_SUCCESS") == 0) {
if ($notify_type === "pay") {
$this->Alipay_note_model->save_alipay(
strval($asyns_resp->data->trade_no)
,strval($asyns_resp->data->out_trade_no)
,"CNY"
,strval($asyns_resp->data->total_amount)
,NULL
,NULL
,strval($asyns_resp->data->gmt_create)
,strval($asyns_resp->data->gmt_payment)
,json_encode($asyns_resp->data)
,$notify_type
,$code
,strval($asyns_resp->data->trade_status)
,NULL
,$buyer
);
} else if ($notify_type == "refund") {
$this->Alipay_note_model->save_alipay(
strval($asyns_resp->data->out_biz_no)
,strval($asyns_resp->data->out_trade_no)
,"CNY"
,"-" . strval($asyns_resp->data->refund_fee)
,NULL
,NULL
,strval($asyns_resp->data->gmt_refund)
,strval($asyns_resp->data->notify_time)
,json_encode($asyns_resp->data)
,$notify_type
,$code
,strval($asyns_resp->data->trade_status)
,NULL
,$buyer
);
}
// 查询payer
// $this->AlipayTradeQueryContentBuilder->setTradeNo($asyns_resp->data->trade_no);
// if ($asyns_resp->data->out_trade_no) {
@ -325,7 +352,7 @@ class AlipayTradeService extends CI_Controller
}
//退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理
if ($item->ALI_payType == 'Refunded') {
if ($item->ALI_payType == 'refund') {
$this->Alipay_note_model->update_send($item->ALI_dealId, 'send');
continue;
}
@ -369,11 +396,11 @@ class AlipayTradeService extends CI_Controller
$this->Alipay_note_model->update_send($item->ALI_dealId, 'send');
continue;
}
//添加支付信息入库
//没有分配订单之前先添加付款记录,这个过程可能会执行多次,必须在添加记录前查找是否有数据
if (!empty($orderid_info)) {
$currencyCode = str_replace("CNY", "RMB", trim(mb_strtoupper($item->ALI_currencyCode)));
$ssje = $this->Alipay_model->get_ssje($item->ALI_orderAmount, $currencyCode);
$USD_amount = $this->Alipay_model->get_USD($item->ALI_orderAmount, $currencyCode);
//更新还没有填的客邮和交易号de收款记录商务订单
if (isset($advisor_info->order_type) && $advisor_info->order_type == 0) {
@ -385,8 +412,14 @@ class AlipayTradeService extends CI_Controller
// $this->Alipay_model->add_account_info_forAPP($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, '', $item->pn_payer_email, $item->ALI_dealId, $ht_memo);
// if ($advisor_info->COLI_WebCode == 'CHTAPP' && $advisor_info->COLI_State == 11) { //只修改APP组的订单状态并且订单进度是我的订单
// $this->Alipay_model->update_biz_coli_state($GAI_COLI_SN, 8); //把订单状态改为已付款
// $this->Alipay_model->insert_biz_order_log($GAI_COLI_SN, 'BS8');
// }
} else {
// 把订单状态设置为13-新订单已支付
if (false == $this->Alipay_model->if_biz_gai_exists($item->ALI_dealId) ) {
$this->Alipay_model->update_biz_coli_state($GAI_COLI_SN, 13);
$this->Alipay_model->insert_biz_order_log($GAI_COLI_SN, 'BS13');
}
$this->Alipay_model->add_account_info(
$GAI_COLI_SN,
$advisor_info->COLI_ID,
@ -394,6 +427,7 @@ class AlipayTradeService extends CI_Controller
$item->ALI_completeTime,
$currencyCode,
$USD_amount,
$ssje,
$item->ALI_completeTime,
$item->ALI_completeTime,
$item->ALI_acquiringTime,
@ -402,17 +436,20 @@ class AlipayTradeService extends CI_Controller
$item->ALI_dealId,
$ht_memo
);
// 更新订单主表付款方式,防止没访问thankyou-train.asp
$this->Alipay_model->update_paymanner($GAI_COLI_SN);
}
}
//更新还没有填的客邮和交易号de收款记录传统订单
elseif (isset($advisor_info->order_type) && $advisor_info->order_type == 1) {
$ht_memo = '交易号(自动录入):' . $item->ALI_dealId;
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
$this->Alipay_model->add_tour_account_info(
$gai_sn = $this->Alipay_model->add_tour_account_info(
$GAI_COLI_SN,
$item->ALI_orderAmount,
$item->ALI_acquiringTime,
$currencyCode,
$ssje,
$item->ALI_completeTime,
$item->ALI_completeTime,
$item->ALI_acquiringTime,
@ -423,6 +460,8 @@ class AlipayTradeService extends CI_Controller
);
//添加汉特的订单提醒
$this->Alipay_model->update_coli_introduction($GAI_COLI_SN, '已支付 ' . mb_strtoupper($item->ALI_currencyCode) . $item->ALI_orderAmount);
// 添加HT任务
$this->Alipay_model->exec_addToTask($gai_sn);
}
}
@ -470,29 +509,24 @@ class AlipayTradeService extends CI_Controller
$request = new AlipayTradeQueryRequest();
$request->setBizContent ( $biz_content );
$response = $this->aopclientRequestExecute ($request,true);
$response = $this->aopclientRequestExecute ($request);
$response = $response->alipay_trade_query_response;
return $response;
}
public function query_pay($dealId,$orderId=NULL)
public function query_pay($dealId=NULL,$orderId=NULL)
{
if ($dealId === NULL) {
$dealId = $this->input->get_post('dealid');
$dealId = trim($dealId);
}
$this->AlipayTradeQueryContentBuilder->setTradeNo($dealId);
if ($orderId) {
$this->AlipayTradeQueryContentBuilder->setOutTradeNo($orderId);
}
$response = $this->Query($this->AlipayTradeQueryContentBuilder);
if ( strcmp(trim($response->code), "10000")) {
log_message('error',"Alipay query failed! error code:".$response->code."; result Msg: ".$response->msg.'; orderId:'.$response->out_trade_no.'; dealId:'.$response->trade_no."; ");
}
$html = '<table>';
foreach ($response as $key => $value) {
$html .= "<tr><td>$key</td><td>$value</td>";
}
$html .= '</table>';
echo $html;
return;
return $response;
}
/*!
@ -577,6 +611,7 @@ var_dump($response->$responseNode);
public function note_list()
{
$this->permission->is_admin(true);
$data = array();
$data["paytext"] = $this->payment_status();
$data["keywords"] = $this->input->get_post("keywords");
@ -584,6 +619,30 @@ var_dump($response->$responseNode);
empty($data['date']) ? $data['date'] = date('Y-m-d') : false;
if (!empty($data['keywords'])) {
$data['notelist'] = $this->Alipay_note_model->search_key($data['keywords']);
/** 手动查询通过收钱码的收款, 必须输入交易号 */
if (empty($data['notelist'])) {
$query_pay = $this->query_pay($data["keywords"]);
if ( ! empty($query_pay) && strval($query_pay->code)==="10000" && strval($query_pay->trade_status)==="TRADE_SUCCESS") {
$pay_type = $query_pay->total_amount>0 ? "pay" : "refund";
$new_record = $this->Alipay_note_model->save_alipay(
strval($query_pay->trade_no)
,strval($query_pay->out_trade_no)
,"CNY"
,strval($query_pay->total_amount)
,NULL
,NULL
,strval($query_pay->send_pay_date)
,strval($query_pay->send_pay_date)
,json_encode($query_pay)
,$pay_type
,NULL
,strval($query_pay->trade_status)
,NULL
,strval($query_pay->buyer_logon_id)
);
$data['notelist'][] = $new_record;
}
}
} else {
$data['notelist'] = $this->Alipay_note_model->search_date($data['date']);
}
@ -592,6 +651,7 @@ var_dump($response->$responseNode);
}
//失败记录列表
public function note_faillist() {
$this->permission->is_admin(true);
$data = array();
$data["paytext"] = $this->payment_status();
//有关键词则不限制日期
@ -613,6 +673,7 @@ var_dump($response->$responseNode);
//获取note详情以便后续修改各项数据
public function note_modal($pn_txn_id = false, $pn_invoice = false ,$notice_time = false) {
$this->permission->is_admin(true);
$data = array();
$data['IPL_orderId'] = $pn_invoice;
if (!empty($pn_txn_id)) {
@ -701,6 +762,7 @@ var_dump($response->$responseNode);
return array(
"WAIT_BUYER_PAY" => "Pending",
"TRADE_SUCCESS" => "Payment success",
"TRADE_CLOSED" => "Payment closed",
"TRADE_FINISHED" => "Payment success"
);
}

@ -0,0 +1,43 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class PaymentService extends CI_Controller {
public function __construct(){
parent::__construct();
bcscale(2);
$this->load->helper('payment');
// $this->config->load('wxpay', true);
$this->load->model('Online_payment_note_model', 'note_model');
$this->load->model('Online_payment_account_model', 'account_model');
}
public function index()
{
}
public function send_notify($payment_method=NULL, $transactionId=NULL)
{
// $save_column['OPN_accountType'] = $xml_arr[''];
// $save_column['OPN_accountStatus'] = $xml_arr[''];
// $save_column['OPN_accountTime'] = $xml_arr[''];
$data = array();
$int = 0;
//优先处理指定的交易号,用于修正交易号直接发送通知
if ( ! empty($transactionId)) {
$data['unsend_list'] = $this->note_model->get_note($payment_method, $transactionId);
}
// 待处理的
if (empty($data['unsend_list'])) {
$data['unsend_list'] = $this->note_model->unsend_note($payment_method, 10);
}
//没有未处理的数据再查找处理失败的数据
if (empty($data['unsend_list'])) {
$data['unsend_list'] = $this->note_model->sendfail_note($payment_method, 20);
}
}
}

@ -0,0 +1,153 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
global $__WX_SITE_NAME__;
class WxpayService extends CI_Controller {
protected $wx_site_config;
public function __construct(){
parent::__construct();
bcscale(2);
$this->load->helper('payment');
$this->config->load('wxpay', true);
$this->load->model('Online_payment_note_model', 'note_model');
$this->load->model('Online_payment_account_model', 'account_model');
}
public function index()
{
}
public function notify($site='cht')
{
log_message('error','notify begin ----');
$response['return_code'] = 'FAIL';
$response['return_msg'] = '';
$GLOBALS['__WX_SITE_NAME__'] = $site;
$this->wx_site_config = $this->config->item($GLOBALS['__WX_SITE_NAME__'], 'wxpay');
if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
# 如果没有数据,直接返回失败
return $this->response_to_wx($response);
}
//获取通知的数据
$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
$xml_arr = from_xml($xml);
// log_message('error',var_export($xml_arr, 1));
if ($this->check_sign($xml_arr) !== true) {
return $this->response_to_wx($response);
}
// 入库保存异步通知
if ( strval($xml_arr['result_code']) !== "SUCCESS" ) {
$response['return_code'] = 'SUCCESS';
$response['return_msg'] = 'OK';
} else {
$xml_arr['total_fee'] = bcdiv($xml_arr['total_fee'], $this->config->item('currency_unit', 'wxpay'));
$ssje = $this->account_model->get_ssje($xml_arr['total_fee'], $xml_arr['fee_type'], $this->config->item('currency_unit', 'wxpay'));
$save_column = array();
$save_column['OPN_transactionId'] = $xml_arr['transaction_id'];
$save_column['OPN_orderId'] = $xml_arr['out_trade_no'];
$save_column['OPN_rawOrderId'] = $xml_arr['out_trade_no'];
$save_column['OPN_invoiceId'] = $xml_arr['out_trade_no'];
$save_column['OPN_subject'] = $xml_arr['attach'];
$save_column['OPN_currency'] = $xml_arr['fee_type'];
$save_column['OPN_orderAmount'] = $xml_arr['total_fee'];
$save_column['OPN_payAmount'] = $xml_arr['total_fee'];
$save_column['OPn_transactionResult'] = 'completed';
$save_column['OPN_resultCode'] = $xml_arr['result_code'];
$save_column['OPN_resultMsg'] = isset($xml_arr['return_msg']) ? $xml_arr['return_msg'] : $xml_arr['result_code'];
$save_column['OPN_errCode'] = isset($xml_arr['err_code']) ? $xml_arr['err_code'] : NULL;
$save_column['OPN_errMsg'] = isset($xml_arr['err_code_des']) ? $xml_arr['err_code_des'] : NULL;
$save_column['OPN_acquiringTime'] = date('Y-m-d H:i:s',strtotime($xml_arr['time_end']));
$save_column['OPN_completeTime'] = date('Y-m-d H:i:s',strtotime($xml_arr['time_end']));
$save_column['OPN_remark'] = $xml_arr['attach'];
$save_column['OPN_payerLogId'] = $xml_arr['openid'];
$save_column['OPN_payerStatus'] = $xml_arr['is_subscribe']==='Y' ? "subscribed" : NULL;
$save_column['OPN_fundSource'] = $xml_arr['bank_type'];
$save_column['OPN_entryAmountCNY'] = floatval($ssje);
$save_column['OPN_rawContent'] = json_encode($xml_arr);
$save_column['OPN_noticeTime'] = date('Y-m-d H:i:s');
// $save_column['OPN_noticeType'] = intval($xml_arr['total_fee'])>0 ? 'pay' : 'refund';
$save_column['OPN_noticeType'] = 'pay';
$save_column['OPN_noticeSendStatus'] = 'unsend';
$save_column['OPN_noticeSendTime'] = NULL;
$save_column['OPN_accountMethod'] = $this->config->item('method_code', 'wxpay');
if ( $this->note_model->insert_note($save_column) ) {
$response['return_code'] = 'SUCCESS';
$response['return_msg'] = 'OK';
}
}
return $this->response_to_wx($response);
}
public function response_to_wx($response_arr)
{
$response_body = to_xml($response_arr);
// log_message('error',var_export($response_body, 1));
echo $response_body;
# exit(); // end
}
public function check_sign($xml_arr)
{
if ( ! array_key_exists('sign', $xml_arr)) {
log_message('error','Wxpay notify error: no sign.');
return false;
}
if ($this->make_sign($xml_arr) !== $xml_arr['sign']) {
log_message('error','Wxpay notify error: sign.');
return false;
}
if ($this->wx_site_config['app_id'] !== $xml_arr['appid']) {
log_message('error','Wxpay notify error: appid.');
return false;
}
if ($this->wx_site_config['mch_id'] !== $xml_arr['mch_id']) {
log_message('error','Wxpay notify error: mch_id.');
return false;
}
return true;
}
public function make_sign($xml_arr, $needSignType = false)
{
//签名步骤一:按字典序排序参数
ksort($xml_arr);
$string = $this->to_url_params($xml_arr);
//签名步骤二在string后加入KEY
$string = $string . "&key=" . $this->wx_site_config['key'];
//签名步骤三MD5加密或者HMAC-SHA256
if(strlen($xml_arr['sign']) <= 32){
//如果签名小于等于32个,则使用md5验证
$string = md5($string);
} else {
//是用sha256校验
$string = hash_hmac("sha256", $string , $this->wx_site_config['key']);
}
//签名步骤四:所有字符转为大写
$result = strtoupper($string);
// log_message('error',$result);
return $result;
}
/**
* 格式化参数格式化成url参数
*/
public function to_url_params($xml_arr)
{
$buff = "";
foreach ($xml_arr as $k => $v)
{
if($k != "sign" && $v != "" && !is_array($v)){
$buff .= $k . "=" . $v . "&";
}
}
$buff = trim($buff, "&");
return $buff;
}
}

@ -60,8 +60,9 @@ class IPayLinksService extends CI_Controller
$this->note_list();
}
public function note_list()
public function note_list2()
{
$this->permission->is_admin(true);
$data = array();
$data["paytext"] = $this->payment_status();
$data["keywords"] = $this->input->get_post("keywords");
@ -76,8 +77,26 @@ class IPayLinksService extends CI_Controller
return;
}
public function note_list()
{
$this->permission->is_admin(true);
$data = array();
$data["paytext"] = $this->payment_status();
$data["keywords"] = $this->input->get_post("keywords");
$data["date"] = $this->input->get_post("date");
empty($data['date']) ? $data['date'] = date('Y-m-d') : false;
if (!empty($data['keywords'])) {
$data['notelist'] = $this->Note_model->search_key2($data['keywords']);
} else {
$data['notelist'] = $this->Note_model->search_date2($data['date']);
}
$this->load->view("iPayLinks_list2",$data);
return;
}
//失败记录列表
public function note_faillist() {
$this->permission->is_admin(true);
$data = array();
$data["paytext"] = $this->payment_status();
//有关键词则不限制日期
@ -257,18 +276,50 @@ class IPayLinksService extends CI_Controller
return;
}
public function query_pay($orderid,$day_offset = 3)
public function query_pay($orderid=NULL)
{
$this->query_info_arr["queryOrderId"] = $this->create_guid();
$this->query_info_arr["orderId"] = $orderid;
$this->query_info_arr["mode"] = 1;
// $this->query_info_arr["type"] = $day_offset; // 1-支付;2-退款
$this->query_info_arr["signMsg"] = $this->generate_sign($this->query_info_arr);
$resp = $this->curl($this->queryUrl,$this->query_info_arr);
$resp_obj = simplexml_load_string($resp);
$this->output->set_content_type('application/json')->set_output(json_encode(simplexml_load_string($resp)));
return;
}
public function query_refund($refund_order_id)
{
$this->query_info_arr["queryOrderId"] = $this->create_guid();
$this->query_info_arr["orderId"] = $refund_order_id;
$this->query_info_arr['mode'] = '1';
$this->query_info_arr['type'] = '2';
$this->query_info_arr["signMsg"] = $this->generate_sign($this->query_info_arr);
$resp = $this->curl($this->queryUrl,$this->query_info_arr);
$resp_obj = simplexml_load_string($resp);
$this->output->set_content_type('application/json')->set_output(json_encode(simplexml_load_string($resp)));
return;
}
public function query_pay_list($day_offset = 3)
{
$this->query_info_arr["queryOrderId"] = $this->create_guid();
$this->query_info_arr["beginTime"] = date('YmdHis',strtotime("-$day_offset days"));
$this->query_info_arr["endTime"] = date('YmdHis',strtotime("+$day_offset days"));
$this->query_info_arr["mode"] = 1;
$this->query_info_arr["endTime"] = date('YmdHis235959');
$this->query_info_arr["mode"] = 2;
$this->query_info_arr["type"] = 1; // 1-支付;2-退款
$this->query_info_arr["signMsg"] = $this->generate_sign($this->query_info_arr);
$resp = $this->curl($this->queryUrl,$this->query_info_arr);
// echo $resp;
var_export($resp);
$resp_obj = simplexml_load_string($resp);
// foreach ($resp_obj->details->detail as $key => $query_order) {
// $order = new stdClass();
// $order->check = true;
// $order->data = $query_order;
// $this->ipaylinks_notice($order);
// }
$this->output->set_content_type('application/json')->set_output(json_encode(simplexml_load_string($resp)));
return;
}
@ -313,7 +364,7 @@ class IPayLinksService extends CI_Controller
* @date 2017-08-29
* @param string $orderid 订单号
*/
public function batch_send_note($pn_txn_id = false)
public function batch_send_note($pn_txn_id = false, $old_ssje=NULL)
{
$data = array();
$int = 0;
@ -335,19 +386,19 @@ class IPayLinksService extends CI_Controller
foreach ($data['unsend_list'] as $item) {
//已经发送的不处理,防止重复发送
if ($item->IPL_sent == 'send') {
if ($item->IPL_sent == 'send' && empty($pn_txn_id)) {
continue;
}
//退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理
if ($item->IPL_payType == 'refund') {
$this->Note_model->update_send($item->IPL_dealId, 'send');
// $this->Note_model->update_send($item->IPL_dealId, 'send');
continue;
}
//只处理完成状态,其他状态由陆燕处理
if (strcmp(trim($item->IPL_resultCode), "0000")) {
$this->Note_model->update_send($item->IPL_dealId, 'send');
if (strcmp(trim($item->IPL_resultCode), "0000") !== 0 ) {
$this->Note_model->update_send($item->IPL_dealId, 'sendfail');
continue;
}
@ -380,16 +431,16 @@ class IPayLinksService extends CI_Controller
$this->Note_model->set_invoice($item->IPL_dealId, $orderid_info->orderid . '_' . $orderid_info->ordertype);
//检测是否是APP订单,默认不处理
if ($orderid_info->ordertype == 'A') { //APP自动出票的订单不需要处理
$this->Note_model->update_send($item->IPL_dealId, 'send');
continue;
}
// if ($orderid_info->ordertype == 'A') { //APP自动出票的订单不需要处理
// $this->Note_model->update_send($item->IPL_dealId, 'send');
// continue;
// }
//添加支付信息入库
//没有分配订单之前先添加付款记录,这个过程可能会执行多次,必须在添加记录前查找是否有数据
if (!empty($orderid_info)) {
$currencyCode = str_replace("CNY", "RMB", trim(mb_strtoupper($item->IPL_currencyCode)));
$ssje = $this->IPayLinks_model->get_ssje($item->IPL_orderAmount, $currencyCode);
$ssje = $old_ssje===NULL ? $ssje : $old_ssje;
//更新还没有填的客邮和交易号de收款记录商务订单
if (isset($advisor_info->order_type) && $advisor_info->order_type == 0) {
$ht_memo = '交易号(自动录入):' . $item->IPL_dealId;
@ -397,11 +448,31 @@ class IPayLinksService extends CI_Controller
//CHTAPP订单添加记录前判断是否有记录以前的APP版本没有交易号只能拿金额来判断
if (substr($advisor_info->COLI_WebCode, 0, 6) == 'CHTAPP') {
//只判断前6位字符CHTAPP-fr CHTAPP-jp等各语种都属于APP订单
// $this->IPayLinks_model->add_account_info_forAPP($GAI_COLI_SN, $advisor_info->COLI_ID, $item->pn_mc_gross, $item->pn_payment_date, mb_strtoupper($item->pn_mc_currency), $item->pn_payment_date, $item->pn_payment_date, $item->pn_payment_date, '', $item->pn_payer_email, $item->IPL_dealId, $ht_memo);
// if ($advisor_info->COLI_WebCode == 'CHTAPP' && $advisor_info->COLI_State == 11) { //只修改APP组的订单状态并且订单进度是我的订单
// $this->IPayLinks_model->update_biz_coli_state($GAI_COLI_SN, 8); //把订单状态改为已付款
// }
$this->IPayLinks_model->add_account_info_forAPP(
$GAI_COLI_SN,
$advisor_info->COLI_ID,
$item->IPL_orderAmount,
$item->IPL_completeTime,
mb_strtoupper($item->currencyCode),
$ssje,
$item->IPL_completeTime,
$item->IPL_completeTime,
$item->IPL_acquiringTime,
$item->IPL_payerName,
$item->IPL_payerEmail,
$item->IPL_dealId,
$ht_memo);
if ($advisor_info->COLI_WebCode == 'CHTAPP' && $advisor_info->COLI_State == 11) {
//只修改APP组的订单状态并且订单进度是我的订单
$this->IPayLinks_model->update_biz_coli_state($GAI_COLI_SN, 8); //把订单状态改为已付款
$this->IPayLinks_model->insert_biz_order_log($GAI_COLI_SN, 'BS8');
}
} else {
// 把订单状态设置为13-新订单已支付
if (false == $this->IPayLinks_model->if_biz_gai_exists($item->IPL_dealId) ) {
$this->IPayLinks_model->update_biz_coli_state($GAI_COLI_SN, 13);
$this->IPayLinks_model->insert_biz_order_log($GAI_COLI_SN, 'BS13');
}
$this->IPayLinks_model->add_account_info(
$GAI_COLI_SN,
$advisor_info->COLI_ID,
@ -418,14 +489,16 @@ class IPayLinksService extends CI_Controller
$ht_memo
);
// 更新订单主表付款方式,防止没访问thankyou-train.asp
$this->IPayLinks_model->update_paymanner($GAI_COLI_SN);
if (empty($advisor_info->COLI_PayManner)) {
$this->IPayLinks_model->update_paymanner($GAI_COLI_SN);
}
}
}
//更新还没有填的客邮和交易号de收款记录传统订单
elseif (isset($advisor_info->order_type) && $advisor_info->order_type == 1) {
$ht_memo = '交易号(自动录入):' . $item->IPL_dealId;
$GAI_COLI_SN = isset($advisor_info->COLI_SN) ? $advisor_info->COLI_SN : 0;
$this->IPayLinks_model->add_tour_account_info(
$gai_sn = $this->IPayLinks_model->add_tour_account_info(
$GAI_COLI_SN,
$item->IPL_orderAmount,
$item->IPL_acquiringTime,
@ -441,6 +514,8 @@ class IPayLinksService extends CI_Controller
);
//添加汉特的订单提醒
$this->IPayLinks_model->update_coli_introduction($GAI_COLI_SN, '已支付 ' . mb_strtoupper($item->IPL_currencyCode) . $item->IPL_orderAmount);
// 添加HT任务
$this->IPayLinks_model->exec_addToTask($gai_sn);
}
}
@ -466,24 +541,25 @@ class IPayLinksService extends CI_Controller
$M_State = 0;
$this->IPayLinks_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'iPayLinks note');
// 2.给客人发邮件,通知账单
$toName2 = !empty($item->IPL_payerName) ? $item->IPL_payerName : '';
$toEmail2 = !empty($item->IPL_payerEmail) ? $item->IPL_payerEmail : '';
// Zac170919039_T订单号 / 996.00USD / iPayLinks
$subject2 = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->IPL_orderAmount . $item->IPL_currencyCode . ' / China Highlights';
// lang
$remark_info = json_decode($item->IPL_memo);
$remark_info = json_decode($remark_info->remark);
$ln = $remark_info->ln;
$ln = $ln ? $ln : "en";
$this->lang->load('ipl_common',$ln);
$this->lang->load('ipl_buyer_email',$ln);
$item->text = $this->lang->language;
// # lang end
$body2 = $this->load->view('receipt_buyer', $item, true);
$M_RelatedInfo2 = $item->IPL_sn;
$M_AddTime2 = $item->IPL_completeTime;
$M_State2 = 0;
$this->IPayLinks_model->save_automail($fromName, $fromEmail, $toName2, $toEmail2, $subject2, $body2, $M_RelatedInfo2, $M_State2, $M_AddTime2, 'China Highlights Has Received Your Payment');
if (empty($pn_txn_id)) {
$toName2 = !empty($item->IPL_payerName) ? $item->IPL_payerName : '';
$toEmail2 = !empty($item->IPL_payerEmail) ? $item->IPL_payerEmail : '';
// Zac170919039_T订单号 / 996.00USD / iPayLinks
$subject2 = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->IPL_orderAmount . $item->IPL_currencyCode . ' / China Highlights';
// lang
$remark_info = json_decode($item->IPL_memo);
(isset($remark_info->remark)) ? $remark_info = json_decode($remark_info->remark) : NULL;
$ln = (isset($remark_info->ln)) ? $remark_info->ln : "en";
$this->lang->load('ipl_common',$ln);
$this->lang->load('ipl_buyer_email',$ln);
$item->text = $this->lang->language;
// # lang end
$body2 = $this->load->view('receipt_buyer', $item, true);
$M_RelatedInfo2 = $item->IPL_sn;
$M_AddTime2 = $item->IPL_completeTime;
$M_State2 = 0;
$this->IPayLinks_model->save_automail($fromName, $fromEmail, $toName2, $toEmail2, $subject2, $body2, $M_RelatedInfo2, $M_State2, $M_AddTime2, 'China Highlights Has Received Your Payment');
}
// ---- 添加邮件发送记录 end
$this->Note_model->update_send($item->IPL_dealId, 'send');
@ -491,7 +567,8 @@ class IPayLinksService extends CI_Controller
}
// 批量结果
if (empty($pn_txn_id)) {
echo "done. recorde count:".$int;
echo "count:" . count($data['unsend_list']);
echo "\r\ndone. recorde count:".$int;
}
return;
}
@ -593,41 +670,54 @@ class IPayLinksService extends CI_Controller
public function ipaylinks_notice($resp=NULL)
{
if ($resp !== NULL) {
$resp_arr = $resp;
$asyns_resp = $resp_arr = $resp;
} else {
$resp_arr = $this->input->post();
log_message('error','iPayLinks asyn notify: ' . $this->input->post("orderId"));
$asyns_resp = $this->verify_sign($resp_arr);
}
$asyns_resp = $this->verify_sign($resp_arr);
log_message('error','iPayLinks asyn notify body: ' . json_encode($asyns_resp->data));
// 未得到结果
if (empty($asyns_resp->data->orderId)) {
echo "200";
return;
}
// if (empty($asyns_resp->data->orderId)) {
// return;
// }
// dealId
$dealId = trim($asyns_resp->data->dealId) ;
$tmp_deal = $dealId ? $dealId : $this->create_guid();
// payer info
$payer_info = json_decode($asyns_resp->data->remark);
$payer_name = $payer_info->n;
$payer_email = $payer_info->e;
if (isset($asyns_resp->data->remark)) {
$payer_info = json_decode($asyns_resp->data->remark);
$payer_name = $payer_info->n;
$payer_email = $payer_info->e;
}
if (true === $this->if_note_exists($dealId)) {
echo "200";
bcscale(2);
/** 退款成功 */
if (isset($asyns_resp->data->refundOrderId) && strcmp($asyns_resp->data->resultCode, '2') == 0) {
$this->Note_model->save_refund(
strval($asyns_resp->data->dealId)
, strval($asyns_resp->data->orderId)
, strval("-" . bcdiv(floatval($asyns_resp->data->refundAmount), 100))
, strval(date('Y-m-d H:i:s',strtotime($asyns_resp->data->refundTime)))
, strval(date('Y-m-d H:i:s',strtotime($asyns_resp->data->completeTime)))
, $asyns_resp->data->resultCode
, null
, json_encode($asyns_resp->data)
, "refund"
);
return;
}
bcscale(2);
// 支付成功
// 查询支付结果;入库处理
if ( ! empty($dealId)) {
// if ( ! empty($dealId)) {
$this->Note_model->save_ipl(
strval($tmp_deal)
,strval($asyns_resp->data->orderId)
,strval($asyns_resp->data->currencyCode)
,strval(bcdiv(floatval($asyns_resp->data->orderAmount), 100))
,NULL
,NULL
,isset($asyns_resp->data->stateCode) ? $asyns_resp->data->stateCode : NULL
,strval(date('Y-m-d H:i:s',strtotime($asyns_resp->data->acquiringTime)))
,strval(date('Y-m-d H:i:s',strtotime($asyns_resp->data->completeTime)))
,json_encode($asyns_resp->data)
@ -637,10 +727,11 @@ class IPayLinksService extends CI_Controller
,strval($payer_name)
,strval($payer_email)
);
$query = $this->query_pay_result($asyns_resp->data);
}
if (strval($asyns_resp->data->resultCode) === "0000") {
$query = $this->query_pay_result($asyns_resp->data);
}
// }
// 返回状态码200
echo "200";
return;
}
@ -862,12 +953,97 @@ class IPayLinksService extends CI_Controller
);
}
public function gai_modal($pn_txn_id=null, $pn_invoice=null, $pn_id = null, $neworder=null)
{
$this->permission->is_admin(true);
$data = array();
$data['note'] = $this->Note_model->note($pn_txn_id, $pn_id);
$orderid_info = $this->analysis_orderid($pn_invoice);
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
if ($orderid_info->ordertype === 'T') {
$data['gai_info'] = $this->IPayLinks_model->get_money_t($pn_txn_id);
} elseif ($orderid_info->ordertype === 'B') {
$data['gai_info'] = $this->IPayLinks_model->get_money_b($pn_txn_id);
}
}
$data['old_order'] = $pn_invoice;
$data['new_order'] = $neworder;
$data['order_info'] = null;
if ($neworder !== null) {
$neworder_id = $this->analysis_orderid($neworder);
$neworder_id = json_decode($neworder_id);
if ( ! empty($neworder_id)) {
$data['order_info'] = $this->IPayLinks_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype);
}
}
echo json_encode($this->load->view('gai_setting', $data, true));
}
public function gai_modal_save()
{
$data = array();
$old_ssje = NULL;
$pn_txn_id = $this->input->post('pn_txn_id');
$pn_id = $this->input->post('pn_id');
$neworder = $this->input->post('pn_invoice');
$data['note'] = $this->Note_model->note($pn_txn_id, $pn_id);
$orderid_info = $this->analysis_orderid($data['note']->IPL_orderId);
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
if ($orderid_info->ordertype === 'T') {
$data['gai_info'] = $this->IPayLinks_model->get_money_t($pn_txn_id);
if ( ! empty($data['gai_info'])) {
$old_ssje = $data['gai_info'][0]->GAI_SSJE;
$this->IPayLinks_model->delete_money_t($pn_txn_id);
}
} elseif ($orderid_info->ordertype === 'B') {
$data['gai_info'] = $this->IPayLinks_model->get_money_b($pn_txn_id);
if ( ! empty($data['gai_info'])) {
$old_ssje = $data['gai_info'][0]->GAI_SSJE;
$this->IPayLinks_model->delete_money_b($pn_txn_id);
}
}
}
if (!empty($pn_txn_id) && !empty($neworder)) {
$orderid_info = $this->analysis_orderid($neworder);
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
$advisor_info = $this->IPayLinks_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
if (!empty($advisor_info)) {
$this->Note_model->set_invoice($pn_txn_id, $neworder);
$this->batch_send_note($pn_txn_id, $old_ssje);
echo json_encode('修改成功!');
return true;
}
}
}
echo json_encode('没找到数据!');
return;
}
public function closeGai($pn_txn_id)
{
$data = array();
$data['note'] = $this->Note_model->note($pn_txn_id);
if (!empty($data['note'])) {
$this->Note_model->update_send($pn_txn_id, 'closeRecord');
echo json_encode('该收款记录已经忽略!');
return true;
}
echo json_encode('没找到数据!');
return;
}
//获取note详情以便后续修改各项数据
public function note_modal($pn_txn_id = false, $pn_invoice = false ,$notice_time = false) {
public function note_modal($pn_txn_id = false, $pn_invoice = false, $pn_id = null) {
$this->permission->is_admin(true);
$data = array();
$data['IPL_orderId'] = $pn_invoice;
if (!empty($pn_txn_id)) {
$data['note'] = $this->Note_model->note($pn_txn_id);
$data['note'] = $this->Note_model->note($pn_txn_id, $pn_id);
if (!empty($data['note'])) {
if (!empty($pn_invoice)) {
$orderid_info = $this->analysis_orderid($pn_invoice);
@ -925,25 +1101,26 @@ class IPayLinksService extends CI_Controller
//修改订单名
public function note_modal_save() {
$data = array();
$pn_txn_id = $this->input->post('pn_txn_id');
$pn_invoice = $this->input->post('pn_invoice');
if (!empty($pn_txn_id) && !empty($pn_invoice)) {
$orderid_info = $this->analysis_orderid($pn_invoice);
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
$advisor_info = $this->IPayLinks_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
if (!empty($advisor_info)) {
$this->Note_model->set_invoice($pn_txn_id, $pn_invoice);
$this->batch_send_note($pn_txn_id);
echo json_encode('修改成功!');
return true;
}
}
}
echo json_encode('没找到数据!');
$this->gai_modal_save();
// $data = array();
// $pn_txn_id = $this->input->post('pn_txn_id');
// $pn_invoice = $this->input->post('pn_invoice');
// if (!empty($pn_txn_id) && !empty($pn_invoice)) {
// $orderid_info = $this->analysis_orderid($pn_invoice);
// if (!empty($orderid_info)) {
// $orderid_info = json_decode($orderid_info);
// $advisor_info = $this->IPayLinks_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
// if (!empty($advisor_info)) {
// $this->Note_model->set_invoice($pn_txn_id, $pn_invoice);
// $this->batch_send_note($pn_txn_id);
// echo json_encode('修改成功!');
// return true;
// }
// }
// }
// echo json_encode('没找到数据!');
return;
}
@ -975,6 +1152,7 @@ class IPayLinksService extends CI_Controller
*/
public function get_refund_list($daylength=3)
{
return false; // ipaylinks的批量查询接口已关闭
bcscale(2);
$ret = array();
$list = $this->refund_list_info($daylength);
@ -987,7 +1165,7 @@ class IPayLinksService extends CI_Controller
, strval(date('Y-m-d H:i:s',strtotime($refund->refundTime)))
, strval(date('Y-m-d H:i:s',strtotime($refund->completeTime)))
, $refund->stateCode
, "0000"
, ($refund->stateCode==2) ? "0000" : null
, json_encode($refund)
, "refund"
);
@ -1225,6 +1403,7 @@ class IPayLinksService extends CI_Controller
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
// 对齐
$objPHPExcel->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$objPHPExcel->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
@ -1234,8 +1413,9 @@ class IPayLinksService extends CI_Controller
->SetCellValue('B1', '团号')
->SetCellValue('C1', '金额')
->SetCellValue('D1', '付款人')
->SetCellValue('E1', '交易号')
->SetCellValue('F1', '收单时间');
->SetCellValue('E1', '付款人邮箱')
->SetCellValue('F1', '交易号')
->SetCellValue('G1', '收单时间');
$currency_sum = array();
bcscale(2);
$rowCount = 2;
@ -1248,9 +1428,10 @@ class IPayLinksService extends CI_Controller
->SetCellValue('A'.$rowCount, ($rowCount-1))
->setCellValueExplicit('B'.$rowCount, $row->IPL_orderId,PHPExcel_Cell_DataType::TYPE_STRING)
->setCellValueExplicit('C'.$rowCount, trim($row->IPL_currencyCode) . number_format($row->IPL_orderAmount, 2, ".", ""),PHPExcel_Cell_DataType::TYPE_STRING)
->SetCellValue('D'.$rowCount, $payer)
->setCellValueExplicit('E'.$rowCount, $row->IPL_dealId,PHPExcel_Cell_DataType::TYPE_STRING)
->SetCellValue('F'.$rowCount, $row->IPL_acquiringTime);
->SetCellValue('D'.$rowCount, $row->IPL_payerName)
->SetCellValue('E'.$rowCount, $row->IPL_payerEmail)
->setCellValueExplicit('F'.$rowCount, $row->IPL_dealId,PHPExcel_Cell_DataType::TYPE_STRING)
->SetCellValue('G'.$rowCount, $row->IPL_acquiringTime);
$payer = "";
$rowCount++;
}
@ -1272,4 +1453,17 @@ class IPayLinksService extends CI_Controller
$objWriter->save('php://output');
}
public function sign_fun()
{
$req = $this->input->post();
$str = $this->generate_sign($req);
return $this->output->set_content_type('application/json')->set_output(json_encode(array("str" => $str)));
}
public function test()
{
$this->Note_model->test();
return ;
}
}

@ -180,3 +180,43 @@ function analysis_orderid($note_invoice_string) {
}
return json_encode(array('orderid' => $pm_orderid, 'ordertype' => $ordertype));
}
/**
* 输出xml字符
* @throws WxPayException
**/
function to_xml($arr)
{
if(!is_array($arr) || count($arr) <= 0)
{
return false;
}
$xml = "<xml>";
foreach ($arr as $key=>$val)
{
if (is_numeric($val)){
$xml.="<".$key.">".$val."</".$key.">";
}else{
$xml.="<".$key."><![CDATA[".$val."]]></".$key.">";
}
}
$xml.="</xml>";
return $xml;
}
/**
* 将xml转为array
* @param string $xml
* @throws WxPayException
*/
function from_xml($xml)
{
if(!$xml){
return false;
}
//将XML转为array
//禁止引用外部xml实体
libxml_disable_entity_loader(true);
return json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
}

@ -18,7 +18,7 @@ class Alipay_model extends CI_Model {
$fieldsql = $orderinfo == false ? '' : " ,* ";
//先查商务订单B,APP订单A、再查传统订单T
if ($ordertype == 'B' || $ordertype == 'A') {
$sql = "SELECT TOP 1 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from BIZ_ConfirmLineInfo
$sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_ID =?";
$query = $this->HT->query($sql, array($COLI_ID));
@ -26,7 +26,7 @@ class Alipay_model extends CI_Model {
}
//后查传统订单的原因是因为传统订单的订单号去掉外联名字首字母后可能会和商务订单的重合。
if (empty($result) && ($ordertype == 'T')) {
$sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_ID like '%$COLI_ID'";
$query = $this->HT->query($sql);
@ -36,7 +36,7 @@ class Alipay_model extends CI_Model {
//查传统订单add_code网前实时支付会先生成一个临时订单号存在add_code里如订单45103248
if (empty($result) && ($ordertype == 'M')) {
$sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_AddCode =? ";
$query = $this->HT->query($sql, array($COLI_ID));
@ -44,7 +44,7 @@ class Alipay_model extends CI_Model {
}
if (empty($result) && ($ordertype == 'M')) {
$sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where
EXISTS (
@ -60,7 +60,7 @@ class Alipay_model extends CI_Model {
//订单号查询不到尝试使用团号查询
if (empty($result) && $ordertype == 'B') {
$sql = "SELECT TOP 1 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from BIZ_ConfirmLineInfo
$sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_GroupCode like '%-$COLI_ID%'";
$query = $this->HT->query($sql);
@ -68,10 +68,14 @@ class Alipay_model extends CI_Model {
}
//团号查询不到尝试使用客人邮箱查询(预订多次的老客户得按日期新旧排序,取最新的数据)
if (!empty($result)) {
if (!empty($result) && is_array($result) ) {
//print_r($result[0]);
//die();
$result = $result[0];
if (count($result) > 1) {
$result = array();
} else {
$result = $result[0];
}
}
return $result;
@ -117,14 +121,33 @@ class Alipay_model extends CI_Model {
//修改订单状态
public function update_biz_coli_state($coli_sn, $coli_state) {
$sql = "
UPDATE BIZ_ConfirmLineInfo
SET COLI_State = ?
WHERE COLI_SN = ?
IF EXISTS
( SELECT OPI_DEI_SN
FROM OperatorInfo
INNER JOIN BIZ_ConfirmLineInfo ON OPI_SN=COLI_OPI_ID
WHERE COLI_SN=? AND OPI_DEI_SN=10
)
UPDATE BIZ_ConfirmLineInfo
SET COLI_State=?
WHERE COLI_SN=?
ELSE
UPDATE BIZ_ConfirmLineInfo
SET COLI_State=? WHERE COLI_SN=?
AND COLI_State IN (0,1,11,12,13,14,40,50,60,101,102,999)
";
$query = $this->HT->query($sql, array($coli_state, $coli_sn));
$query = $this->HT->query($sql, array($coli_sn, $coli_state, $coli_sn, $coli_state, $coli_sn));
return $query;
}
public function if_biz_gai_exists($GAI_AccreditNo)
{
$sql = " SELECT TOP 1 1 FROM BIZ_GroupAccountInfo
WHERE (GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%')
AND DeleteFlag=0";
$result = $this->HT->query($sql, array($GAI_AccreditNo));
return ($result->num_rows() > 0);
}
//添加收款记录(商务订单),APP会自动增加记录所以添加前根据金额来判断是否有重复记录
public function add_account_info_forAPP($GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo) {
//先判断是否有这条数据
@ -132,7 +155,7 @@ class Alipay_model extends CI_Model {
IF NOT EXISTS(
SELECT TOP 1 1
FROM BIZ_GroupAccountInfo
WHERE GAI_COLI_SN = ? AND GAI_SQJE=?
WHERE GAI_COLI_SN = ? AND GAI_SQJE=? and GAI_Type=15015
)
INSERT INTO BIZ_GroupAccountInfo (
GAI_COLI_SN
@ -157,7 +180,7 @@ class Alipay_model extends CI_Model {
}
//添加收款记录(商务订单)
public function add_account_info($GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_Money, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo) {
public function add_account_info($GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_Money, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo) {
//先判断是否有这条数据
$sql = "
@ -174,6 +197,7 @@ class Alipay_model extends CI_Model {
,GAI_SQDate
,GAI_SQJECurrency
,GAI_Money
,GAI_SSJE
,GAI_SSDate
,GAI_AccountDate
,GAI_SubmitDate
@ -183,14 +207,14 @@ class Alipay_model extends CI_Model {
,GAI_Memo
,GAI_State
,DeleteFlag
) VALUES (?,?,15015,?,?,?,?,?,?,?,?,?,?,?,0,0)";
$query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_Money, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo));
) VALUES (?,?,15015,?,?,?,?,?,?,?,?,?,?,?,?,0,0)";
$query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_Money, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo));
$insertid = $this->HT->last_id('BIZ_GroupAccountInfo');
return $query;
}
//添加收款记录(传统订单)
public function add_tour_account_info($GAI_COLI_SN, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo) {
public function add_tour_account_info($GAI_COLI_SN, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo) {
//先判断是否有这条数据
$sql = "
@ -205,6 +229,7 @@ class Alipay_model extends CI_Model {
,GAI_SQJE
,GAI_SQDate
,GAI_SQJECurrency
,GAI_SSJE
,GAI_SSDate
,GAI_AccountDate
,GAI_SubmitDate
@ -214,10 +239,10 @@ class Alipay_model extends CI_Model {
,GAI_Memo
,GAI_State
,DeleteFlag
) VALUES (?,15015,?,?,?,?,?,?,?,?,?,?,0,0)";
$query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo));
) VALUES (?,15015,?,?,?,?,?,?,?,?,?,?,?,0,0)";
$query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo));
$insertid = $this->HT->last_id('GroupAccountInfo');
return $query;
return $insertid;
}
//更新线路提醒
@ -288,4 +313,58 @@ class Alipay_model extends CI_Model {
}
return 0;
}
/*!
* 更新订单主表付款方式,防止没访问thankyou-train.asp
* @author LYT <lyt@hainatravel.com>
*/
public function update_paymanner($COLI_SN, $paymanner = '15015')
{
$sql = "UPDATE BIZ_ConfirmLineInfo SET COLI_PayManner = ? WHERE COLI_SN=? ";
$query = $this->HT->query($sql, array($paymanner, $COLI_SN));
return $query;
}
/** JJH: 添加订单收款记录之后执行 */
public function exec_addToTask($GAI_SN)
{
$sql = " if not exists (
select top 1 1 from Sysautotask
where SAT_Type=1 and SAT_SourceSN=$GAI_SN
) exec SP_AddToSystask 1," . $GAI_SN;
$query = $this->HT->query($sql);
return $query;
}
/** 写入商务订单操作记录 */
public function insert_biz_order_log($coli_sn, $log_info)
{
$db_column = array(
"BOL_COLI_SN" => $coli_sn
,"BOL_OPI_SN" => 0
,"BOL_OPType" => $log_info
,"BOL_OPTime" => date('Y-m-d H:i:s')
,"BOL_Creator" => 0
,"BOL_CreateTime" => date('Y-m-d H:i:s')
);
return $this->HT->insert("BIZ_OrderOperationLog", $db_column);
}
/*!
* 调用数据库函数,生成实收金额
* @author LYT <lyt@hainatravel.com>
* @date 2017-11-03
* @param decimal(18,3) $amount
* @param varchar(6) $currency
*/
public function get_ssje($amount, $currency='RMB', $code='15015')
{
$sql = "SELECT dbo.GetSSJEFromSQJE(?, ?, ?) as ssje";
$query = $this->HT->query($sql,array($code, $currency, $amount));
$result = $query->result();
if ( ! empty($result)) {
return $result[0]->ssje;
}
return 0;
}
}

@ -118,7 +118,8 @@ class Alipay_note_model extends CI_Model {
,$ALI_payerEmail
));
$insertid = $this->INFO->last_id('AlipayLog');
return $query;
$ret = "SELECT TOP 1 * FROM AlipayLog WHERE ALI_dealId='$ALI_dealId' ORDER BY ALI_sn DESC ";
return $this->INFO->query($ret)->row();
}
public function get_list() {

@ -18,7 +18,7 @@ class IPayLinks_model extends CI_Model {
$fieldsql = $orderinfo == false ? '' : " ,* ";
//先查商务订单B,APP订单A、再查传统订单T
if ($ordertype == 'B' || $ordertype == 'A') {
$sql = "SELECT TOP 1 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from BIZ_ConfirmLineInfo
$sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode, COLI_Department,COLI_PayManner,COLI_State $fieldsql from BIZ_ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_ID =?";
$query = $this->HT->query($sql, array($COLI_ID));
@ -26,7 +26,7 @@ class IPayLinks_model extends CI_Model {
}
//后查传统订单的原因是因为传统订单的订单号去掉外联名字首字母后可能会和商务订单的重合。
if (empty($result) && ($ordertype == 'T')) {
$sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_ID like '%$COLI_ID'";
$query = $this->HT->query($sql);
@ -36,7 +36,7 @@ class IPayLinks_model extends CI_Model {
//查传统订单add_code网前实时支付会先生成一个临时订单号存在add_code里如订单45103248
if (empty($result) && ($ordertype == 'M')) {
$sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_AddCode =? ";
$query = $this->HT->query($sql, array($COLI_ID));
@ -44,7 +44,7 @@ class IPayLinks_model extends CI_Model {
}
if (empty($result) && ($ordertype == 'M')) {
$sql = "SELECT TOP 1 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli
$sql = "SELECT TOP 2 1 as order_type, COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode $fieldsql from ConfirmLineInfo cli
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where
EXISTS (
@ -60,7 +60,7 @@ class IPayLinks_model extends CI_Model {
//订单号查询不到尝试使用团号查询
if (empty($result) && $ordertype == 'B') {
$sql = "SELECT TOP 1 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_State $fieldsql from BIZ_ConfirmLineInfo
$sql = "SELECT TOP 2 0 as order_type,COLI_SN,COLI_ID,OPI_Email,OPI_FirstName,OPI_Name,COLI_WebCode,COLI_Department,COLI_State $fieldsql from BIZ_ConfirmLineInfo
LEFT JOIN OperatorInfo ON COLI_OPI_ID=OPI_SN
where COLI_GroupCode like '%-$COLI_ID%'";
$query = $this->HT->query($sql);
@ -68,10 +68,14 @@ class IPayLinks_model extends CI_Model {
}
//团号查询不到尝试使用客人邮箱查询(预订多次的老客户得按日期新旧排序,取最新的数据)
if (!empty($result)) {
if (!empty($result) && is_array($result) ) {
//print_r($result[0]);
//die();
$result = $result[0];
if (count($result) > 1) {
$result = array(); // 找到多条匹配的订单记录时,不处理
} else {
$result = $result[0];
}
}
return $result;
@ -117,22 +121,41 @@ class IPayLinks_model extends CI_Model {
//修改订单状态
public function update_biz_coli_state($coli_sn, $coli_state) {
$sql = "
UPDATE BIZ_ConfirmLineInfo
SET COLI_State = ?
WHERE COLI_SN = ?
IF EXISTS
( SELECT OPI_DEI_SN
FROM OperatorInfo
INNER JOIN BIZ_ConfirmLineInfo ON OPI_SN=COLI_OPI_ID
WHERE COLI_SN=? AND OPI_DEI_SN=10
)
UPDATE BIZ_ConfirmLineInfo
SET COLI_State=?
WHERE COLI_SN=?
ELSE
UPDATE BIZ_ConfirmLineInfo
SET COLI_State=? WHERE COLI_SN=?
AND COLI_State IN (0,1,11,12,13,14,40,50,60,101,102,999)
";
$query = $this->HT->query($sql, array($coli_state, $coli_sn));
$query = $this->HT->query($sql, array($coli_sn, $coli_state, $coli_sn, $coli_state, $coli_sn));
return $query;
}
public function if_biz_gai_exists($GAI_AccreditNo)
{
$sql = " SELECT TOP 1 1 FROM BIZ_GroupAccountInfo
WHERE (GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%')
AND DeleteFlag=0";
$result = $this->HT->query($sql, array($GAI_AccreditNo));
return ($result->num_rows() > 0);
}
//添加收款记录(商务订单),APP会自动增加记录所以添加前根据金额来判断是否有重复记录
public function add_account_info_forAPP($GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo) {
public function add_account_info_forAPP($GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo) {
//先判断是否有这条数据
$sql = "
IF NOT EXISTS(
SELECT TOP 1 1
FROM BIZ_GroupAccountInfo
WHERE GAI_COLI_SN = ? AND GAI_SQJE=?
WHERE (GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%') and DeleteFlag=0 and GAI_Type=15018
)
INSERT INTO BIZ_GroupAccountInfo (
GAI_COLI_SN
@ -141,6 +164,7 @@ class IPayLinks_model extends CI_Model {
,GAI_SQJE
,GAI_SQDate
,GAI_SQJECurrency
,GAI_SSJE
,GAI_SSDate
,GAI_AccountDate
,GAI_SubmitDate
@ -150,8 +174,8 @@ class IPayLinks_model extends CI_Model {
,GAI_Memo
,GAI_State
,DeleteFlag
) VALUES (?,?,15010,?,?,?,?,?,?,?,?,?,?,0,0)";
$query = $this->HT->query($sql, array($GAI_COLI_SN, $GAI_SQJE, $GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo));
) VALUES (?,?,15018,?,?,?,?,?,?,?,?,?,?,?,0,0)";
$query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_COLI_ID, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo));
$insertid = $this->HT->last_id('BIZ_GroupAccountInfo');
return $query;
}
@ -164,7 +188,7 @@ class IPayLinks_model extends CI_Model {
IF NOT EXISTS(
SELECT TOP 1 1
FROM BIZ_GroupAccountInfo
WHERE GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%'
WHERE (GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%') and DeleteFlag=0
)
INSERT INTO BIZ_GroupAccountInfo (
GAI_COLI_SN
@ -197,7 +221,7 @@ class IPayLinks_model extends CI_Model {
IF NOT EXISTS(
SELECT TOP 1 1
FROM GroupAccountInfo
WHERE GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%'
WHERE (GAI_AccreditNo = ? OR GAI_Memo LIKE '%$GAI_AccreditNo%') AND DeleteFlag=0
)
INSERT INTO GroupAccountInfo (
GAI_COLI_SN
@ -218,7 +242,7 @@ class IPayLinks_model extends CI_Model {
) VALUES (?,15018,?,?,?,?,?,?,?,?,?,?,?,0,0)";
$query = $this->HT->query($sql, array($GAI_AccreditNo, $GAI_COLI_SN, $GAI_SQJE, $GAI_SQDate, $GAI_SQJECurrency, $GAI_SSJE, $GAI_SSDate, $GAI_AccountDate, $GAI_SubmitDate, $GAI_CusName, $GAI_CusEmail, $GAI_AccreditNo, $GAI_Memo));
$insertid = $this->HT->last_id('GroupAccountInfo');
return $query;
return $insertid;
}
//更新线路提醒
@ -309,9 +333,11 @@ class IPayLinks_model extends CI_Model {
//根据交易号获取收款记录(传统订单)
public function get_money_t($pn_invoice) {
$sql = "SELECT GroupAccountInfo.*
$like = $this->HT->escape_like_str($pn_invoice);
$sql = "SELECT COLI_ID,GroupAccountInfo.*
from GroupAccountInfo
where GAI_Type='15018' and GAI_AccreditNo=?
inner join ConfirmLineInfo coli on COLI_SN=GAI_COLI_SN
where GAI_Type='15018' and GroupAccountInfo.DeleteFlag=0 and (GAI_AccreditNo=? or GAI_Memo like '%$like%')
";
$query = $this->HT->query($sql, array($pn_invoice));
$result = $query->result();
@ -319,9 +345,11 @@ class IPayLinks_model extends CI_Model {
}
//根据交易号获取收款记录(商务订单)
public function get_money_b($pn_invoice) {
$sql = "SELECT BIZ_GroupAccountInfo.*
$like = $this->HT->escape_like_str($pn_invoice);
$sql = "SELECT COLI_ID,BIZ_GroupAccountInfo.*
from BIZ_GroupAccountInfo
where GAI_Type='15018' and GAI_AccreditNo=?
inner join BIZ_ConfirmLineInfo on COLI_SN=GAI_COLI_SN
where GAI_Type='15018' and BIZ_GroupAccountInfo.DeleteFlag=0 and (GAI_AccreditNo=? or GAI_Memo like '%$like%')
";
$query = $this->HT->query($sql, array($pn_invoice));
$result = $query->result();
@ -340,4 +368,41 @@ class IPayLinks_model extends CI_Model {
$query = $this->HT->query($sql, array($entry_sum_RMB, $pn_invoice));
return $query;
}
/** 删除收款记录 */
public function delete_money_t($deadId)
{
$sql = "UPDATE GroupAccountInfo SET DeleteFlag=1 WHERE GAI_Type='15018' and GAI_AccreditNo=?";
$query = $this->HT->query($sql, array($deadId));
return $query;
}
public function delete_money_b($deadId)
{
$sql = "UPDATE BIZ_GroupAccountInfo SET DeleteFlag=1 WHERE GAI_Type='15018' and GAI_AccreditNo=?";
$query = $this->HT->query($sql, array($deadId));
return $query;
}
/** JJH: 添加订单收款记录之后执行 */
public function exec_addToTask($GAI_SN)
{
$sql = " if not exists (
select top 1 1 from Sysautotask
where SAT_Type=1 and SAT_SourceSN=$GAI_SN
) exec SP_AddToSystask 1," . $GAI_SN;
$query = $this->HT->query($sql);
return $query;
}
/** 写入商务订单操作记录 */
public function insert_biz_order_log($coli_sn, $log_info)
{
$db_column = array(
"BOL_COLI_SN" => $coli_sn
,"BOL_OPI_SN" => 0
,"BOL_OPType" => $log_info
,"BOL_OPTime" => date('Y-m-d H:i:s')
,"BOL_Creator" => 0
,"BOL_CreateTime" => date('Y-m-d H:i:s')
);
return $this->HT->insert("BIZ_OrderOperationLog", $db_column);
}
}

@ -0,0 +1,27 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Online_payment_account_model extends CI_Model {
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
/*!
* 调用数据库函数,生成实收金额
* @author LYT <lyt@hainatravel.com>
*/
public function get_ssje($amount, $currency='USD', $code)
{
$sql = "SELECT dbo.GetSSJEFromSQJE(?, ?, ?) as ssje";
$query = $this->HT->query($sql,array($code, $currency, $amount));
$result = $query->result();
if ( ! empty($result)) {
return $result[0]->ssje;
}
return NULL;
}
}

@ -0,0 +1,84 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Online_payment_note_model extends CI_Model {
function __construct() {
parent::__construct();
$this->info = $this->load->database('INFO', TRUE);
}
public function insert_note($column)
{
if ($column === null) {
return false;
}
$this->info->insert('OnlinePaymentNote', $column);
$ret = "SELECT TOP 1 * FROM OnlinePaymentNote WHERE OPN_transactionId=? ORDER BY OPN_SN DESC ";
return $this->info->query($ret, array($column['OPN_transactionId']))->row();
}
public function update_note($where, $column)
{
$update_str = $this->info->update_string('OnlinePaymentNote', $column, $where);
$this->info->query($update_str);
return TRUE;
}
public $topnum = false;
public $orderby = false;
public $send = false;
public $search = false;
public $transactionId = false;
public $payment_status = false;
public function init_query() {
$this->topnum = false;
$this->send = false;
$this->search = false;
$this->payment_status = false;
$this->transactionId = false;
$this->orderby = ' ORDER BY OPN_SN DESC ';
}
public function query_note()
{
$top_sql = $this->topnum ? (" TOP " . $this->topnum) : "";
$sql .= "SELECT $top_sql opn.*
FROM [InfoManager].[dbo].[OnlinePaymentNote] opn
WHERE 1=1 ";
$this->send ? $sql.=$this->send : false;
$this->search ? $sql.=$this->search : false;
$this->transactionId ? $sql.=$this->transactionId : false;
$this->orderby ? $sql.=$this->orderby : false;
$query = $this->INFO->query($sql);
return $query->result();
}
public function get_note($payment_method=NULL, $transactionId=null)
{
$this->init_query();
$this->topnum=1;
$this->transactionId = " AND opn.OPN_transactionId=" . $this->INFO->escape($transactionId);
return $this->query_note();
}
public function unsend_note($payment_method=NULL, $num=2)
{
$this->init_query();
$this->topnum = $num;
$this->send = " AND (OPN_noticeSendStatus='unsend' OR OPN_noticeSendStatus='' OR OPN_noticeSendStatus IS NULL) ";
return $this->query_note();
}
public function sendfail_note($payment_method=NULL, $num=2)
{
$this->init_query();
$this->topnum = $num;
$this->send = " AND OPN_noticeSendStatus='sendfail' ";
return $this->query_note();
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save