|
|
<?php
|
|
|
|
|
|
class Feedback_model extends CI_Model {
|
|
|
|
|
|
function __construct() {
|
|
|
parent::__construct();
|
|
|
$this->HT = $this->load->database('HT', TRUE);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 返回最新反馈信息,默认 20条
|
|
|
*/
|
|
|
function get_feedback_newest($row_limit = 20) {
|
|
|
$total_limit = $row_limit * 2;
|
|
|
$feedback_query =
|
|
|
$this->HT->query("
|
|
|
select top ?
|
|
|
tad_content, tai_customerid, tai_title, tai_getdate, tai_url
|
|
|
from Eva_TAInfo tai
|
|
|
left join Eva_TADetail on TAD_TAI_SN=TAI_SN
|
|
|
left join Eva_TAGuidePrize tgp on tgp.TGP_TAI_SN = tai.TAI_SN
|
|
|
where TAD_Content is not null
|
|
|
and isnull(TAI_DeleteFlag,0) = 0 and isnull(tgp.TGP_CheckState, 0) = 136002
|
|
|
order by tai_getdate desc", $total_limit);
|
|
|
|
|
|
$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');
|
|
|
$feedback_count = COUNT($feedback_list);
|
|
|
if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < $row_limit) {
|
|
|
$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;
|
|
|
}
|
|
|
|
|
|
function test_feedback_newest() {
|
|
|
|
|
|
$feedback_query =
|
|
|
$this->HT->query("
|
|
|
select top 40
|
|
|
tad_content, tai_customerid, tai_title, tai_getdate, tai_url
|
|
|
from Eva_TAInfo tai
|
|
|
left join Eva_TADetail on TAD_TAI_SN=TAI_SN
|
|
|
left join Eva_TAGuidePrize tgp on tgp.TGP_TAI_SN = tai.TAI_SN
|
|
|
where TAD_Content is not null
|
|
|
and isnull(TAI_DeleteFlag,0) = 0 and isnull(tgp.TGP_CheckState, 0) = 136002
|
|
|
order by tai_getdate desc");
|
|
|
|
|
|
$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');
|
|
|
$feedback_count = COUNT($feedback_list);
|
|
|
if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < 20) {
|
|
|
$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;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据城市英文名查找最新八条反馈信息
|
|
|
*/
|
|
|
function get_feedback_by_city_list($city_name_list) {
|
|
|
|
|
|
// $feedback_query =
|
|
|
// $this->HT->query("
|
|
|
// select top 40
|
|
|
// 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]));
|
|
|
|
|
|
$feedback_query =
|
|
|
$this->HT->query("
|
|
|
select top 40 tai_url,tad_content, tai_customerid, tai_title, tai_getdate, 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 tai_url not LIKE '%trustpilot.com%'
|
|
|
order by tai_getdate desc",
|
|
|
array($city_name_list[0]));
|
|
|
|
|
|
$first_city_num = $feedback_query->num_rows();
|
|
|
$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');
|
|
|
$feedback_count = COUNT($feedback_list);
|
|
|
|
|
|
if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < 20) {
|
|
|
$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;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$enough_count = 40 - $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_count = COUNT($feedback_list);
|
|
|
|
|
|
if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < 20) {
|
|
|
$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;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据城市英文名查找反馈信息
|
|
|
*/
|
|
|
function get_feedback_by_city_name($city_name, $top = 30) {
|
|
|
|
|
|
$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($top, $city_name));
|
|
|
|
|
|
$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;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据顾问英文名查找反馈信息
|
|
|
*/
|
|
|
function get_feedback_by_advisor_name($advisor_name) {
|
|
|
$feedback_query =
|
|
|
$this->HT->query("
|
|
|
select top 3
|
|
|
tad.tad_content,
|
|
|
tai.tai_customerid,
|
|
|
tai.tai_title,
|
|
|
tai.tai_getdate,
|
|
|
tai.tai_url,
|
|
|
vci.cii2_name
|
|
|
from Eva_TAInfo tai
|
|
|
join Eva_TADetail tad on tad.TAD_TAI_SN = tai.TAI_SN
|
|
|
join V_CIty_Info vci on vci.cii_sn = tai.tai_cii_sn and vci.LGC_LGC = 1
|
|
|
where tad.TAD_SN in (
|
|
|
select TAD_SN
|
|
|
from Eva_TADetail e
|
|
|
join V_Operator_Info v on e.TAD_ObjList like '%,' + cast(v.OPI_SN as varchar) + ',%'
|
|
|
where e.TAD_ObjType = 99002
|
|
|
and v.LGC_LGC = 1
|
|
|
and v.OPI2_Name = ?
|
|
|
)
|
|
|
order by tai.tai_getdate desc;
|
|
|
",
|
|
|
array($advisor_name));
|
|
|
|
|
|
$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;
|
|
|
}
|
|
|
|
|
|
|
|
|
/***
|
|
|
* 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;
|
|
|
}
|
|
|
}
|