You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/application/models/feedback_model.php

42 lines
1.2 KiB
PHP

<?php
class Feedback_model extends CI_Model {
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
/**
* 根据城市英文名查找最新一条反馈信息
*/
function get_feedback_by_city($city_name) {
$feedback_query =
$this->HT->query("
select top 1
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));
$feedback_row = $feedback_query->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
];
return $feedback;
}
}