diff --git a/application/controllers/information.php b/application/controllers/information.php index 802d3632..98ec8ac8 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -1242,8 +1242,9 @@ class Information extends CI_Controller preg_match_all('^^', $information->ic_content, $feedback_array); if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { - $city_name = $feedback_array[1][$index]; - $feedback_data = $this->Feedback_model->get_feedback_by_city($city_name); + $city_name_string = $feedback_array[1][$index]; + $city_name_list = explode(',', $city_name_string); + // $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list); // $feedback_content = $this->load->view( // $template_path . '-feedback', // array('feedback_data' => $feedback_data), @@ -1312,6 +1313,27 @@ class Information extends CI_Controller file_put_contents($html_path, $template, LOCK_EX); } + public function test_ah_feedback() { + $feedback_array = []; + preg_match_all('^^', '
', $feedback_array); + if (!empty($feedback_array)) { + foreach ($feedback_array[0] as $index => $tag_name) { + $city_name_string = $feedback_array[1][$index]; + $city_name_list = explode(',', $city_name_string); + $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list); + var_dump($feedback_list); + // $feedback_content = $this->load->view( + // $template_path . '-feedback', + // array('feedback_data' => $feedback_data), + // true); + // $information->ic_content = str_replace( + // $tag_name, + // $feedback_content, + // $information->ic_content); + } + } + } + /** * @description: CT用的生成静态文件方法.有些内容的替换,CT这边不一样,需要单独处理 zp * @param {type} $device='mobile' or 'pc' diff --git a/application/models/feedback_model.php b/application/models/feedback_model.php index 3defcc51..a488d08a 100644 --- a/application/models/feedback_model.php +++ b/application/models/feedback_model.php @@ -7,6 +7,74 @@ class Feedback_model extends CI_Model { $this->HT = $this->load->database('HT', TRUE); } + /** + * 根据城市英文名查找最新八条反馈信息 + */ + function get_feedback_by_city_list($city_name_list) { + + $feedback_query = + $this->HT->query(" + select top 8 + tad_content, tai_customerid, tai_title, tai_getdate, tai_url, vci.cii2_name + from Eva_TAInfo + left join Eva_TADetail on TAD_TAI_SN=TAI_SN + left join V_CIty_Info vci on vci.cii_sn = tai_cii_sn and vci.LGC_LGC = 1 + where TAD_Content is not null and vci.cii2_name = ? + order by tai_getdate desc", + array($city_name_list[0])); + + $first_city_num = $feedback_query->num_rows(); + $feedback_result = $feedback_query->result(); + $feedback_list = []; + + foreach ($feedback_result as $feedback_row) { + $createdOn = new DateTime($feedback_row->tai_getdate); + $createdOnString = $createdOn->format('M Y'); + + $feedback = [ + 'title' => $feedback_row->tai_title, + 'customer' => $feedback_row->tai_customerid, + 'content' => $feedback_row->tad_content, + 'url' => $feedback_row->tai_url, + 'createdOn' => $createdOnString + ]; + $feedback_list[] = $feedback; + } + + $enough_count = 8 - $first_city_num; + + if ($enough_count > 0 && count($city_name_list) > 1) { + + $feedback_query = + $this->HT->query(" + select top ? + tad_content, tai_customerid, tai_title, tai_getdate, tai_url, vci.cii2_name + from Eva_TAInfo + left join Eva_TADetail on TAD_TAI_SN=TAI_SN + left join V_CIty_Info vci on vci.cii_sn = tai_cii_sn and vci.LGC_LGC = 1 + where TAD_Content is not null and vci.cii2_name = ? + order by tai_getdate desc", + array($enough_count, $city_name_list[1])); + $feedback_result = $feedback_query->result(); + + foreach ($feedback_result as $feedback_row) { + $createdOn = new DateTime($feedback_row->tai_getdate); + $createdOnString = $createdOn->format('M Y'); + + $feedback = [ + 'title' => $feedback_row->tai_title, + 'customer' => $feedback_row->tai_customerid, + 'content' => $feedback_row->tad_content, + 'url' => $feedback_row->tai_url, + 'createdOn' => $createdOnString + ]; + $feedback_list[] = $feedback; + } + } + + return $feedback_list; + } + /** * 根据城市英文名查找最新一条反馈信息 */ diff --git a/application/views/mobile_first/ah-feedback-list.php b/application/views/mobile_first/ah-feedback-list.php new file mode 100644 index 00000000..a85a6094 --- /dev/null +++ b/application/views/mobile_first/ah-feedback-list.php @@ -0,0 +1,60 @@ +
+

What Our Customers Said

+
+
+ + + + + + + + + + + + +
+
+ + +
Melissa Gornie, Apr 9, 2022
+
+
+
+ + +
Otto Lawrence, Oct 9, 2021
+
+
+
+ + +
Barbara Sheran, Jun 21, 2020
+
+
+
+ + +
Lurinda Smith Barton Barnwell, Mar 10, 2020
+
+
+
+ + +
Harold Miller, Feb 15, 2020
+
+
+
+ + +
Bob Bosshard, Mar 11, 2020
+
+
+
+ + +
Bianca Hernandez, Dec 20, 2019
+
+
+
\ No newline at end of file