diff --git a/application/models/feedback_model.php b/application/models/feedback_model.php index 026c4d48..fcb60729 100644 --- a/application/models/feedback_model.php +++ b/application/models/feedback_model.php @@ -19,7 +19,7 @@ class Feedback_model extends CI_Model { 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 + 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); @@ -31,7 +31,7 @@ class Feedback_model extends CI_Model { $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) { + 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, @@ -54,9 +54,9 @@ class Feedback_model extends CI_Model { 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_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 + where TAD_Content is not null and isnull(TAI_DeleteFlag,0) = 0 and isnull(tgp.TGP_CheckState, 0) = 136002 order by tai_getdate desc"); @@ -68,8 +68,8 @@ class Feedback_model extends CI_Model { $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 = [ + 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, @@ -87,28 +87,30 @@ class Feedback_model extends CI_Model { /** * 根据城市英文名查找最新八条反馈信息 */ - 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])); + function get_feedback_by_city_list($city_name_list, $all=TRUE) { + $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 vci.cii2_name = ? and tai_url not LIKE '%trustpilot.com%' + order by tai_getdate desc", + array($city_name_list[0])); + + if ($all) { $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", + 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])); + } $first_city_num = $feedback_query->num_rows(); $feedback_result = $feedback_query->result(); @@ -120,7 +122,7 @@ class Feedback_model extends CI_Model { $createdOnString = $createdOn->format('M Y'); $feedback_count = COUNT($feedback_list); - if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < 20) { + if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < 20) { $feedback = [ 'title' => $feedback_row->tai_title, 'customer' => $feedback_row->tai_customerid, @@ -134,37 +136,40 @@ class Feedback_model extends CI_Model { } $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 + 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 = ? and tai_url not LIKE '%trustpilot.com%' order by tai_getdate desc", array($enough_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])); + + if ($all) { + $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) { + if (!in_array($feedback_row->tai_customerid, $customer_id_list) && $feedback_count < 20) { $feedback = [ 'title' => $feedback_row->tai_title, 'customer' => $feedback_row->tai_customerid, @@ -190,7 +195,7 @@ class Feedback_model extends CI_Model { // $this->HT->query(" // select top ? // tad_content, tai_customerid, tai_title, tai_getdate, tai_url, vci.cii2_name - // from Eva_TAInfo + // 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 = ? @@ -200,7 +205,7 @@ class Feedback_model extends CI_Model { $this->HT->query(" select top ? tad_content, tai_customerid, tai_title, tai_getdate, tai_url, vci.cii2_name - from Eva_TAInfo + 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 = ? and tai_url not LIKE '%trustpilot.com%' @@ -214,8 +219,8 @@ class Feedback_model extends CI_Model { 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)) { + + if (!in_array($feedback_row->tai_customerid, $customer_id_list)) { $feedback = [ 'title' => $feedback_row->tai_title, 'customer' => $feedback_row->tai_customerid, @@ -238,21 +243,21 @@ class Feedback_model extends CI_Model { $feedback_query = $this->HT->query(" select top 3 - tad.tad_content, - tai.tai_customerid, - tai.tai_title, - tai.tai_getdate, - tai.tai_url, + 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 + 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 + where e.TAD_ObjType = 99002 + and v.LGC_LGC = 1 and v.OPI2_Name = ? ) and tai_url not LIKE '%trustpilot.com%' @@ -267,8 +272,8 @@ class Feedback_model extends CI_Model { 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)) { + + if (!in_array($feedback_row->tai_customerid, $customer_id_list)) { $feedback = [ 'title' => $feedback_row->tai_title, 'customer' => $feedback_row->tai_customerid, @@ -294,10 +299,10 @@ class Feedback_model extends CI_Model { $sql = " select top ? tad_content, tai_customerid, tai_title, tai_getdate, tai_url, vci.cii2_name - from Eva_TAInfo + 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 + where TAD_Content is not null and tai_url not LIKE '%trustpilot.com%' "; //根据传递的城市名称进行判断 @@ -309,9 +314,9 @@ class Feedback_model extends CI_Model { // 将每个字符串元素用引号包围,然后用逗号连接起来 $cityList = "'" . implode("','", $cityArray) . "'"; $sql .= "and vci.cii2_name in ($cityList) "; - } - - $sql .=" and TAI_GRI_SN in ( select coli_gri_sn from ConfirmLineInfo + } + + $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"; @@ -328,8 +333,8 @@ class Feedback_model extends CI_Model { 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)) { + + if (!in_array($feedback_row->tai_customerid, $customer_id_list)) { $feedback = [ 'title' => $feedback_row->tai_title, 'customer' => $feedback_row->tai_customerid,