diff --git a/application/controllers/information.php b/application/controllers/information.php index d4cd7dd1..3df77f35 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -22,7 +22,7 @@ class Information extends CI_Controller { $this->load->model('InfoSMS_model'); if (is_series_site()) { - $this->load->model('InfoTags_model'); + //$this->load->model('InfoTags_model'); } $this->load->library('Accesscheck'); @@ -271,10 +271,10 @@ class Information extends CI_Controller { $data['all_tags'] = array(); if (is_series_site()) { //信息标签 - $this->InfoTags_model->ic_id = null; - $data['all_tags'] = $this->InfoTags_model->list_tag(); - $this->InfoTags_model->ic_id = $data['information']->ic_id; - $data['my_tags'] = $this->InfoTags_model->list_tag(); + //$this->InfoTags_model->ic_id = null; + //$data['all_tags'] = $this->InfoTags_model->list_tag(); + //$this->InfoTags_model->ic_id = $data['information']->ic_id; + //$data['my_tags'] = $this->InfoTags_model->list_tag(); //差集 foreach ($data['all_tags'] as &$it) { diff --git a/application/controllers/payment.php b/application/controllers/payment.php index 82a594ed..cdced964 100644 --- a/application/controllers/payment.php +++ b/application/controllers/payment.php @@ -16,8 +16,7 @@ class Payment extends CI_Controller { $data=array(); if ($this->input->post('price')) { - $data['payurl']=' - Information_model->search_all_text('&t=78002', 2000); + echo 'redirect count: '.count($include_redirece_info).'
'; + $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.')'.'
'; + echo 'a.href: '.$a_href.'; rel: '.$a_rel.'
'; + $redirect_nofollow_list[] = $info; + } + } + } + echo 'nofollow_count: '.count($redirect_nofollow_list).'
'; + 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).'
'; + } + 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']).'
'; + var_dump($data['all_information']); } public function transform_href_to_https() { diff --git a/application/models/infoMetas_model.php b/application/models/infoMetas_model.php index e389361c..d40ca931 100644 --- a/application/models/infoMetas_model.php +++ b/application/models/infoMetas_model.php @@ -75,7 +75,7 @@ class InfoMetas_model extends CI_Model { 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 c0.ic_sitecode = ? AND c0.ic_status = 1 AND c0.ic_url <> '' AND datalength(c0.ic_content) > 0 "; $query = $this->HT->query($sql, array($site_code, $site_code)); return $query->result(); diff --git a/application/third_party/train/controllers/search.php b/application/third_party/train/controllers/search.php index 16cb31ca..85c98c06 100644 --- a/application/third_party/train/controllers/search.php +++ b/application/third_party/train/controllers/search.php @@ -85,23 +85,27 @@ class search extends CI_Controller{ $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(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){ - $this->BIZ_train_model->delete_traincache($fromStation,$toStation); - log_message('error','TRAIN 查询为空的链接:'.$this->url.'|出错的原因:'.$this->reason.'|缓存超时,已经删除'); + if($this->seveth == 'yes'){ + $cache_train_info = $this->BIZ_train_model->get_train_info($fromStation,$toStation); + if(empty($cache_train_info)){ + log_message('error','TRAIN 查询为空的链接:'.$this->url.'|出错的原因:'.$this->reason.'|缓存为空'); $operate_data = NULL; }else{ - $this->cache = 'yes'; - $operate_data = $cache_train_info->tpc_content; - log_message('error','TRAIN 查询为空的链接:'.$this->url.'|出错的原因:'.$this->reason.'|调用缓存号:'.$cache_train_info->tpc_sn.'|缓存生成的时间:'.$cache_train_info->tpc_datetime); - } + $cache_time = $cache_train_info->tpc_datetime; + $now_time = time(); + $differ_time = ($now_time - strtotime($cache_time)) / 86400; + if($differ_time >= 3){ + $this->BIZ_train_model->delete_traincache($fromStation,$toStation); + log_message('error','TRAIN 查询为空的链接:'.$this->url.'|出错的原因:'.$this->reason.'|缓存超时,已经删除'); + $operate_data = NULL; + }else{ + $this->cache = 'yes'; + $operate_data = $cache_train_info->tpc_content; + log_message('error','TRAIN 查询为空的链接:'.$this->url.'|出错的原因:'.$this->reason.'|调用缓存号:'.$cache_train_info->tpc_sn.'|缓存生成的时间:'.$cache_train_info->tpc_datetime); + } + } + }else{ + $operate_data = NULL; } } return $operate_data; @@ -282,6 +286,7 @@ class search extends CI_Controller{ $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++; } } @@ -356,6 +361,30 @@ class search extends CI_Controller{ 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){ + $return_json['TrainList'][$i]['FromStation'] = $item->s_ename.','.$item->s_country; + $return_json['TrainList'][$i]['ToStations'] = array(); + $rule_arr = $this->BIZ_intel_train_model->get_train_rules($item->station_id); + $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.','.$item->s_country; + $j++; + } + + $i++; + } + //print_r($return_json); + print_r(json_encode($return_json)); + } + //获取价格(废弃) /* fromStationCode:出发站三字码 @@ -553,7 +582,7 @@ class search extends CI_Controller{ 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)) { diff --git a/application/third_party/train/models/BIZ_intel_train_model.php b/application/third_party/train/models/BIZ_intel_train_model.php index 282b9aa8..615287ee 100644 --- a/application/third_party/train/models/BIZ_intel_train_model.php +++ b/application/third_party/train/models/BIZ_intel_train_model.php @@ -21,9 +21,10 @@ class BIZ_intel_train_model extends CI_Model { tl.trainUse, tl.RunTime, tl.departTime, - tl.arriveTime, + (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 @@ -41,6 +42,8 @@ class BIZ_intel_train_model extends CI_Model { tl.DateRule != '' AND tp.seatPriceInfo2 IS NOT NULL + order by + departTime asc "; $query = $this->HT->query($sql); return $query->result(); @@ -53,7 +56,7 @@ class BIZ_intel_train_model extends CI_Model { } public function get_seatname($seat_code){ - $sql = "select Seat_EName1 from TrainSeat_Intel where Seat_code = '{$seat_code}'"; + $sql = "select Seat_EName1,Seat_Pic from TrainSeat_Intel where Seat_code = '{$seat_code}'"; $query = $this->HT->query($sql); return $query->row(); } @@ -104,9 +107,29 @@ class BIZ_intel_train_model extends CI_Model { } public function get_train_station($train_no){ - $sql = "SELECT * FROM trainlistDetail WHERE train_no = '{$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 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(); + } } diff --git a/application/views/bootstrap3/header.php b/application/views/bootstrap3/header.php index 4add9b10..664cc98d 100644 --- a/application/views/bootstrap3/header.php +++ b/application/views/bootstrap3/header.php @@ -6,7 +6,7 @@ 信息平台 - +