diff --git a/application/controllers/information.php b/application/controllers/information.php index 5c574cf6..6af1d83f 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -3698,6 +3698,8 @@ class Information extends CI_Controller //线路类型列表 $lineTypeList = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getLineTypeList/?webcode=shanghai")); $dataTourList["lineTypeList"] = $lineTypeList; + $tourListData = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getTourList/?webcode=shanghai")); + $dataTourList["tourListData"] = $tourListData; //替换模板 $template_page_tourlist = $this->load->view($template_path . '-tour-list', $dataTourList, true); //模板内容 diff --git a/application/third_party/ctmobilefirst/controllers/api.php b/application/third_party/ctmobilefirst/controllers/api.php index eb27b1bd..0998b34f 100644 --- a/application/third_party/ctmobilefirst/controllers/api.php +++ b/application/third_party/ctmobilefirst/controllers/api.php @@ -475,7 +475,7 @@ class Api extends CI_Controller { */ public function getTourList(){ $list = $this->api_model->getTourList(); - echo json_encode($list,JSON_NUMERIC_CHECK); + echo json_encode($list,JSON_UNESCAPED_UNICODE); } } diff --git a/application/third_party/ctmobilefirst/models/api_model.php b/application/third_party/ctmobilefirst/models/api_model.php index 57f3e043..1d96f92c 100644 --- a/application/third_party/ctmobilefirst/models/api_model.php +++ b/application/third_party/ctmobilefirst/models/api_model.php @@ -690,15 +690,35 @@ class Api_model extends CI_Model { $tourItem->title = $row["ic_url_title"]; //价格 - $tourItem->price = $this->getTourPrice($row["code"]); + $price = $this->getTourPrice($row["code"]); + // 处理价格: + // 1. 如果是 null,设为空字符串 "" + // 2. 如果是数字(如 100.0000),转为整数(100) + $tourItem->price = ($price === null) + ? "" + : (string)(int)floatval($price); + //类别信息 $tourDetail = $this->getTourDetail($row["code"]); if (isset($tourDetail->CLI_LineType)){ - $tourItem->linetype = $tourDetail->CLI_LineType; + $tourItem->linetype = strval($tourDetail->CLI_LineType); }else{ $tourItem->linetype = ""; } + //城市 + if (isset($tourDetail->CLI2_PassCity)){ + $tourItem->PassCity = $tourDetail->CLI2_PassCity; + }else{ + $tourItem->PassCity = ""; + } + //天数 + if (isset($tourDetail->CLI2_PassCity)){ + $tourItem->Days = $tourDetail->CLI_Days; + }else{ + $tourItem->Days = 0; + } + $resultJson[] = $tourItem; } @@ -713,7 +733,7 @@ class Api_model extends CI_Model { * 获取对应编码的线路信息 */ function getTourDetail($clino){ - $sql = " SELECT top 1 CLI_LineType ,CLI_PackageClass,CLI_SN + $sql = " SELECT top 1 CLI_LineType ,CLI_PackageClass,CLI_SN,CLI2_PassCity,CLI_Days FROM CustomerLineInfo INNER JOIN CustomerLineInfo2 ON CustomerLineInfo.CLI_SN = CustomerLineInfo2.CLI2_CLI_SN WHERE (CLI_DEI_SN=".$this->dei_sn.")