Merge branch 'master' of github.com:hainatravel/information-system into master

master
candice 2 years ago
commit 44bd364524

@ -2594,6 +2594,31 @@ class Information extends CI_Controller
$ic_content = str_replace('<!--@ZODIAC-CALC@-->', $zodiacCalc, $ic_content);
}
// 动态加载反馈标签,按城市出前三条。
// HTLM: <div><!--@FEEDBACK_Shanghai,Beijing@--></div> ,显示全部用<!--@FEEDBACK_All@-->
// 解析结果:<!--@FEEDBACK_Shanghai,Beijing@-->; Shanghai,Beijing
$feedback_array = [];
preg_match_all('^<!--@FEEDBACK_(.*)@-->^', $information->ic_content, $feedback_array);
if (!empty($feedback_array)) {
foreach ($feedback_array[0] as $index => $tag_name) {
$city_name_string = $feedback_array[1][$index];
$feedback_list = $this->Feedback_model->get_CT_feedback_by_cityname($city_name_string,30);
// 防止触发 Google 网络垃圾政策只返回前三条
$top3_feedback_list = array_slice($feedback_list, 0, 3);
$feedback_content = $this->load->view(
'mobile_first/chinatravel-feedback-list',
array('feedback_list' => $top3_feedback_list),
true
);
$ic_content = str_replace(
$tag_name,
$feedback_content,
$ic_content
);
}
}
//图片加延迟
$ic_content = $this->html_optimize_lib->set_lazy_loader($ic_content, 'https://data.chinatravel.com/images/mobile-first/grey.gif');

@ -252,4 +252,63 @@ class Feedback_model extends CI_Model {
return $feedback_list;
}
/***
* CT站获取反馈信息列表根据城市
* // HTLM: <div><!--@FEEDBACK_Shanghai,Beijing@--></div>
// 解析结果:<!--@FEEDBACK_Shanghai,Beijing@-->; Shanghai,Beijing
*/
function get_CT_feedback_by_cityname($city,$top=30){
$sql = "
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 ";
//根据传递的城市名称进行判断
if ($city == "All" || empty($city)){
}else{
// 使用 explode 函数分割字符串,并去除空格
$cityArray = array_map('trim', explode(',', $city));
// 将每个字符串元素用引号包围,然后用逗号连接起来
$cityList = "'" . implode("','", $cityArray) . "'";
$sql .= "and vci.cii2_name in ($cityList) ";
}
$sql .=" and TAI_GRI_SN in ( select coli_gri_sn from ConfirmLineInfo
where COLI_OPI_ID in ( select OPI_SN from OperatorInfo where OPI_DEI_SN=18)
and COLI_GRI_SN>'' and isnull(DeleteFlag,0)=0 )
order by tai_getdate desc";
// echo ($sql);
// die();
$feedback_query =
$this->HT->query($sql, array($top));
$feedback_result = $feedback_query->result();
$feedback_list = [];
$customer_id_list = [];
foreach ($feedback_result as $feedback_row) {
$createdOn = new DateTime($feedback_row->tai_getdate);
$createdOnString = $createdOn->format('M Y');
if (!in_array($feedback_row->tai_customerid, $customer_id_list)) {
$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;
$customer_id_list[] = $feedback_row->tai_customerid;
}
}
return $feedback_list;
}
}

@ -0,0 +1,17 @@
<p class="tripadvisor-logo"><img alt="Trip Advisor reviews" src="//data.chinatravel.com/images/icon/tripadvisor-logo.webp" width="180" height="40"><i class="font24">Discover Why Travelers Love ChinaTravel</i></p>
<div class="xscroll-box">
<div class="review-right">
<?php foreach ($feedback_list as $index => $feedback) {?>
<div class="review-item">
<p class="review-title"> <?php echo $feedback['title'] ?> </p>
<p class="review-info"><?php echo $feedback['content'] ?></p>
<div class="review-member">
<p><a href="<?php echo $feedback['url'] ?>" target="_blank" rel="nofollow">more</a></p>
<p class="color8"><?php echo $feedback['customer'] ?></p>
<p><span class="f-rating"></span></p>
</div>
</div>
<?php }?>
<div class="clear"></div>
</div>
</div>
Loading…
Cancel
Save