diff --git a/application/controllers/information.php b/application/controllers/information.php
index ae63c41f..dd801e17 100644
--- a/application/controllers/information.php
+++ b/application/controllers/information.php
@@ -391,14 +391,18 @@ class Information extends CI_Controller {
$ic_url = $this->input->post('ic_url');
$auto_update_cache = $this->input->get_post('auto_update_cache_checkbox');
if ($site_code == 'gm' && substr($ic_url, 0, 5) == '/faq/') {
- $this->update_cache($ic_url, true);
+ $update_info_log = $this->update_cache($ic_url, true);
} else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) {
- $this->update_cache($ic_url);
- } else if (strcasecmp($site_code, "cht") != 0) {
- $this->update_cache($ic_url);
+ $update_info_log = $this->update_cache($ic_url);
+ } else if (strcasecmp($site_code, "cht") != 0) {//非cht站点
+ $update_info_log = $this->update_cache($ic_url);
}
- $data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'));
+ if (empty($update_info_log) || count($update_info_log) == 0 || !isset($update_info_log[0]['url'])) {
+ $update_info_log = 'not found update info log';
+ }
+
+ $data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'), 'update_info_log' => $update_info_log);
$this->Logs_model->backup($information->is_id, $this->input->post('ic_content'));
$this->Logs_model->backup_summary($information->is_id, $this->input->post('ic_summary'));
@@ -428,24 +432,6 @@ class Information extends CI_Controller {
}
echo json_encode($data);
-
- //设置图片应用URL
- /* $use_pictures=$this->input->post('use_pictures');
- if(!empty($use_pictures))
- {
- foreach(explode(',',$use_pictures.'0:0:0') as $picture)
- {
- list($p_id,$p_path,$p_wh)=explode(':',$picture);
- if (stripos($this->input->post('ic_content'),$p_path) !== FALSE || $p_path==$this->input->post('ic_photo') )
- {
- if($p_id!=0)
- {
- $this->load->model('pictureUseStat_model');
- $this->pictureUseStat_model->set_useurl($p_id,$p_wh,$this->config->item('site_url').$this->input->post('ic_url'));
- }
- }
- }
- } */
}
}
@@ -474,63 +460,72 @@ class Information extends CI_Controller {
//更新静态文件
//不用参数提交的原因是可能url带有特殊字符,CI会报错
public function update_cache($static_html_url = false, $delete_only = false) {
-
- $url = $static_html_url;
- if (empty($url)) {
- $url = $this->input->post('cache_url');
- }
+ $url = !empty($static_html_url) ? $static_html_url : $this->input->post('cache_url');
$url = str_replace($this->config->item('site_url'), '', $url);
- //原始链接
- $original_url = $url;
+ $original_url = $url; //原始链接
+ $delete_only = !empty($delete_only) ? $delete_only : $this->input->get_post('delete_only');
+
+ switch ($this->config->item('site_code')) {
+ case 'cht':
+ $url = 'http://192.155.224.195:8080/guide-use.php/travelguide/guide/?static_html_url=' . $url;
+ if (strpos($url, '/festivals/') !== false || strpos($url, '/faq/') !== false) {//ch的部分控制器不是travelguide,所以不能统一更新和生产缓存文件,只能跳过,统一控制器再回头取消这个限制
+ $url = 'http://www.chinahighlights.com/';
+ }
+ break;
- if ($this->config->item('site_code') == 'cht') {
- //$url = 'http://www.chinahighlights.com/api/community/updatecache.asp?gurl=http://www.chinahighlights.com' . $url . '&other=1&site=info';
- //$url = 'http://192.155.224.195:2222/guide-use.php/travelguide/guide/?static_html_url=' . $url;
- $url = 'http://192.155.224.195:8080/guide-use.php/travelguide/guide/?static_html_url=' . $url;
+ case 'ah':
+ if ($delete_only === true) {
+ $url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url;
+ } else {// static_html_optimize=comeon 启用静态化压缩和js、css延迟加载
+ $url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon';
+ }
+ break;
- //ch的部分控制器不是travelguide,所以不能统一更新和生产缓存文件,只能跳过,统一控制器再回头取消这个限制
- if (strpos($url, '/festivals/') !== false) {
- $url = 'http://www.chinahighlights.com/';
- }
- if (strpos($url, '/faq/') !== false) {
- $url = 'http://www.chinahighlights.com/';
- }
- } elseif ($this->config->item('site_code') == 'gm') {
- $url = "http://148.251.35.42:3300/create-cache/?url=$url";
- } else if (is_series_site()) {
- if (FALSE === $delete_only) {
- $delete_only = $this->input->get_post('delete_only');
- }
- if ($delete_only) {
- //只删除操作,在url修改和不发布信息的时候使用
- $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
- } else {
- $information = $this->Information_model->Detail($url);
- $tmp = $url;
- //判断是否是更新信息
- /* 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了
- */
- if (!empty($information->ic_content)) {
- //先尝试删除静态文件。
- $try_del = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
- file_get_contents($try_del);
- $url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url;
+ case 'gm':
+ GET_HTTP("http://148.251.35.42:3300/create-cache/?url=" . urlencode($url)); //请求nodejs静态化更新页面,删除缓存,因为部分页面没有进入信息平台
+ if ($delete_only) {
+ $url = $this->config->item('site_url') . "/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url);
} else {
- $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url;
+ $url = $this->config->item('site_url') . "/gm.php/information/detail?static_html_optimize=comeon&static_html_url=" . urlencode($url);
}
- if (isset($information->ic_type) && $information->ic_type == 'product') {
- $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp;
+ break;
+
+ case 'vac'://国际站
+ case 'vc':
+ case 'it':
+ case 'ru':
+ case 'jp':
+ if ($delete_only) {
+ //只删除操作,在url修改和不发布信息的时候使用
+ $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
+ } else {
+ $information = $this->Information_model->Detail($url);
+ $tmp = $url;
+ //判断是否是更新信息
+ // 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了
+ if (!empty($information->ic_content)) {
+ //先尝试删除静态文件。
+ $try_del = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
+ file_get_contents($try_del);
+ $url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url;
+ } else {
+ $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url;
+ }
+ if (isset($information->ic_type) && $information->ic_type == 'product') {
+ $url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp;
+ }
}
- }
- } else if ($this->config->item('site_code') == 'ah') {
- if ($delete_only === true) {
- $url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url;
- } else {
- // static_html_optimize=comeon 启用静态化压缩和js、css延迟加载
- $url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon';
- }
- } else { //子站点使用
- $url = $this->config->item('site_url') . $url . '@cache@refresh';
+ break;
+
+ case 'ct'://子站点使用
+ case 'sht':
+ case 'gl':
+ case 'mbj':
+ case 'yz':
+ $url = $this->config->item('site_url') . $url . '@cache@refresh';
+ break;
+ default:return false;
+ break;
}
//关闭错误提示,防止file_get_contents请求特殊字符的时候会报错或者404、500,特殊字符需要用urlencode编码第一个/后面的url
diff --git a/application/controllers/keyworlds.php b/application/controllers/keyworlds.php
index d6c2c1a9..429adf01 100644
--- a/application/controllers/keyworlds.php
+++ b/application/controllers/keyworlds.php
@@ -265,7 +265,7 @@ class Keyworlds extends CI_Controller {
}
}
//保存排名数据
- if ($rank['rank'] == '151') {
+ if ($rank['rank'] == '151') { //超过151的排名则不记录
$this->Keywords_model->update_time($kw_id);
} elseif (isset($last_rank[0]->kwr_datetime) and $last_rank[0]->kwr_datetime > strtotime(date('Y-m-d'))) {
if ($rank['rank'] != -1 and $rank['rank'] != -2 and $this->Keywordsrank_model->update_rank($last_rank[0]->kwr_id, $rank['rank'], $rank['source'])) {
@@ -321,15 +321,16 @@ class Keyworlds extends CI_Controller {
break;
}
}
- //if ($rank['rank'] == '151') {
- if ($rank['rank'] != -1 and $rank['rank'] != -2 and $this->Keywordsrank_model->add_rank($v->kw_id, $rank['rank'], $rank['source'], $rank['engines'])) {
- $this->load->model('InfoSMS_model');
- $last_rank = isset($last_rank[0]) ? $last_rank[0]->kwr_rank : $rank['rank'];
- $this->InfoSMS_model->readed_for_info($v->kw_id, 'keywords_rank');
- $this->InfoSMS_model->add('keywords_rank', $v->kw_id, $rank['rank'], $last_rank, (string) ($rank['rank'] - $last_rank));
- if ($engines != 'yandex')
- $this->Keywords_model->update_time($v->kw_id);
- }
+ if ($rank['rank'] == '151') { //超过151的排名则不记录
+ $this->Keywords_model->update_time($v->kw_id);
+ }else if ($rank['rank'] != -1 and $rank['rank'] != -2 and $this->Keywordsrank_model->add_rank($v->kw_id, $rank['rank'], $rank['source'], $rank['engines'])) {
+ $this->load->model('InfoSMS_model');
+ $last_rank = isset($last_rank[0]) ? $last_rank[0]->kwr_rank : $rank['rank'];
+ $this->InfoSMS_model->readed_for_info($v->kw_id, 'keywords_rank');
+ $this->InfoSMS_model->add('keywords_rank', $v->kw_id, $rank['rank'], $last_rank, (string) ($rank['rank'] - $last_rank));
+ if ($engines != 'yandex')
+ $this->Keywords_model->update_time($v->kw_id);
+ }
}
var_dump($worldsList[0]->kw_keyworlds, $rank);
}
diff --git a/application/third_party/htmlcompressor/controllers/index.php b/application/third_party/htmlcompressor/controllers/index.php
index bbf12e44..c2b57b76 100644
--- a/application/third_party/htmlcompressor/controllers/index.php
+++ b/application/third_party/htmlcompressor/controllers/index.php
@@ -63,8 +63,10 @@ class Index extends CI_Controller {
$js_jquery_content = '';
foreach ($html_object->find('script') as $link_script) {
if (!empty($link_script->src)) {
- $link_js_array[] = $link_script->src;
- $link_script->outertext = ''; //删除链接,移动到页底
+ if(empty($link_script->defer)){ //没有defer标记的才处理,否则让js延后加载
+ $link_js_array[] = $link_script->src;
+ $link_script->outertext = ''; //删除链接,移动到页底
+ }
} else {
//网页内的js不需要提取
//$js_content.= $link_script->innertext;//js的内容
diff --git a/application/third_party/order/controllers/confirm.php b/application/third_party/order/controllers/confirm.php
index 18b30c39..4dda6cd4 100644
--- a/application/third_party/order/controllers/confirm.php
+++ b/application/third_party/order/controllers/confirm.php
@@ -10,11 +10,12 @@ class Confirm extends CI_Controller {
$this->load->model('Order_model');
}
- public function index($COLI_SN = false, $visitor_link = false, $token = false) {
+ //site_code默认是空,ct的站点需要传值
+ public function index($COLI_SN = false, $visitor_link = false, $token = false,$site_code='') {
$data = array();
if (empty($COLI_SN) || strtoupper(md5($visitor_link)) != strtoupper($token)) {
echo '
校验不对
';
- $this->load->view('link_tips', $data);
+ $this->load->view($site_code.'/link_tips', $data);
return false;
}
@@ -29,19 +30,19 @@ class Confirm extends CI_Controller {
}
}
} else {
- $this->load->view('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('link_tips', $data);
+ $this->load->view($site_code.'/link_tips', $data);
return false;
}
}
- $this->load->view('confirm_order', $data);
+ $this->load->view($site_code.'/confirm_order', $data);
}
public function save_confirm_info() {
@@ -133,6 +134,7 @@ class Confirm extends CI_Controller {
}
}
+ //只有ch有review功能
function review() {
$data = array();
$data['postdata'] = $this->input->post();
diff --git a/application/third_party/order/views/ct/confirm_order.php b/application/third_party/order/views/ct/confirm_order.php
new file mode 100644
index 00000000..c071f6ab
--- /dev/null
+++ b/application/third_party/order/views/ct/confirm_order.php
@@ -0,0 +1,738 @@
+
+
+
+
+
+
+
+ www.chinatravel.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Thanks for booking with China Travel!
+ Please complete and submit the information below.
+
+
+
+
+
+
+
+
+
+
+
+
Error: Please contact your travel advisor.
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/third_party/order/views/ct/link_tips.php b/application/third_party/order/views/ct/link_tips.php
new file mode 100644
index 00000000..8649ac67
--- /dev/null
+++ b/application/third_party/order/views/ct/link_tips.php
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+ www.chinatravel.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
For any change, please contact your travel advisor.
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/third_party/train/controllers/search.php b/application/third_party/train/controllers/search.php
new file mode 100644
index 00000000..dee7bf9d
--- /dev/null
+++ b/application/third_party/train/controllers/search.php
@@ -0,0 +1,168 @@
+load->model("BIZ_train_model");//加载模型
+ }
+
+ //查询聚合余票接口,对返回的数据进行处理
+ public function index($train_date,$fromStation,$toStation){
+ $url = 'http://op.juhe.cn/trainTickets/ticketsAvailable?key='.JUHE_TRAIN_API_KEY.'&train_date='.$train_date.'&from_station='.$fromStation.'&to_station='.$toStation;
+ $back_data = $this->get_http($url);
+ //print_r(json_decode($back_data));
+ $return_data = new stdClass();
+ $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)->result->list)){
+ foreach (json_decode($back_data)->result->list as $value){
+ $obj[$value->from_station_code] = $value->from_station_name;
+ $obj[$value->to_station_code] = $value->to_station_name;
+ $seat_type = '';
+ if(isset($value->gjrw_price)){
+ if($value->gjrw_price > 0){
+ $gjrwPrice = $value->gjrw_price * 10;
+ $seat_type .= '"6":"'.$gjrwPrice.'","A6":"¥'.$value->gjrw_price.'",';
+ }
+ }
+ if(isset($value->qtxb_price)){
+ if($value->qtxb_price > 0){
+ $seat_type .= '"H":"¥'.$value->qtxb_price.'",';
+ }
+ }
+ if(isset($value->rw_price)){
+ if($value->rw_price > 0){
+ $rwPrice = $value->rw_price * 10;
+ $seat_type .= '"4":"'.$rwPrice.'","A4":"¥'.$value->rw_price.'",';
+ }
+ }
+ if(isset($value->rz_price)){
+ if($value->rz_price > 0){
+ $rzPrice = $value->rz_price * 10;
+ $seat_type .= '"2":"'.$rzPrice.'","A2":"¥'.$value->rz_price.'",';
+ }
+ }
+ if(isset($value->tdz_price)){
+ if($value->tdz_price > 0){
+ $seat_type .= '"P":"¥'.$value->tdz_price.'",';
+ }
+ }
+ if(isset($value->wz_price)){
+ if($value->wz_price > 0){
+ $wzPrice = $value->wz_price * 10;
+ $seat_type .= '"WZ":"¥'.$value->wz_price.'",';
+ }
+ }
+ if(isset($value->yw_price)){
+ if($value->yw_price > 0){
+ $ywPrice = $value->yw_price * 10;
+ $seat_type .= '"3":"'.$ywPrice.'","A3":"¥'.$value->yw_price.'",';
+ }
+ }
+ if(isset($value->yz_price)){
+ if($value->yz_price > 0){
+ $yzPrice = $value->yz_price * 10;
+ $seat_type .= '"1":"'.$yzPrice.'","A1":"¥'.$value->yz_price.'",';
+ }
+ }
+ if(isset($value->edz_price)){
+ if($value->edz_price > 0){
+ $seat_type .= '"O":"¥'.$value->edz_price.'",';
+ }
+ }
+ if(isset($value->ydz_price)){
+ if($value->ydz_price > 0){
+ $seat_type .= '"M":"¥'.$value->ydz_price.'",';
+ }
+ }
+ if(isset($value->swz_price)){
+ if($value->swz_price > 0){
+ $swzPrice = $value->swz_price * 10;
+ $seat_type .= '"9":"'.$swzPrice.'","A9":"¥'.$value->swz_price.'",';
+ }
+ }
+ $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).'||';
+ $data = '{"validateMessagesShowId":"_validatorMessage","status":true,"httpstatus":200,"data":{'.$pricestr.'},"messages":[],"validateMessages":{}}';
+ $return_data->data->price[$i] = $data;
+ $this->BIZ_train_model->addOrUpdate($value->train_no,$value->train_code,$value->from_station_code,$value->to_station_code,json_encode($data));
+ $i++;
+ }
+ }
+ $return_data->data->map = (object)$obj;
+ print_r(json_encode($return_data));
+ }
+
+ //获取价格
+ /*
+ fromStationCode:出发站三字码
+ toStationCode:终点站三字码
+ trainCode:车次号
+ */
+ public function get_price($fromStationCode,$toStationCode,$trainCode){
+ $return_data = $this->BIZ_train_model->get_price($fromStationCode,$toStationCode,$trainCode);
+ if(!empty($return_data)){
+ print_r(json_decode($return_data->TPL_Price));
+ }else{
+ print_r('没有数据返回');
+ }
+ }
+
+ //余票转换
+ function ticket_exchange($num){
+ if(is_numeric($num)){
+ if($num == 0){
+ return '无';
+ }elseif($num >= 99){
+ return '有';
+ }else{
+ return $num;
+ }
+ }else{
+ if($num == '--'){
+ return '';
+ }
+ }
+ }
+
+ //发送请求
+ 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_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_TIMEOUT, 45); // 设置超时限制防止死循环
+ curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
+ $tmpInfo = curl_exec($curl); // 执行操作
+ $errno = curl_errno($curl);
+ if ($errno !== 0) {
+ return false;
+ $error_message = $errno . ' ' . curl_error($curl); //记录错误日志
+ log_message('error', "third_party/train_app/index/get_http curl {$error_message}");
+ }
+ curl_close($curl); //关闭CURL会话
+ return $tmpInfo; //返回数据
+ }
+}
+
+
+
+
+?>
\ No newline at end of file
diff --git a/application/third_party/train/models/BIZ_train_model.php b/application/third_party/train/models/BIZ_train_model.php
index b144c738..0bd387da 100644
--- a/application/third_party/train/models/BIZ_train_model.php
+++ b/application/third_party/train/models/BIZ_train_model.php
@@ -5,8 +5,66 @@ class BIZ_train_model extends CI_Model {
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
+ $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){
+ $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'
+ ) BEGIN
+ INSERT INTO TrainPriceList
+ (
+ TPL_Train_No,
+ TPL_Train_Code,
+ TPL_From_Station_Code,
+ TPL_To_Station_Code,
+ TPL_Price,
+ TPL_Datetime,
+ TPL_Source
+ )
+ VALUES
+ (
+ '$TPL_Train_No','$TPL_Train_Code','$TPL_From_Station_Code','$TPL_To_Station_Code','$TPL_Price',GETDATE(),'juhe'
+ )
+ END
+ ELSE
+ BEGIN
+ UPDATE TrainPriceList
+ SET TPL_Train_No = '$TPL_Train_No',
+ TPL_Price = '$TPL_Price',
+ TPL_Datetime = GETDATE(),
+ TPL_Source = 'juhe'
+ 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'
+ END
+ ";
+ $query = $this->INFO->query($sql);
+ return $query;
+ }
+
+ //获取价格
+ public function get_price($fromStationCode,$toStationCode,$trainCode){
+ $sql = "SELECT
+ TPL_Price
+ FROM
+ TrainPriceList
+ WHERE
+ TPL_Train_Code = '$trainCode'
+ AND
+ TPL_From_Station_Code = '$fromStationCode'
+ AND
+ TPL_To_Station_Code = '$toStationCode'";
+ $query = $this->INFO->query($sql);
+ return $query->row();
+ }
+
+
function biz_order_detail($cold_sn) {
$sql = "
SELECT TOP 1 bfoi.FOI_SN
diff --git a/application/third_party/tripadvisor_spider/controllers/index.php b/application/third_party/tripadvisor_spider/controllers/index.php
index 55a5a134..eaffa83e 100644
--- a/application/third_party/tripadvisor_spider/controllers/index.php
+++ b/application/third_party/tripadvisor_spider/controllers/index.php
@@ -18,7 +18,7 @@ class Index extends CI_Controller {
$this->permission->is_admin();
$data = array();
$data['city'] = $city;
- $data['ta_review_list'] = $this->Tripadvisor_Review_model->search(30, $data['city']);
+ $data['ta_review_list'] = $this->Tripadvisor_Review_model->search(200, $data['city']);
$this->load->view('bootstrap3/header', $data);
$this->load->view('welcome');
$this->load->view('bootstrap3/footer');
diff --git a/application/third_party/tripadvisor_spider/models/Tripadvisor_Review_model.php b/application/third_party/tripadvisor_spider/models/Tripadvisor_Review_model.php
index 02ffed1f..25414fc7 100644
--- a/application/third_party/tripadvisor_spider/models/Tripadvisor_Review_model.php
+++ b/application/third_party/tripadvisor_spider/models/Tripadvisor_Review_model.php
@@ -99,6 +99,9 @@ class Tripadvisor_Review_model extends CI_Model {
}
public function find_group($city, $start_date, $end_date) {
+ if($city=='Panda'){
+ $city='chengdu';
+ }
$sql = "
SELECT top 100 GRI_No
,coli_id
diff --git a/application/third_party/tuniu/controllers/tuniu_train.php b/application/third_party/tuniu/controllers/tuniu_train.php
new file mode 100644
index 00000000..a439e51d
--- /dev/null
+++ b/application/third_party/tuniu/controllers/tuniu_train.php
@@ -0,0 +1,300 @@
+load->helper('tuniu');
+ $this->load->library('Des');
+ $this->load->model("tuniuprice_model");
+ }
+
+ //创建请求签名
+ public function create_sign(){
+ $time = date('Y-m-d H:i:s',time());
+ $secretKey = 'hxRkFRKaYCScaJRRO2db';
+ $id = 'retailId25';
+ $timeStamp = 'timestamp'.$time;
+ $sign = $secretKey.$id.'apiKey'.TUNIU_KEY.$timeStamp.$secretKey;
+ return strtoupper(md5($sign));
+ }
+
+ //index
+ public function index(){
+ echo 'hi,tuniu';
+ }
+
+ //获取余票
+ public function search($date,$fromStation,$toStation){
+ $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');
+ //print_r(json_decode($back_data));
+ $return_data = new stdClass();
+ $return_data->returnCode = json_decode($back_data)->returnCode;
+ $return_data->httpstatus = 200;
+ $return_data->data = new stdClass();
+ $return_data->data->result = array();
+ $return_data->data->map = new stdClass();
+ $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.'",';
+ }
+ }
+ if(isset($value->qtxbPrice)){
+ if(is_numeric($value->qtxbPrice)){
+ $seat_type .= '"H":"¥'.$value->qtxbPrice.'",';
+ }
+ }
+ if(isset($value->rwPrice)){
+ if(is_numeric($value->rwPrice)){
+ $rwPrice = $value->rwPrice * 10;
+ $seat_type .= '"4":"'.$rwPrice.'","A4":"¥'.$value->rwPrice.'",';
+ }
+ }
+ if(isset($value->rzPrice)){
+ if(is_numeric($value->rzPrice)){
+ $rzPrice = $value->rzPrice * 10;
+ $seat_type .= '"2":"'.$rzPrice.'","A2":"¥'.$value->rzPrice.'",';
+ }
+ }
+ if(isset($value->tdzPrice)){
+ if(is_numeric($value->tdzPrice)){
+ $seat_type .= '"P":"¥'.$value->tdzPrice.'",';
+ }
+ }
+ if(isset($value->wzPrice)){
+ if(is_numeric($value->wzPrice)){
+ $wzPrice = $value->wzPrice * 10;
+ $seat_type .= '"WZ":"¥'.$value->wzPrice.'",';
+ }
+ }
+ if(isset($value->ywPrice)){
+ if(is_numeric($value->ywPrice)){
+ $ywPrice = $value->ywPrice * 10;
+ $seat_type .= '"3":"'.$ywPrice.'","A3":"¥'.$value->ywPrice.'",';
+ }
+ }
+ if(isset($value->yzPrice)){
+ if(is_numeric($value->yzPrice)){
+ $yzPrice = $value->yzPrice * 10;
+ $seat_type .= '"1":"'.$yzPrice.'","A1":"¥'.$value->yzPrice.'",';
+ }
+ }
+ 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.'"';
+ //余票字符串
+ $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));
+ }
+
+ //获取价格
+ /*
+ fromStationCode:出发站三字码
+ toStationCode:终点站三字码
+ trainCode:车次
+ */
+ public function get_price($fromStationCode,$toStationCode,$trainCode){
+ $return_data = $this->tuniuprice_model->get_price($fromStationCode,$toStationCode,$trainCode);
+ print_r(json_decode($return_data->TPL_Price));
+ }
+
+ //占座下单
+ public function book_ticket(){
+ header('Content-Type:application/json;charset=UTF-8');
+ $sign = $this->create_sign();
+ $url = TUNIU_URL.'/train/book';
+ $time = date('Y-m-d H:i:s',time());
+ $data = '{
+ "retailOrderId": "w123",
+ "cheCi": "K1137",
+ "fromStationCode": "GBZ",
+ "fromStationName":"桂林北",
+ "toStationCode":"NNZ",
+ "toStationName":"南宁",
+ "trainDate":"2017-09-25",
+ "callBackUrl":"http://www.mycht.cn/info.php/apps/train/tuniu_callback/book",
+ "hasSeat":true,
+ "contact":"陈宇超",
+ "phone":"18877381547",
+ "passengers":[{
+ "passengerId":1,
+ "ticketNo": null,
+ "passengerName": "陈宇超",
+ "passportNo": "450302199208131039",
+ "passportTypeId": "1",
+ "passportTypeName": "二代身份证",
+ "piaoType": "1",
+ "piaoTypeName": "成人票",
+ "zwCode": "4",
+ "zwName": "软卧",
+ "cxin": null,
+ "price": "166.5",
+ "reason": 0
+ }]
+ }';
+ $crypt = new DES();
+ $mstr = $crypt->encrypt($data,TUNIU_KEY);
+ $post_data = '{
+ "apiKey": "'.TUNIU_KEY.'",
+ "sign": "'.$sign.'",
+ "timestamp": "'.$time.'",
+ "data": "'.$mstr.'"
+ }';
+ //print_r($url);
+ print_r($post_data);
+ $back_data = post_tuniu($url,$post_data,$method = 'POST');
+ print_r($back_data);
+ }
+
+ //取消占座
+ public function cancel_book($retailOrderId,$orderId){
+ $url = TUNIU_URL.'/train/cancel';
+ $sign = $this->create_sign();
+ $time = date('Y-m-d H:i:s',time());
+ $data =
+ $post_data = '{
+ "apiKey": "'.TUNIU_KEY.'",
+ "sign": "'.$sign.'",
+ "timestamp": "'.$time.'",
+ "data": {
+ "retailOrderId":"'.$retailOrderId.'",
+ "orderId":"'.$orderId.'",
+ "callBackUrl":"http://www.mycht.cn/info.php/apps/train/tuniu_callback/cancelbook"
+ }
+ }';
+ $back_data = post_tuniu($url,$post_data,$method = 'POST');
+ print_r($back_data);
+ }
+
+ //确认出票
+ public function confirm_ticket($retailOrderId,$orderId){
+ $url = TUNIU_URL.'/train/confirm';
+ $sign = $this->create_sign();
+ $time = date('Y-m-d H:i:s',time());
+ $post_data = '{
+ "apiKey": "'.TUNIU_KEY.'",
+ "sign": "'.$sign.'",
+ "timestamp": "'.$time.'",
+ "data": {
+ "retailOrderId":"'.$retailOrderId.'",
+ "orderId":"'.$orderId.'",
+ "callBackUrl":"http://www.mycht.cn/info.php/apps/train/tuniu_callback/confirm"
+ }
+ }';
+ $back_data = post_tuniu($url,$post_data,$method = 'POST');
+ print_r($back_data);
+ }
+
+ //退票
+ public function cancel_ticket($retailOrderId,$orderId){
+ $url = TUNIU_URL.'/train/return';
+ $sign = $this->create_sign();
+ $time = date('Y-m-d H:i:s',time());
+ $data = '{
+ "retailOrderId": "'.$retailOrderId.'",
+ "orderId": "'.$orderId.'",
+ "orderNumber": "E551561213",
+ "callBackUrl":"http://www.mycht.cn/info.php/apps/train/tuniu_callback/return_ticket",
+ "tickets":[{
+ "ticketNo": "TN_aaac40ec06d72851",
+ "passengerName": "陈宇超",
+ "passportTypeId": "1",
+ "passportNo": "450302199208131039"
+ }]
+ }';
+ $crypt = new DES();
+ $mstr = $crypt->encrypt($data,TUNIU_KEY);
+ $post_data = '{
+ "apiKey": "'.TUNIU_KEY.'",
+ "sign": "'.$sign.'",
+ "timestamp": "'.$time.'",
+ "data": "'.$mstr.'"
+ }';
+ $back_data = post_tuniu($url,$post_data,$method = 'POST');
+ print_r($back_data);
+ }
+
+ //查询经停站
+ public function queryStaions($time,$trainNo){
+ $sign = $this->create_sign();
+ $url = TUNIU_URL.'/train/queryStations';
+ $time = date('Y-m-d H:i:s',time());
+ $post_data = '{
+ "apiKey": "'.TUNIU_KEY.'",
+ "sign": "'.$sign.'",
+ "timestamp": "'.$time.'",
+ "data": {
+ "trainDate": "'.$time.'",
+ "trainCode": "'.$trainNo.'"
+ }
+ }';
+ $back_data = post_tuniu($url,$post_data,$method = 'POST');
+ print_r($back_data);
+ }
+
+ //身份验证
+ public function validate(){
+ //$name = $this->input->post('name');
+ //$identityType = $this->input->post('identityType');
+ //$identifyCard = $this->input->post('identifyCard');
+ $sign = $this->create_sign();
+ $url = TUNIU_URL.'/train/validate';
+ $time = date('Y-m-d H:i:s',time());
+ $post_data = '{
+ "apiKey": "'.TUNIU_KEY.'",
+ "sign": "'.$sign.'",
+ "timestamp": "'.$time.'",
+ "data": { "name": "", "identityType": "", "identifyCard": ""}
+ }';
+ $back_data = post_tuniu($url,$post_data,$method = 'POST');
+ print_r($back_data);
+ }
+}
\ No newline at end of file
diff --git a/application/third_party/tuniu/helpers/tuniu_helper.php b/application/third_party/tuniu/helpers/tuniu_helper.php
new file mode 100644
index 00000000..1b5e1fa9
--- /dev/null
+++ b/application/third_party/tuniu/helpers/tuniu_helper.php
@@ -0,0 +1,56 @@
+
\ No newline at end of file
diff --git a/application/third_party/tuniu/libraries/Des.php b/application/third_party/tuniu/libraries/Des.php
new file mode 100644
index 00000000..c0d5a2b6
--- /dev/null
+++ b/application/third_party/tuniu/libraries/Des.php
@@ -0,0 +1,59 @@
+pkcs5_pad($string, $size);
+ $td = mcrypt_module_open('des', '', 'ecb', '');
+ $iv = @mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
+ @mcrypt_generic_init($td, $key, $iv);
+ $data = mcrypt_generic($td, $string);
+ mcrypt_generic_deinit($td);
+ mcrypt_module_close($td);
+ $data = base64_encode($data);
+ return $data;
+ }
+
+ function decrypt($string,$key)
+ {
+ $string = base64_decode($string);
+ $td = mcrypt_module_open('des', '', 'ecb', '');
+ //使用MCRYPT_DES算法,cbc模式
+ $iv = @mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
+ $ks = mcrypt_enc_get_key_size($td);
+ @mcrypt_generic_init($td, $key, $iv);
+ //初始处理
+ $decrypted = mdecrypt_generic($td, $string);
+ //解密
+ mcrypt_generic_deinit($td);
+ //结束
+ mcrypt_module_close($td);
+
+ $result = $this->pkcs5_unpad($decrypted);
+// $result = mb_convert_encoding($result, 'UTF-8', 'GBK');
+ return $result;
+ }
+
+ function pkcs5_pad($text, $blocksize)
+ {
+ $pad = $blocksize - (strlen($text) % $blocksize);
+ return $text . str_repeat(chr($pad), $pad);
+ }
+
+ function pkcs5_unpad($text)
+ {
+ $pad = ord($text{strlen($text) - 1});
+ if ($pad > strlen($text)) {
+ return false;
+ }
+ if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) {
+ return false;
+ }
+ return substr($text, 0, -1 * $pad);
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/application/third_party/tuniu/models/tuniuprice_model.php b/application/third_party/tuniu/models/tuniuprice_model.php
new file mode 100644
index 00000000..c738b903
--- /dev/null
+++ b/application/third_party/tuniu/models/tuniuprice_model.php
@@ -0,0 +1,66 @@
+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){
+ $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'
+ ) BEGIN
+ INSERT INTO TrainPriceList
+ (
+ TPL_Train_No,
+ TPL_Train_Code,
+ TPL_From_Station_Code,
+ TPL_To_Station_Code,
+ TPL_Price,
+ TPL_Datetime,
+ TPL_Source
+ )
+ VALUES
+ (
+ '$TPL_Train_No','$TPL_Train_Code','$TPL_From_Station_Code','$TPL_To_Station_Code','$TPL_Price',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'
+ END
+ ";
+ $query = $this->INFO->query($sql);
+ return $query;
+ }
+
+ //ȡ۸
+ public function get_price($fromStationCode,$toStationCode,$trainCode){
+ $sql = "SELECT
+ TPL_Price
+ FROM
+ TrainPriceList
+ WHERE
+ TPL_Train_Code = '$trainCode'
+ AND
+ TPL_From_Station_Code = '$fromStationCode'
+ AND
+ TPL_To_Station_Code = '$toStationCode'";
+ $query = $this->INFO->query($sql);
+ return $query->row();
+ }
+}
+?>
\ No newline at end of file
diff --git a/application/views/bootstrap/header.php b/application/views/bootstrap/header.php
index 578b1108..952eace6 100644
--- a/application/views/bootstrap/header.php
+++ b/application/views/bootstrap/header.php
@@ -96,6 +96,7 @@
+
diff --git a/application/views/bootstrap3/header.php b/application/views/bootstrap3/header.php
index f743428d..02a83824 100644
--- a/application/views/bootstrap3/header.php
+++ b/application/views/bootstrap3/header.php
@@ -99,6 +99,7 @@
+
diff --git a/application/views/bootstrap3/information_edit.php b/application/views/bootstrap3/information_edit.php
index 406cf330..40edd1fb 100644
--- a/application/views/bootstrap3/information_edit.php
+++ b/application/views/bootstrap3/information_edit.php
@@ -1183,7 +1183,7 @@
忽略URL重复
- config->item('site_code') == 'ah')) { ?>
+ config->item('site_code') == 'ah') || ($this->config->item('site_code') == 'gm') ) { ?>