diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php
index 8ca8c071..f683e70c 100644
--- a/application/controllers/info_amp.php
+++ b/application/controllers/info_amp.php
@@ -242,7 +242,7 @@ class Info_amp extends CI_Controller
if (!empty($rs)) {
$newrs = array();
foreach ($rs as $info) {
- if (!empty($info->ic_content) && !empty($info->ic_url)) {
+ if (!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,
diff --git a/application/models/infoMetas_model.php b/application/models/infoMetas_model.php
index fb8f3252..a2dff370 100644
--- a/application/models/infoMetas_model.php
+++ b/application/models/infoMetas_model.php
@@ -72,7 +72,8 @@ class InfoMetas_model extends CI_Model {
. " 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";
+ . " 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();
diff --git a/application/third_party/train/controllers/search.php b/application/third_party/train/controllers/search.php
index 2c4485d5..80392a79 100644
--- a/application/third_party/train/controllers/search.php
+++ b/application/third_party/train/controllers/search.php
@@ -194,6 +194,107 @@ class search extends CI_Controller{
return json_encode($return_data);
}
+ //国际火车获取
+ public function search_international_train(){
+ 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->model("BIZ_intel_train_model");
+
+ $json = file_get_contents('php://input');
+
+ if(empty($json)){
+ header("HTTP/1.1 404 Not Found");
+ exit('{"status":"404","reason":"出发站或到达站为空"}');
+ }
+
+
+ $trainFrom = json_decode($json)->trainFrom;
+ $trainTo = json_decode($json)->trainTo;
+ $trainDate = json_decode($json)->trainDate;
+
+
+ //根据传过来的城市名称获取城市代码
+ $trainFromCode = $this->BIZ_intel_train_model->get_code_by_name($trainFrom)->s_code;
+ $trainToCode = $this->BIZ_intel_train_model->get_code_by_name($trainTo)->s_code;
+
+ //获取车次信息
+ $obj = $this->BIZ_intel_train_model->get_train_info($trainFromCode,$trainToCode);
+
+ $enobj = array();
+
+ //如果结果为空则直接返回为空的结果
+ if(empty($obj)){
+ exit('{"status":"201","reason":"无车次信息!","data":""}');
+ }
+
+ //如果有结果则进行字符串处理
+ 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_EName2;
+ $item->adult_seat[$i]['name'] = $seat_name;
+ $item->adult_seat[$i]['code'] = $key_adult;
+ $item->adult_seat[$i]['price'] = $value;
+ $i++;
+ }
+ }
+
+ if(!empty($child)){
+ $j=0;
+ foreach($child as $key_child=>$value){
+ $seat_name = $this->BIZ_intel_train_model->get_seatname($key_child)->Seat_EName2;
+ $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($enobj,$obj[$key]);
+ unset($obj[$key]);
+ }
+
+ }
+ //处理返回的字符串
+ $return_json = new StdClass();
+ $return_json->status = '200';
+ $return_json->reason = '成功的返回';
+ $return_json->data = $obj;
+ $return_json->endata = $enobj;
+ print_r(json_encode($return_json));
+ }
//获取价格(废弃)
/*
@@ -235,6 +336,156 @@ 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会话
diff --git a/application/third_party/train/models/BIZ_intel_train_model.php b/application/third_party/train/models/BIZ_intel_train_model.php
new file mode 100644
index 00000000..c9c51de6
--- /dev/null
+++ b/application/third_party/train/models/BIZ_intel_train_model.php
@@ -0,0 +1,61 @@
+HT = $this->load->database('HT', TRUE);
+ }
+
+ //ѯʻϢ˵ڹΪգ۸ΪյĿ
+ public function get_train_info($trainFromCode,$trainToCode){
+ $sql = "
+ SELECT
+ tl.trainNo,
+ tl.trainFrom,
+ tl.trainFromCode,
+ tl.trainTo,
+ tl.trainToCode,
+ tl.trainType,
+ tl.train_no,
+ tl.trainUse,
+ tl.RunTime,
+ tl.departTime,
+ tl.arriveTime,
+ tl.UseDay,
+ tl.DateRule,
+ tp.seatPriceInfo2
+ FROM
+ trainlist tl
+ left join
+ trainPrice tp
+ on
+ tl.train_no = tp.train_no
+ WHERE
+ tl.isGlobal = 1
+ AND
+ tl.trainFromCode = '{$trainFromCode}'
+ AND
+ tl.trainToCode = '{$trainToCode}'
+ AND
+ tl.DateRule != ''
+ AND
+ tp.seatPriceInfo2 IS NOT NULL
+ ";
+ $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_EName2 from TrainSeat_Intel where Seat_code = '{$seat_code}'";
+ $query = $this->HT->query($sql);
+ return $query->row();
+ }
+
+}
diff --git a/application/views/bootstrap3/information_edit.php b/application/views/bootstrap3/information_edit.php
index 7c672607..3d02cca8 100644
--- a/application/views/bootstrap3/information_edit.php
+++ b/application/views/bootstrap3/information_edit.php
@@ -555,7 +555,7 @@
$amp_photo = $this->config->item('site_image_url').$information->ic_photo;
}
?>
- |
+ |
ic_id, 'AMP_STATUS') === '1') {?>