From 3415fffef2f87e9da3fd91b60cc20219a39aa1e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Mon, 30 Jun 2025 16:18:04 +0800 Subject: [PATCH] fix --- .../ctmobilefirst/controllers/api.php | 2 +- .../ctmobilefirst/models/api_model.php | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/application/third_party/ctmobilefirst/controllers/api.php b/application/third_party/ctmobilefirst/controllers/api.php index 8ae011d8..ae5092be 100644 --- a/application/third_party/ctmobilefirst/controllers/api.php +++ b/application/third_party/ctmobilefirst/controllers/api.php @@ -482,7 +482,7 @@ class Api extends CI_Controller { * 获取发布的一日游详细页的所有产品对应的类型列表,扩展类型列表。(用于搜索页) */ public function getPagTypeList(){ - $list = $this->api_model->getLineTypeList(); + $list = $this->api_model->getPagTypeList(); echo json_encode($list,JSON_NUMERIC_CHECK); } diff --git a/application/third_party/ctmobilefirst/models/api_model.php b/application/third_party/ctmobilefirst/models/api_model.php index f0f17f17..4b312680 100644 --- a/application/third_party/ctmobilefirst/models/api_model.php +++ b/application/third_party/ctmobilefirst/models/api_model.php @@ -609,7 +609,11 @@ class Api_model extends CI_Model { foreach ($query->result_array() as $row) { $column_data = $row['CLI_LineType']; // 分割逗号分隔的值 - $values = explode(',', $column_data); + $values = explode(',', $column_data); + //去掉逗号 + $values = array_map(function($item) { + return trim($item, ','); + }, $values); // 去除每个值的空白字符 $values = array_map('trim', $values); // 合并到总数组 @@ -785,13 +789,20 @@ class Api_model extends CI_Model { // 分割逗号分隔的值 $values = explode(',', $column_data); // 去除每个值的空白字符 - $values = array_map('trim', $values); + $values = array_map('trim', $values); + //去掉收尾逗号 + $values = array_map(function($item) { + return trim($item, ','); + }, $values); // 合并到总数组 $type_values = array_merge($type_values, $values); $column_data2 = $row['PAG_ExtendType']; // 分割逗号分隔的值 - $values2 = explode(',', $column_data); + $values2 = explode(',', $column_data); + $values2 = array_map(function($item) { + return trim($item, ','); + }, $values2); // 去除每个值的空白字符 $values2 = array_map('trim', $values); // 合并到总数组